summaryrefslogtreecommitdiffstats
path: root/remoting/host/disconnect_window_mac.mm
diff options
context:
space:
mode:
authoralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-31 23:08:39 +0000
committeralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-31 23:08:39 +0000
commitfc877cf756aca680933305c6cb147feecf63113e (patch)
treebdbeae4a96bd19176573960f14bbd7223cdcf869 /remoting/host/disconnect_window_mac.mm
parent5365e52c633777ee6dde1edba6258fb502ac205d (diff)
downloadchromium_src-fc877cf756aca680933305c6cb147feecf63113e.zip
chromium_src-fc877cf756aca680933305c6cb147feecf63113e.tar.gz
chromium_src-fc877cf756aca680933305c6cb147feecf63113e.tar.bz2
Localized Chromoting Host on Mac and Linux.
Re-landing r214379. Two additional fixes: - HOST_PLUGIN_MIME_TYPE is passed unquoted making the code the uses it responsible for stringizing it. - msvs_cygwin_shell is set to 0 to avoid cygpath changing "remoting_locales\nl.pak" to "remoting_ocales\nl.pak". 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. BUG=155204 Review URL: https://chromiumcodereview.appspot.com/21059003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214855 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/disconnect_window_mac.mm')
-rw-r--r--remoting/host/disconnect_window_mac.mm43
1 files changed, 17 insertions, 26 deletions
diff --git a/remoting/host/disconnect_window_mac.mm b/remoting/host/disconnect_window_mac.mm
index 56e4946..9cb170a 100644
--- a/remoting/host/disconnect_window_mac.mm
+++ b/remoting/host/disconnect_window_mac.mm
@@ -8,25 +8,27 @@
#include "base/bind.h"
#include "base/compiler_specific.h"
+#include "base/i18n/rtl.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string_util.h"
#include "base/strings/sys_string_conversions.h"
+#include "remoting/base/string_resources.h"
#include "remoting/host/client_session_control.h"
#include "remoting/host/host_window.h"
-#include "remoting/host/ui_strings.h"
+#include "ui/base/l10n/l10n_util_mac.h"
@interface DisconnectWindowController()
- (BOOL)isRToL;
- (void)Hide;
@end
-const int kMaximumConnectedNameWidthInPixels = 400;
+const int kMaximumConnectedNameWidthInPixels = 600;
namespace remoting {
class DisconnectWindowMac : public HostWindow {
public:
- explicit DisconnectWindowMac(const UiStrings& ui_strings);
+ DisconnectWindowMac();
virtual ~DisconnectWindowMac();
// HostWindow overrides.
@@ -35,17 +37,13 @@ class DisconnectWindowMac : public HostWindow {
OVERRIDE;
private:
- // Localized UI strings.
- UiStrings ui_strings_;
-
DisconnectWindowController* window_controller_;
DISALLOW_COPY_AND_ASSIGN(DisconnectWindowMac);
};
-DisconnectWindowMac::DisconnectWindowMac(const UiStrings& ui_strings)
- : ui_strings_(ui_strings),
- window_controller_(nil) {
+DisconnectWindowMac::DisconnectWindowMac()
+ : window_controller_(nil) {
}
DisconnectWindowMac::~DisconnectWindowMac() {
@@ -70,27 +68,23 @@ void DisconnectWindowMac::Start(
std::string client_jid = client_session_control->client_jid();
std::string username = client_jid.substr(0, client_jid.find('/'));
window_controller_ =
- [[DisconnectWindowController alloc] initWithUiStrings:&ui_strings_
- callback:disconnect_callback
- username:username];
+ [[DisconnectWindowController alloc] initWithCallback:disconnect_callback
+ username:username];
[window_controller_ showWindow:nil];
}
// static
-scoped_ptr<HostWindow> HostWindow::CreateDisconnectWindow(
- const UiStrings& ui_strings) {
- return scoped_ptr<HostWindow>(new DisconnectWindowMac(ui_strings));
+scoped_ptr<HostWindow> HostWindow::CreateDisconnectWindow() {
+ return scoped_ptr<HostWindow>(new DisconnectWindowMac());
}
} // namespace remoting
@implementation DisconnectWindowController
-- (id)initWithUiStrings:(const remoting::UiStrings*)ui_strings
- callback:(const base::Closure&)disconnect_callback
- username:(const std::string&)username {
+- (id)initWithCallback:(const base::Closure&)disconnect_callback
+ username:(const std::string&)username {
self = [super initWithWindowNibName:@"disconnect_window"];
if (self) {
- ui_strings_ = ui_strings;
disconnect_callback_ = disconnect_callback;
username_ = UTF8ToUTF16(username);
}
@@ -108,7 +102,7 @@ scoped_ptr<HostWindow> HostWindow::CreateDisconnectWindow(
}
- (BOOL)isRToL {
- return ui_strings_->direction == remoting::UiStrings::RTL;
+ return base::i18n::IsRTL();
}
- (void)Hide {
@@ -117,12 +111,9 @@ scoped_ptr<HostWindow> HostWindow::CreateDisconnectWindow(
}
- (void)windowDidLoad {
- string16 text = ReplaceStringPlaceholders(ui_strings_->disconnect_message,
- username_, NULL);
- [connectedToField_ setStringValue:base::SysUTF16ToNSString(text)];
-
- [disconnectButton_ setTitle:base::SysUTF16ToNSString(
- ui_strings_->disconnect_button_text)];
+ [connectedToField_ setStringValue:l10n_util::GetNSStringF(IDR_MESSAGE_SHARED,
+ username_)];
+ [disconnectButton_ setTitle:l10n_util::GetNSString(IDR_STOP_SHARING_BUTTON)];
// Resize the window dynamically based on the content.
CGFloat oldConnectedWidth = NSWidth([connectedToField_ bounds]);