Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Unified Diff: remoting/base/resources_mac.mm

Issue 21059003: Localized Chromoting Host on Mac and Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/base/resources_linux.cc ('k') | remoting/base/resources_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/base/resources_mac.mm
diff --git a/remoting/base/resources_mac.mm b/remoting/base/resources_mac.mm
new file mode 100644
index 0000000000000000000000000000000000000000..d1ce4af96db9271abac286924a4ae71ce87ef7fb
--- /dev/null
+++ b/remoting/base/resources_mac.mm
@@ -0,0 +1,43 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import <Cocoa/Cocoa.h>
+
+#include "remoting/base/resources.h"
+#include "base/mac/bundle_locations.h"
+#include "ui/base/l10n/l10n_util_mac.h"
+#include "ui/base/resource/resource_bundle.h"
+
+// A dummy class used to locate the host plugin's bundle.
+@interface NSBundleLocator : NSObject
+@end
+
+@implementation NSBundleLocator
+@end
+
+namespace remoting {
+
+bool LoadResources(const std::string& pref_locale) {
+ if (ui::ResourceBundle::HasSharedInstance()) {
+ ui::ResourceBundle::GetSharedInstance().ReloadLocaleResources(pref_locale);
+ } else {
+ // Use the plugin's bundle instead of the hosting app bundle.
+ base::mac::SetOverrideFrameworkBundle(
+ [NSBundle bundleForClass:[NSBundleLocator class]]);
+
+ // Override the locale with the value from Cocoa.
+ if (pref_locale.empty())
+ l10n_util::OverrideLocaleWithCocoaLocale();
+
+ ui::ResourceBundle::InitSharedInstanceLocaleOnly(pref_locale, NULL);
+ }
+
+ return true;
+}
+
+void UnloadResources() {
+ ui::ResourceBundle::CleanupSharedInstance();
+}
+
+} // namespace remoting
« no previous file with comments | « remoting/base/resources_linux.cc ('k') | remoting/base/resources_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698