summaryrefslogtreecommitdiffstats
path: root/remoting/host/disconnect_window_mac.mm
diff options
context:
space:
mode:
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]);