summaryrefslogtreecommitdiffstats
path: root/remoting/host/continue_window_mac.mm
diff options
context:
space:
mode:
authoralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-30 17:16:07 +0000
committeralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-30 17:16:07 +0000
commit4534fb9f24c7e2f20e14da858ad3a0f398847323 (patch)
tree5b6e2e9a70d15e331a486e2f2a1e8abc950efbda /remoting/host/continue_window_mac.mm
parentc4bc9eb947207d668dcb2ce85c2603f4281161e9 (diff)
downloadchromium_src-4534fb9f24c7e2f20e14da858ad3a0f398847323.zip
chromium_src-4534fb9f24c7e2f20e14da858ad3a0f398847323.tar.gz
chromium_src-4534fb9f24c7e2f20e14da858ad3a0f398847323.tar.bz2
Localized Chromoting Host on Mac and Linux.
Re-landing r213997. TBR because this is a trivial, mechanical fix. This CL implements generation of localizable strings from remoting_strings.grd file. Depending on the platform the localized resources are placed to: - Mac: localized .string and .pak resources are added to each application bundle under 'Resources/<locale>.lproj' - Linux: localized .pak files are placed under 'remoting_locales' directory next to the binary locading them. - Windows: .rc resources are generated from .jinja2 templates and embedded into a relevant binary. Chrome l10n and i18n APIs are used to retrieve the current locale and RTL flag (Mac & Linux). The it2me plugin sets the locale to match the locale of the browser. Collateral changes: - UiString is not used any more. - Increased width of disconnect window message on Mac. - The host plugin version is correctly reported on Mac. - Dialogs use RTL templates in case of RTL languages. No more updating the templates dynamically (Windows). - remoting_unittests.ResourcesTest now runs on Mac, LInux and Windows. - '@' is used for variable substitutions by remoting_localize.py. - HOST_PLUGIN_MIME_TYPE is defined in one place now. - Deleted unused commong_resources.grd. Mac installer and preference panel are not localized yet. TBR=garykac@chromium.org BUG=155204 Review URL: https://codereview.chromium.org/20985002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214379 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/continue_window_mac.mm')
-rw-r--r--remoting/host/continue_window_mac.mm36
1 files changed, 14 insertions, 22 deletions
diff --git a/remoting/host/continue_window_mac.mm b/remoting/host/continue_window_mac.mm
index 5ab2bdb..6c24dee 100644
--- a/remoting/host/continue_window_mac.mm
+++ b/remoting/host/continue_window_mac.mm
@@ -9,7 +9,9 @@
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h"
+#include "remoting/base/string_resources.h"
#include "remoting/host/continue_window.h"
+#include "ui/base/l10n/l10n_util_mac.h"
// Handles the ContinueWindow.
@interface ContinueWindowMacController : NSObject {
@@ -17,11 +19,9 @@
base::scoped_nsobject<NSMutableArray> shades_;
base::scoped_nsobject<NSAlert> continue_alert_;
remoting::ContinueWindow* continue_window_;
- const remoting::UiStrings* ui_strings_;
}
-- (id)initWithUiStrings:(const remoting::UiStrings*)ui_strings
- continue_window:(remoting::ContinueWindow*)continue_window;
+- (id)initWithWindow:(remoting::ContinueWindow*)continue_window;
- (void)show;
- (void)hide;
- (void)onCancel:(id)sender;
@@ -34,7 +34,7 @@ namespace remoting {
// Everything important occurs in ContinueWindowMacController.
class ContinueWindowMac : public ContinueWindow {
public:
- explicit ContinueWindowMac(const UiStrings& ui_strings);
+ ContinueWindowMac();
virtual ~ContinueWindowMac();
protected:
@@ -48,8 +48,7 @@ class ContinueWindowMac : public ContinueWindow {
DISALLOW_COPY_AND_ASSIGN(ContinueWindowMac);
};
-ContinueWindowMac::ContinueWindowMac(const UiStrings& ui_strings)
- : ContinueWindow(ui_strings) {
+ContinueWindowMac::ContinueWindowMac() {
}
ContinueWindowMac::~ContinueWindowMac() {
@@ -61,8 +60,7 @@ void ContinueWindowMac::ShowUi() {
base::mac::ScopedNSAutoreleasePool pool;
controller_.reset(
- [[ContinueWindowMacController alloc] initWithUiStrings:&ui_strings()
- continue_window:this]);
+ [[ContinueWindowMacController alloc] initWithWindow:this]);
[controller_ show];
}
@@ -74,20 +72,17 @@ void ContinueWindowMac::HideUi() {
}
// static
-scoped_ptr<HostWindow> HostWindow::CreateContinueWindow(
- const UiStrings& ui_strings) {
- return scoped_ptr<HostWindow>(new ContinueWindowMac(ui_strings));
+scoped_ptr<HostWindow> HostWindow::CreateContinueWindow() {
+ return scoped_ptr<HostWindow>(new ContinueWindowMac());
}
} // namespace remoting
@implementation ContinueWindowMacController
-- (id)initWithUiStrings:(const remoting::UiStrings*)ui_strings
- continue_window:(remoting::ContinueWindow*)continue_window {
+- (id)initWithWindow:(remoting::ContinueWindow*)continue_window {
if ((self = [super init])) {
continue_window_ = continue_window;
- ui_strings_ = ui_strings;
}
return self;
}
@@ -116,21 +111,18 @@ scoped_ptr<HostWindow> HostWindow::CreateContinueWindow(
}
// Create alert.
- NSString* message = base::SysUTF16ToNSString(ui_strings_->continue_prompt);
- NSString* continue_button_string = base::SysUTF16ToNSString(
- ui_strings_->continue_button_text);
- NSString* cancel_button_string = base::SysUTF16ToNSString(
- ui_strings_->stop_sharing_button_text);
continue_alert_.reset([[NSAlert alloc] init]);
- [continue_alert_ setMessageText:message];
+ [continue_alert_ setMessageText:l10n_util::GetNSString(IDR_CONTINUE_PROMPT)];
NSButton* continue_button =
- [continue_alert_ addButtonWithTitle:continue_button_string];
+ [continue_alert_ addButtonWithTitle:l10n_util::GetNSString(
+ IDR_CONTINUE_BUTTON)];
[continue_button setAction:@selector(onContinue:)];
[continue_button setTarget:self];
NSButton* cancel_button =
- [continue_alert_ addButtonWithTitle:cancel_button_string];
+ [continue_alert_ addButtonWithTitle:l10n_util::GetNSString(
+ IDR_STOP_SHARING_BUTTON)];
[cancel_button setAction:@selector(onCancel:)];
[cancel_button setTarget:self];