diff options
54 files changed, 591 insertions, 775 deletions
diff --git a/remoting/base/resources.cc b/remoting/base/resources.cc new file mode 100644 index 0000000..933be87 --- /dev/null +++ b/remoting/base/resources.cc @@ -0,0 +1,35 @@ +// Copyright (c) 2012 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. + +#include "remoting/base/resources.h" + +#include "base/files/file_path.h" +#include "base/path_service.h" +#include "ui/base/resource/resource_bundle.h" +#include "ui/base/ui_base_paths.h" + +namespace remoting { + +namespace { +const char kLocaleResourcesDirName[] = "remoting_locales"; +const char kCommonResourcesFileName[] = "chrome_remote_desktop.pak"; +} // namespace + +// Loads chromoting resources. +bool LoadResources(const std::string& pref_locale) { + base::FilePath path; + if (!PathService::Get(base::DIR_MODULE, &path)) + return false; + + PathService::Override(ui::DIR_LOCALES, + path.AppendASCII(kLocaleResourcesDirName)); + ui::ResourceBundle::InitSharedInstanceLocaleOnly(pref_locale, NULL); + + ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( + path.AppendASCII(kCommonResourcesFileName), ui::SCALE_FACTOR_100P); + + return true; +} + +} // namespace remoting diff --git a/remoting/base/resources.h b/remoting/base/resources.h index 371c533..b08eb8d 100644 --- a/remoting/base/resources.h +++ b/remoting/base/resources.h @@ -9,15 +9,11 @@ namespace remoting { -// Loads (or reloads) Chromoting resources for the given locale. |pref_locale| +// Loads chromoting resources. Returns false in case of a failure. |pref_locale| // is passed to l10n_util::GetApplicationLocale(), so the default system locale -// is used if |pref_locale| is empty. Returns |true| if the shared resource -// bundle has been initialized. +// is used if |pref_locale| is empty. bool LoadResources(const std::string& pref_locale); -// Unloads Chromoting resources. -void UnloadResources(); - } // namespace remoting #endif // REMOTING_HOST_BASE_RESOURCES_H_ diff --git a/remoting/base/resources_linux.cc b/remoting/base/resources_linux.cc deleted file mode 100644 index af530e8..0000000 --- a/remoting/base/resources_linux.cc +++ /dev/null @@ -1,44 +0,0 @@ -// 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. - -#include "remoting/base/resources.h" - -#include <dlfcn.h> - -#include "base/files/file_path.h" -#include "base/logging.h" -#include "base/path_service.h" -#include "ui/base/resource/resource_bundle.h" -#include "ui/base/ui_base_paths.h" - -namespace remoting { - -namespace { -const char kLocaleResourcesDirName[] = "remoting_locales"; -} // namespace - -bool LoadResources(const std::string& pref_locale) { - if (ui::ResourceBundle::HasSharedInstance()) { - ui::ResourceBundle::GetSharedInstance().ReloadLocaleResources(pref_locale); - } else { - // Retrive the path to the module containing this function. - Dl_info info; - CHECK(dladdr(reinterpret_cast<void*>(&LoadResources), &info) != 0); - - // Point DIR_LOCALES to 'remoting_locales'. - base::FilePath path = base::FilePath(info.dli_fname).DirName(); - PathService::Override(ui::DIR_LOCALES, - path.AppendASCII(kLocaleResourcesDirName)); - - ui::ResourceBundle::InitSharedInstanceLocaleOnly(pref_locale, NULL); - } - - return true; -} - -void UnloadResources() { - ui::ResourceBundle::CleanupSharedInstance(); -} - -} // namespace remoting diff --git a/remoting/base/resources_mac.mm b/remoting/base/resources_mac.mm deleted file mode 100644 index d1ce4af..0000000 --- a/remoting/base/resources_mac.mm +++ /dev/null @@ -1,43 +0,0 @@ -// 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 diff --git a/remoting/base/resources_unittest.cc b/remoting/base/resources_unittest.cc index b02a12b..6d69cee 100644 --- a/remoting/base/resources_unittest.cc +++ b/remoting/base/resources_unittest.cc @@ -4,46 +4,52 @@ #include "remoting/base/resources.h" +#include "remoting/base/common_resources.h" #include "remoting/base/string_resources.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/resource/resource_bundle.h" #include "testing/gtest/include/gtest/gtest.h" namespace remoting { +// TODO(sergeyu): Resources loading doesn't work yet on OSX. Fix it and enable +// the test. +#if !defined(OS_MACOSX) +#define MAYBE_ProductName ProductName +#define MAYBE_ProductLogo ProductLogo +#else // !defined(OS_MACOSX) +#define MAYBE_ProductName DISABLED_ProductName +#define MAYBE_ProductLogo DISABLED_ProductLogo +#endif // defined(OS_MACOSX) + class ResourcesTest : public testing::Test { protected: - ResourcesTest(): resources_available_(false) { - } - virtual void SetUp() OVERRIDE { - resources_available_ = LoadResources("en-US"); + ASSERT_TRUE(LoadResources("en-US")); } virtual void TearDown() OVERRIDE { - UnloadResources(); + ui::ResourceBundle::CleanupSharedInstance(); } - - bool resources_available_; }; -TEST_F(ResourcesTest, ProductName) { +TEST_F(ResourcesTest, MAYBE_ProductName) { #if defined(GOOGLE_CHROME_BUILD) std::string expected_product_name = "Chrome Remote Desktop"; #else // defined(GOOGLE_CHROME_BUILD) std::string expected_product_name = "Chromoting"; #endif // !defined(GOOGLE_CHROME_BUILD) + EXPECT_EQ(expected_product_name, + l10n_util::GetStringUTF8(IDR_PRODUCT_NAME)); +} - // Chrome-style i18n is not used on Windows. -#if defined(OS_WIN) - EXPECT_FALSE(resources_available_); -#else - EXPECT_TRUE(resources_available_); -#endif - - if (resources_available_) { - EXPECT_EQ(expected_product_name, - l10n_util::GetStringUTF8(IDR_PRODUCT_NAME)); - } +TEST_F(ResourcesTest, MAYBE_ProductLogo) { + gfx::Image logo16 = ui::ResourceBundle::GetSharedInstance().GetImageNamed( + IDR_PRODUCT_LOGO_16); + EXPECT_FALSE(logo16.IsEmpty()); + gfx::Image logo32 = ui::ResourceBundle::GetSharedInstance().GetImageNamed( + IDR_PRODUCT_LOGO_32); + EXPECT_FALSE(logo32.IsEmpty()); } } // namespace remoting diff --git a/remoting/base/resources_win.cc b/remoting/base/resources_win.cc deleted file mode 100644 index e4d9efa..0000000 --- a/remoting/base/resources_win.cc +++ /dev/null @@ -1,17 +0,0 @@ -// 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. - -#include "remoting/base/resources.h" - -namespace remoting { - -bool LoadResources(const std::string& pref_locale) { - // Do nothing since .pak files are not used on Windows. - return false; -} - -void UnloadResources() { -} - -} // namespace remoting diff --git a/remoting/branding_Chrome b/remoting/branding_Chrome index 8e6acc8..49e1e88 100644 --- a/remoting/branding_Chrome +++ b/remoting/branding_Chrome @@ -1,4 +1,6 @@ +COPYRIGHT=Copyright 2013 Google Inc. All Rights Reserved. HOST_PLUGIN_FILE_NAME=Chrome Remote Desktop Host +HOST_PLUGIN_DESCRIPTION=Allow another user to access your computer securely over the Internet. DAEMON_FILE_NAME=Chrome Remote Desktop Host Service MAC_BUNDLE_ID=com.google.Chrome MAC_CREATOR=rimZ @@ -6,4 +8,7 @@ MAC_HOST_BUNDLE_ID=com.google.chrome_remote_desktop.remoting_me2me_host MAC_UNINSTALLER_NAME=Chrome Remote Desktop Host Uninstaller MAC_UNINSTALLER_BUNDLE_PREFIX=com.google.pkg MAC_UNINSTALLER_BUNDLE_ID=com.google.chromeremotedesktop.host_uninstaller +MAC_UNINSTALLER_BUNDLE_NAME=Chrome Remote Desktop Host Uninstaller MAC_PREFPANE_BUNDLE_ID=com.google.chromeremotedesktop.preferences +MAC_PREFPANE_BUNDLE_NAME=Chrome Remote Desktop Host Preferences +MAC_PREFPANE_ICON_LABEL=Chrome Remote
Desktop Host diff --git a/remoting/branding_Chromium b/remoting/branding_Chromium index 1a6a94a..22f3621 100644 --- a/remoting/branding_Chromium +++ b/remoting/branding_Chromium @@ -1,4 +1,6 @@ +COPYRIGHT=Copyright 2013 The Chromium Authors. All Rights Reserved. HOST_PLUGIN_FILE_NAME=Chromoting Host +HOST_PLUGIN_DESCRIPTION=Allow another user to access your computer securely over the Internet. DAEMON_FILE_NAME=Chromoting Host Service MAC_BUNDLE_ID=org.chromium.Chromium MAC_CREATOR=Cr24 @@ -6,4 +8,7 @@ MAC_HOST_BUNDLE_ID=org.chromium.chromoting.remoting_me2me_host MAC_UNINSTALLER_NAME=Chromoting Host Uninstaller MAC_UNINSTALLER_BUNDLE_PREFIX=org.chromium.pkg MAC_UNINSTALLER_BUNDLE_ID=org.chromium.remoting.host_uninstaller +MAC_UNINSTALLER_BUNDLE_NAME=Chromoting Host Uninstaller MAC_PREFPANE_BUNDLE_ID=org.chromium.remoting.preferences +MAC_PREFPANE_BUNDLE_NAME=Chromoting Host Preferences +MAC_PREFPANE_ICON_LABEL=Chromoting
Host diff --git a/remoting/host/basic_desktop_environment.cc b/remoting/host/basic_desktop_environment.cc index 7698ca8..e6e2db3 100644 --- a/remoting/host/basic_desktop_environment.cc +++ b/remoting/host/basic_desktop_environment.cc @@ -66,10 +66,12 @@ BasicDesktopEnvironment::BasicDesktopEnvironment( BasicDesktopEnvironmentFactory::BasicDesktopEnvironmentFactory( scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, - scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, + const UiStrings& ui_strings) : caller_task_runner_(caller_task_runner), input_task_runner_(input_task_runner), - ui_task_runner_(ui_task_runner) { + ui_task_runner_(ui_task_runner), + ui_strings_(ui_strings) { } BasicDesktopEnvironmentFactory::~BasicDesktopEnvironmentFactory() { diff --git a/remoting/host/basic_desktop_environment.h b/remoting/host/basic_desktop_environment.h index dbc9822..10429d1 100644 --- a/remoting/host/basic_desktop_environment.h +++ b/remoting/host/basic_desktop_environment.h @@ -12,6 +12,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "remoting/host/desktop_environment.h" +#include "remoting/host/ui_strings.h" namespace remoting { @@ -32,6 +33,8 @@ class BasicDesktopEnvironment : public DesktopEnvironment { protected: friend class BasicDesktopEnvironmentFactory; + // |ui_strings| are hosted by the BasicDesktopEnvironmentFactory instance that + // created |this|. |ui_strings| must outlive this object. BasicDesktopEnvironment( scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, @@ -69,7 +72,8 @@ class BasicDesktopEnvironmentFactory : public DesktopEnvironmentFactory { BasicDesktopEnvironmentFactory( scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, - scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, + const UiStrings& ui_strings); virtual ~BasicDesktopEnvironmentFactory(); // DesktopEnvironmentFactory implementation. @@ -88,6 +92,8 @@ class BasicDesktopEnvironmentFactory : public DesktopEnvironmentFactory { return ui_task_runner_; } + const UiStrings& ui_strings() const { return ui_strings_; } + private: // Task runner on which methods of DesktopEnvironmentFactory interface should // be called. @@ -99,6 +105,9 @@ class BasicDesktopEnvironmentFactory : public DesktopEnvironmentFactory { // Used to run UI code. scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; + // Contains a copy of the localized UI strings. + const UiStrings ui_strings_; + DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironmentFactory); }; diff --git a/remoting/host/continue_window.cc b/remoting/host/continue_window.cc index 35a7f90..abea5cf 100644 --- a/remoting/host/continue_window.cc +++ b/remoting/host/continue_window.cc @@ -57,7 +57,8 @@ void ContinueWindow::DisconnectSession() { client_session_control_->DisconnectSession(); } -ContinueWindow::ContinueWindow() { +ContinueWindow::ContinueWindow(const UiStrings& ui_strings) + : ui_strings_(ui_strings) { } void ContinueWindow::OnSessionExpired() { diff --git a/remoting/host/continue_window.h b/remoting/host/continue_window.h index 4a48e16..fb5db00 100644 --- a/remoting/host/continue_window.h +++ b/remoting/host/continue_window.h @@ -9,6 +9,7 @@ #include "base/memory/weak_ptr.h" #include "base/timer/timer.h" #include "remoting/host/host_window.h" +#include "remoting/host/ui_strings.h" namespace remoting { @@ -28,12 +29,14 @@ class ContinueWindow : public HostWindow { void DisconnectSession(); protected: - ContinueWindow(); + explicit ContinueWindow(const UiStrings& ui_strings); // Shows and hides the UI. virtual void ShowUi() = 0; virtual void HideUi() = 0; + const UiStrings& ui_strings() const { return ui_strings_; } + private: // Invoked periodically to ask for the local user whether the session should // be continued. @@ -48,6 +51,9 @@ class ContinueWindow : public HostWindow { // Used to ask the local user whether the session should be continued. base::OneShotTimer<ContinueWindow> session_expired_timer_; + // Localized UI strings. + UiStrings ui_strings_; + DISALLOW_COPY_AND_ASSIGN(ContinueWindow); }; diff --git a/remoting/host/continue_window_gtk.cc b/remoting/host/continue_window_gtk.cc index 66cde62..238b509 100644 --- a/remoting/host/continue_window_gtk.cc +++ b/remoting/host/continue_window_gtk.cc @@ -7,16 +7,14 @@ #include "base/compiler_specific.h" #include "base/logging.h" #include "base/strings/utf_string_conversions.h" -#include "remoting/base/string_resources.h" #include "remoting/host/continue_window.h" #include "ui/base/gtk/gtk_signal.h" -#include "ui/base/l10n/l10n_util.h" namespace remoting { class ContinueWindowGtk : public ContinueWindow { public: - ContinueWindowGtk(); + explicit ContinueWindowGtk(const UiStrings& ui_strings); virtual ~ContinueWindowGtk(); protected: @@ -34,8 +32,9 @@ class ContinueWindowGtk : public ContinueWindow { DISALLOW_COPY_AND_ASSIGN(ContinueWindowGtk); }; -ContinueWindowGtk::ContinueWindowGtk() - : continue_window_(NULL) { +ContinueWindowGtk::ContinueWindowGtk(const UiStrings& ui_strings) + : ContinueWindow(ui_strings), + continue_window_(NULL) { } ContinueWindowGtk::~ContinueWindowGtk() { @@ -68,12 +67,12 @@ void ContinueWindowGtk::CreateWindow() { DCHECK(!continue_window_); continue_window_ = gtk_dialog_new_with_buttons( - l10n_util::GetStringUTF8(IDR_PRODUCT_NAME).c_str(), + UTF16ToUTF8(ui_strings().product_name).c_str(), NULL, static_cast<GtkDialogFlags>(GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR), - l10n_util::GetStringUTF8(IDR_STOP_SHARING_BUTTON).c_str(), + UTF16ToUTF8(ui_strings().stop_sharing_button_text).c_str(), GTK_RESPONSE_CANCEL, - l10n_util::GetStringUTF8(IDR_CONTINUE_BUTTON).c_str(), + UTF16ToUTF8(ui_strings().continue_button_text).c_str(), GTK_RESPONSE_OK, NULL); @@ -92,7 +91,7 @@ void ContinueWindowGtk::CreateWindow() { gtk_dialog_get_content_area(GTK_DIALOG(continue_window_)); GtkWidget* text_label = - gtk_label_new(l10n_util::GetStringUTF8(IDR_CONTINUE_PROMPT).c_str()); + gtk_label_new(UTF16ToUTF8(ui_strings().continue_prompt).c_str()); gtk_label_set_line_wrap(GTK_LABEL(text_label), TRUE); // TODO(lambroslambrou): Fix magic numbers, as in disconnect_window_gtk.cc. gtk_misc_set_padding(GTK_MISC(text_label), 12, 12); @@ -114,8 +113,9 @@ void ContinueWindowGtk::OnResponse(GtkWidget* dialog, int response_id) { } // static -scoped_ptr<HostWindow> HostWindow::CreateContinueWindow() { - return scoped_ptr<HostWindow>(new ContinueWindowGtk()); +scoped_ptr<HostWindow> HostWindow::CreateContinueWindow( + const UiStrings& ui_strings) { + return scoped_ptr<HostWindow>(new ContinueWindowGtk(ui_strings)); } } // namespace remoting diff --git a/remoting/host/continue_window_mac.mm b/remoting/host/continue_window_mac.mm index 6c24dee..5ab2bdb 100644 --- a/remoting/host/continue_window_mac.mm +++ b/remoting/host/continue_window_mac.mm @@ -9,9 +9,7 @@ #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 { @@ -19,9 +17,11 @@ base::scoped_nsobject<NSMutableArray> shades_; base::scoped_nsobject<NSAlert> continue_alert_; remoting::ContinueWindow* continue_window_; + const remoting::UiStrings* ui_strings_; } -- (id)initWithWindow:(remoting::ContinueWindow*)continue_window; +- (id)initWithUiStrings:(const remoting::UiStrings*)ui_strings + continue_window:(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: - ContinueWindowMac(); + explicit ContinueWindowMac(const UiStrings& ui_strings); virtual ~ContinueWindowMac(); protected: @@ -48,7 +48,8 @@ class ContinueWindowMac : public ContinueWindow { DISALLOW_COPY_AND_ASSIGN(ContinueWindowMac); }; -ContinueWindowMac::ContinueWindowMac() { +ContinueWindowMac::ContinueWindowMac(const UiStrings& ui_strings) + : ContinueWindow(ui_strings) { } ContinueWindowMac::~ContinueWindowMac() { @@ -60,7 +61,8 @@ void ContinueWindowMac::ShowUi() { base::mac::ScopedNSAutoreleasePool pool; controller_.reset( - [[ContinueWindowMacController alloc] initWithWindow:this]); + [[ContinueWindowMacController alloc] initWithUiStrings:&ui_strings() + continue_window:this]); [controller_ show]; } @@ -72,17 +74,20 @@ void ContinueWindowMac::HideUi() { } // static -scoped_ptr<HostWindow> HostWindow::CreateContinueWindow() { - return scoped_ptr<HostWindow>(new ContinueWindowMac()); +scoped_ptr<HostWindow> HostWindow::CreateContinueWindow( + const UiStrings& ui_strings) { + return scoped_ptr<HostWindow>(new ContinueWindowMac(ui_strings)); } } // namespace remoting @implementation ContinueWindowMacController -- (id)initWithWindow:(remoting::ContinueWindow*)continue_window { +- (id)initWithUiStrings:(const remoting::UiStrings*)ui_strings + continue_window:(remoting::ContinueWindow*)continue_window { if ((self = [super init])) { continue_window_ = continue_window; + ui_strings_ = ui_strings; } return self; } @@ -111,18 +116,21 @@ 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:l10n_util::GetNSString(IDR_CONTINUE_PROMPT)]; + [continue_alert_ setMessageText:message]; NSButton* continue_button = - [continue_alert_ addButtonWithTitle:l10n_util::GetNSString( - IDR_CONTINUE_BUTTON)]; + [continue_alert_ addButtonWithTitle:continue_button_string]; [continue_button setAction:@selector(onContinue:)]; [continue_button setTarget:self]; NSButton* cancel_button = - [continue_alert_ addButtonWithTitle:l10n_util::GetNSString( - IDR_STOP_SHARING_BUTTON)]; + [continue_alert_ addButtonWithTitle:cancel_button_string]; [cancel_button setAction:@selector(onCancel:)]; [cancel_button setTarget:self]; diff --git a/remoting/host/continue_window_win.cc b/remoting/host/continue_window_win.cc index 1b06fd0..0dcf907f0 100644 --- a/remoting/host/continue_window_win.cc +++ b/remoting/host/continue_window_win.cc @@ -21,7 +21,7 @@ namespace { class ContinueWindowWin : public ContinueWindow { public: - ContinueWindowWin(); + explicit ContinueWindowWin(const UiStrings& ui_strings); virtual ~ContinueWindowWin(); protected: @@ -42,8 +42,9 @@ class ContinueWindowWin : public ContinueWindow { DISALLOW_COPY_AND_ASSIGN(ContinueWindowWin); }; -ContinueWindowWin::ContinueWindowWin() - : hwnd_(NULL) { +ContinueWindowWin::ContinueWindowWin(const UiStrings& ui_strings) + : ContinueWindow(ui_strings), + hwnd_(NULL) { } ContinueWindowWin::~ContinueWindowWin() { @@ -128,8 +129,9 @@ void ContinueWindowWin::EndDialog() { } // namespace // static -scoped_ptr<HostWindow> HostWindow::CreateContinueWindow() { - return scoped_ptr<HostWindow>(new ContinueWindowWin()); +scoped_ptr<HostWindow> HostWindow::CreateContinueWindow( + const UiStrings& ui_strings) { + return scoped_ptr<HostWindow>(new ContinueWindowWin(ui_strings)); } } // namespace remoting diff --git a/remoting/host/desktop_process_main.cc b/remoting/host/desktop_process_main.cc index 294413c..c259e58 100644 --- a/remoting/host/desktop_process_main.cc +++ b/remoting/host/desktop_process_main.cc @@ -18,6 +18,7 @@ #include "remoting/host/host_main.h" #include "remoting/host/ipc_constants.h" #include "remoting/host/me2me_desktop_environment.h" +#include "remoting/host/ui_strings.h" #include "remoting/host/win/session_desktop_environment.h" namespace remoting { @@ -45,6 +46,9 @@ int DesktopProcessMain() { input_task_runner, channel_name); + // TODO(alexeypa): Localize the UI strings. See http://crbug.com/155204. + UiStrings ui_string; + // Create a platform-dependent environment factory. scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory; #if defined(OS_WIN) @@ -53,13 +57,15 @@ int DesktopProcessMain() { ui_task_runner, input_task_runner, ui_task_runner, + ui_string, base::Bind(&DesktopProcess::InjectSas, desktop_process.AsWeakPtr()))); #else // !defined(OS_WIN) desktop_environment_factory.reset(new Me2MeDesktopEnvironmentFactory( ui_task_runner, input_task_runner, - ui_task_runner)); + ui_task_runner, + ui_string)); #endif // !defined(OS_WIN) if (!desktop_process.Start(desktop_environment_factory.Pass())) diff --git a/remoting/host/disconnect_window_gtk.cc b/remoting/host/disconnect_window_gtk.cc index 06d417a..f5dacf2 100644 --- a/remoting/host/disconnect_window_gtk.cc +++ b/remoting/host/disconnect_window_gtk.cc @@ -9,11 +9,10 @@ #include "base/logging.h" #include "base/strings/string_util.h" #include "base/strings/utf_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/gtk/gtk_signal.h" -#include "ui/base/l10n/l10n_util.h" namespace remoting { @@ -21,7 +20,7 @@ namespace { class DisconnectWindowGtk : public HostWindow { public: - DisconnectWindowGtk(); + explicit DisconnectWindowGtk(const UiStrings& ui_strings); virtual ~DisconnectWindowGtk(); // HostWindow overrides. @@ -40,6 +39,9 @@ class DisconnectWindowGtk : public HostWindow { // Used to disconnect the client session. base::WeakPtr<ClientSessionControl> client_session_control_; + // Localized UI strings. + UiStrings ui_strings_; + GtkWidget* disconnect_window_; GtkWidget* message_; GtkWidget* button_; @@ -65,8 +67,9 @@ void AddRoundRectPath(cairo_t* cairo_context, int width, int height, cairo_close_path(cairo_context); } -DisconnectWindowGtk::DisconnectWindowGtk() - : disconnect_window_(NULL), +DisconnectWindowGtk::DisconnectWindowGtk(const UiStrings& ui_strings) + : ui_strings_(ui_strings), + disconnect_window_(NULL), current_width_(0), current_height_(0) { } @@ -95,8 +98,7 @@ void DisconnectWindowGtk::Start( g_signal_connect(disconnect_window_, "delete-event", G_CALLBACK(OnDeleteThunk), this); - gtk_window_set_title(window, - l10n_util::GetStringUTF8(IDR_PRODUCT_NAME).c_str()); + gtk_window_set_title(window, UTF16ToUTF8(ui_strings_.product_name).c_str()); gtk_window_set_resizable(window, FALSE); // Try to keep the window always visible. @@ -140,7 +142,7 @@ void DisconnectWindowGtk::Start( gtk_container_add(GTK_CONTAINER(align), button_row); button_ = gtk_button_new_with_label( - l10n_util::GetStringUTF8(IDR_STOP_SHARING_BUTTON).c_str()); + UTF16ToUTF8(ui_strings_.disconnect_button_text).c_str()); gtk_box_pack_end(GTK_BOX(button_row), button_, FALSE, FALSE, 0); g_signal_connect(button_, "clicked", G_CALLBACK(OnClickedThunk), this); @@ -161,9 +163,9 @@ void DisconnectWindowGtk::Start( // Extract the user name from the JID. std::string client_jid = client_session_control_->client_jid(); string16 username = UTF8ToUTF16(client_jid.substr(0, client_jid.find('/'))); - gtk_label_set_text( - GTK_LABEL(message_), - l10n_util::GetStringFUTF8(IDR_MESSAGE_SHARED, username).c_str()); + string16 text = + ReplaceStringPlaceholders(ui_strings_.disconnect_message, username, NULL); + gtk_label_set_text(GTK_LABEL(message_), UTF16ToUTF8(text).c_str()); gtk_window_present(window); } @@ -286,8 +288,9 @@ gboolean DisconnectWindowGtk::OnButtonPress(GtkWidget* widget, } // namespace // static -scoped_ptr<HostWindow> HostWindow::CreateDisconnectWindow() { - return scoped_ptr<HostWindow>(new DisconnectWindowGtk()); +scoped_ptr<HostWindow> HostWindow::CreateDisconnectWindow( + const UiStrings& ui_strings) { + return scoped_ptr<HostWindow>(new DisconnectWindowGtk(ui_strings)); } } // namespace remoting diff --git a/remoting/host/disconnect_window_mac.h b/remoting/host/disconnect_window_mac.h index 692a23d..6eedb16 100644 --- a/remoting/host/disconnect_window_mac.h +++ b/remoting/host/disconnect_window_mac.h @@ -10,18 +10,24 @@ #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" +namespace remoting { +struct UiStrings; +} + // Controller for the disconnect window which allows the host user to // quickly disconnect a session. @interface DisconnectWindowController : NSWindowController { @private + const remoting::UiStrings* ui_strings_; base::Closure disconnect_callback_; string16 username_; IBOutlet NSTextField* connectedToField_; IBOutlet NSButton* disconnectButton_; } -- (id)initWithCallback:(const base::Closure&)disconnect_callback - username:(const std::string&)username; +- (id)initWithUiStrings:(const remoting::UiStrings*)ui_strings + callback:(const base::Closure&)disconnect_callback + username:(const std::string&)username; - (IBAction)stopSharing:(id)sender; @end diff --git a/remoting/host/disconnect_window_mac.mm b/remoting/host/disconnect_window_mac.mm index 9cb170a..56e4946 100644 --- a/remoting/host/disconnect_window_mac.mm +++ b/remoting/host/disconnect_window_mac.mm @@ -8,27 +8,25 @@ #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 "ui/base/l10n/l10n_util_mac.h" +#include "remoting/host/ui_strings.h" @interface DisconnectWindowController() - (BOOL)isRToL; - (void)Hide; @end -const int kMaximumConnectedNameWidthInPixels = 600; +const int kMaximumConnectedNameWidthInPixels = 400; namespace remoting { class DisconnectWindowMac : public HostWindow { public: - DisconnectWindowMac(); + explicit DisconnectWindowMac(const UiStrings& ui_strings); virtual ~DisconnectWindowMac(); // HostWindow overrides. @@ -37,13 +35,17 @@ class DisconnectWindowMac : public HostWindow { OVERRIDE; private: + // Localized UI strings. + UiStrings ui_strings_; + DisconnectWindowController* window_controller_; DISALLOW_COPY_AND_ASSIGN(DisconnectWindowMac); }; -DisconnectWindowMac::DisconnectWindowMac() - : window_controller_(nil) { +DisconnectWindowMac::DisconnectWindowMac(const UiStrings& ui_strings) + : ui_strings_(ui_strings), + window_controller_(nil) { } DisconnectWindowMac::~DisconnectWindowMac() { @@ -68,23 +70,27 @@ 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] initWithCallback:disconnect_callback - username:username]; + [[DisconnectWindowController alloc] initWithUiStrings:&ui_strings_ + callback:disconnect_callback + username:username]; [window_controller_ showWindow:nil]; } // static -scoped_ptr<HostWindow> HostWindow::CreateDisconnectWindow() { - return scoped_ptr<HostWindow>(new DisconnectWindowMac()); +scoped_ptr<HostWindow> HostWindow::CreateDisconnectWindow( + const UiStrings& ui_strings) { + return scoped_ptr<HostWindow>(new DisconnectWindowMac(ui_strings)); } } // namespace remoting @implementation DisconnectWindowController -- (id)initWithCallback:(const base::Closure&)disconnect_callback - username:(const std::string&)username { +- (id)initWithUiStrings:(const remoting::UiStrings*)ui_strings + callback:(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); } @@ -102,7 +108,7 @@ scoped_ptr<HostWindow> HostWindow::CreateDisconnectWindow() { } - (BOOL)isRToL { - return base::i18n::IsRTL(); + return ui_strings_->direction == remoting::UiStrings::RTL; } - (void)Hide { @@ -111,9 +117,12 @@ scoped_ptr<HostWindow> HostWindow::CreateDisconnectWindow() { } - (void)windowDidLoad { - [connectedToField_ setStringValue:l10n_util::GetNSStringF(IDR_MESSAGE_SHARED, - username_)]; - [disconnectButton_ setTitle:l10n_util::GetNSString(IDR_STOP_SHARING_BUTTON)]; + string16 text = ReplaceStringPlaceholders(ui_strings_->disconnect_message, + username_, NULL); + [connectedToField_ setStringValue:base::SysUTF16ToNSString(text)]; + + [disconnectButton_ setTitle:base::SysUTF16ToNSString( + ui_strings_->disconnect_button_text)]; // Resize the window dynamically based on the content. CGFloat oldConnectedWidth = NSWidth([connectedToField_ bounds]); diff --git a/remoting/host/disconnect_window_win.cc b/remoting/host/disconnect_window_win.cc index 2a8174d..f8845ca 100644 --- a/remoting/host/disconnect_window_win.cc +++ b/remoting/host/disconnect_window_win.cc @@ -14,6 +14,7 @@ #include "base/win/scoped_select_object.h" #include "remoting/host/client_session_control.h" #include "remoting/host/host_window.h" +#include "remoting/host/ui_strings.h" #include "remoting/host/win/core_resource.h" namespace remoting { @@ -34,7 +35,7 @@ const int kWindowTextMargin = 8; class DisconnectWindowWin : public HostWindow { public: - DisconnectWindowWin(); + explicit DisconnectWindowWin(const UiStrings& ui_strings); virtual ~DisconnectWindowWin(); // HostWindow overrides. @@ -67,6 +68,9 @@ class DisconnectWindowWin : public HostWindow { // Used to disconnect the client session. base::WeakPtr<ClientSessionControl> client_session_control_; + // Localized UI strings. + UiStrings ui_strings_; + // Specifies the remote user name. std::string username_; @@ -103,8 +107,9 @@ bool GetControlTextWidth(HWND control, const string16& text, LONG* width) { return true; } -DisconnectWindowWin::DisconnectWindowWin() - : hwnd_(NULL), +DisconnectWindowWin::DisconnectWindowWin(const UiStrings& ui_strings) + : ui_strings_(ui_strings), + hwnd_(NULL), has_hotkey_(false), border_pen_(CreatePen(PS_SOLID, 5, RGB(0.13 * 255, 0.69 * 255, 0.11 * 255))) { @@ -226,9 +231,38 @@ bool DisconnectWindowWin::BeginDialog() { DCHECK(CalledOnValidThread()); DCHECK(!hwnd_); + // Load the dialog resource so that we can modify the RTL flags if necessary. HMODULE module = base::GetModuleFromAddress(&DialogProc); - hwnd_ = CreateDialogParam(module, MAKEINTRESOURCE(IDD_DISCONNECT), NULL, - DialogProc, reinterpret_cast<LPARAM>(this)); + HRSRC dialog_resource = + FindResource(module, MAKEINTRESOURCE(IDD_DISCONNECT), RT_DIALOG); + if (!dialog_resource) + return false; + + HGLOBAL dialog_template = LoadResource(module, dialog_resource); + if (!dialog_template) + return false; + + DLGTEMPLATE* dialog_pointer = + reinterpret_cast<DLGTEMPLATE*>(LockResource(dialog_template)); + if (!dialog_pointer) + return false; + + // The actual resource type is DLGTEMPLATEEX, but this is not defined in any + // standard headers, so we treat it as a generic pointer and manipulate the + // correct offsets explicitly. + scoped_ptr<unsigned char[]> rtl_dialog_template; + if (ui_strings_.direction == UiStrings::RTL) { + unsigned long dialog_template_size = + SizeofResource(module, dialog_resource); + rtl_dialog_template.reset(new unsigned char[dialog_template_size]); + memcpy(rtl_dialog_template.get(), dialog_pointer, dialog_template_size); + DWORD* rtl_dwords = reinterpret_cast<DWORD*>(rtl_dialog_template.get()); + rtl_dwords[2] |= (WS_EX_LAYOUTRTL | WS_EX_RTLREADING); + dialog_pointer = reinterpret_cast<DLGTEMPLATE*>(rtl_dwords); + } + + hwnd_ = CreateDialogIndirectParam(module, dialog_pointer, NULL, + DialogProc, reinterpret_cast<LPARAM>(this)); if (!hwnd_) return false; @@ -390,8 +424,9 @@ bool DisconnectWindowWin::SetStrings() { } // namespace // static -scoped_ptr<HostWindow> HostWindow::CreateDisconnectWindow() { - return scoped_ptr<HostWindow>(new DisconnectWindowWin()); +scoped_ptr<HostWindow> HostWindow::CreateDisconnectWindow( + const UiStrings& ui_strings) { + return scoped_ptr<HostWindow>(new DisconnectWindowWin(ui_strings)); } } // namespace remoting diff --git a/remoting/host/host_main.cc b/remoting/host/host_main.cc index ffff5bf..7f00000 100644 --- a/remoting/host/host_main.cc +++ b/remoting/host/host_main.cc @@ -17,7 +17,6 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "remoting/base/breakpad.h" -#include "remoting/base/resources.h" #include "remoting/host/host_exit_codes.h" #include "remoting/host/logging.h" #include "remoting/host/usage_stats_consent.h" @@ -233,16 +232,11 @@ int HostMain(int argc, char** argv) { return kUsageExitCode; } - remoting::LoadResources(""); - // Invoke the entry point. int exit_code = main_routine(); if (exit_code == kUsageExitCode) { Usage(command_line->GetProgram()); } - - remoting::UnloadResources(); - return exit_code; } diff --git a/remoting/host/host_window.h b/remoting/host/host_window.h index d193686..243f9ba 100644 --- a/remoting/host/host_window.h +++ b/remoting/host/host_window.h @@ -14,16 +14,19 @@ namespace remoting { class ClientSessionControl; +struct UiStrings; class HostWindow : public base::NonThreadSafe { public: virtual ~HostWindow() {} // Creates a platform-specific instance of the continue window. - static scoped_ptr<HostWindow> CreateContinueWindow(); + static scoped_ptr<HostWindow> CreateContinueWindow( + const UiStrings& ui_strings); // Creates a platform-specific instance of the disconnect window. - static scoped_ptr<HostWindow> CreateDisconnectWindow(); + static scoped_ptr<HostWindow> CreateDisconnectWindow( + const UiStrings& ui_strings); // Starts the UI state machine. |client_session_control| will be used to // notify the caller about the local user's actions. diff --git a/remoting/host/installer/mac/uninstaller/remoting_uninstaller-Info.plist b/remoting/host/installer/mac/uninstaller/remoting_uninstaller-Info.plist index 87a4e82..beef6ef 100644 --- a/remoting/host/installer/mac/uninstaller/remoting_uninstaller-Info.plist +++ b/remoting/host/installer/mac/uninstaller/remoting_uninstaller-Info.plist @@ -12,6 +12,8 @@ <string>BUNDLE_ID</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> + <key>CFBundleName</key> + <string>BUNDLE_NAME</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> @@ -22,6 +24,8 @@ <string>VERSION_FULL</string> <key>LSMinimumSystemVersion</key> <string>${MACOSX_DEPLOYMENT_TARGET}.0</string> + <key>NSHumanReadableCopyright</key> + <string>COPYRIGHT_INFO</string> <key>NSMainNibFile</key> <string>remoting_uninstaller</string> <key>NSPrincipalClass</key> diff --git a/remoting/host/installer/mac/uninstaller/remoting_uninstaller-InfoPlist.strings.jinja2 b/remoting/host/installer/mac/uninstaller/remoting_uninstaller-InfoPlist.strings.jinja2 deleted file mode 100644 index 4cdeca8..0000000 --- a/remoting/host/installer/mac/uninstaller/remoting_uninstaller-InfoPlist.strings.jinja2 +++ /dev/null @@ -1,2 +0,0 @@ -CFBundleName = "{% trans %}MAC_UNINSTALLER_BUNDLE_NAME{% endtrans %}"; -NSHumanReadableCopyright = "{% trans %}COPYRIGHT{% endtrans %}"; diff --git a/remoting/host/it2me_desktop_environment.cc b/remoting/host/it2me_desktop_environment.cc index 68aa57d..6a289c9 100644 --- a/remoting/host/it2me_desktop_environment.cc +++ b/remoting/host/it2me_desktop_environment.cc @@ -26,7 +26,8 @@ It2MeDesktopEnvironment::It2MeDesktopEnvironment( scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, - base::WeakPtr<ClientSessionControl> client_session_control) + base::WeakPtr<ClientSessionControl> client_session_control, + const UiStrings& ui_strings) : BasicDesktopEnvironment(caller_task_runner, input_task_runner, ui_task_runner) { @@ -53,14 +54,14 @@ It2MeDesktopEnvironment::It2MeDesktopEnvironment( // Create the continue and disconnect windows. if (want_user_interface) { - continue_window_ = HostWindow::CreateContinueWindow(); + continue_window_ = HostWindow::CreateContinueWindow(ui_strings); continue_window_.reset(new HostWindowProxy( caller_task_runner, ui_task_runner, continue_window_.Pass())); continue_window_->Start(client_session_control); - disconnect_window_ = HostWindow::CreateDisconnectWindow(); + disconnect_window_ = HostWindow::CreateDisconnectWindow(ui_strings); disconnect_window_.reset(new HostWindowProxy( caller_task_runner, ui_task_runner, @@ -72,10 +73,12 @@ It2MeDesktopEnvironment::It2MeDesktopEnvironment( It2MeDesktopEnvironmentFactory::It2MeDesktopEnvironmentFactory( scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, - scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, + const UiStrings& ui_strings) : BasicDesktopEnvironmentFactory(caller_task_runner, input_task_runner, - ui_task_runner) { + ui_task_runner, + ui_strings) { } It2MeDesktopEnvironmentFactory::~It2MeDesktopEnvironmentFactory() { @@ -89,7 +92,8 @@ scoped_ptr<DesktopEnvironment> It2MeDesktopEnvironmentFactory::Create( new It2MeDesktopEnvironment(caller_task_runner(), input_task_runner(), ui_task_runner(), - client_session_control)); + client_session_control, + ui_strings())); } } // namespace remoting diff --git a/remoting/host/it2me_desktop_environment.h b/remoting/host/it2me_desktop_environment.h index 368a6ab..99e6af7 100644 --- a/remoting/host/it2me_desktop_environment.h +++ b/remoting/host/it2me_desktop_environment.h @@ -26,7 +26,8 @@ class It2MeDesktopEnvironment : public BasicDesktopEnvironment { scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, - base::WeakPtr<ClientSessionControl> client_session_control); + base::WeakPtr<ClientSessionControl> client_session_control, + const UiStrings& ui_strings); private: // Presents the continue window to the local user. @@ -47,7 +48,8 @@ class It2MeDesktopEnvironmentFactory : public BasicDesktopEnvironmentFactory { It2MeDesktopEnvironmentFactory( scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, - scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, + const UiStrings& ui_strings); virtual ~It2MeDesktopEnvironmentFactory(); // DesktopEnvironmentFactory interface. diff --git a/remoting/host/mac/me2me_preference_pane-Info.plist b/remoting/host/mac/me2me_preference_pane-Info.plist index 001968e..1fab228 100644 --- a/remoting/host/mac/me2me_preference_pane-Info.plist +++ b/remoting/host/mac/me2me_preference_pane-Info.plist @@ -12,6 +12,8 @@ <string>BUNDLE_ID</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> + <key>CFBundleName</key> + <string>BUNDLE_NAME</string> <key>CFBundlePackageType</key> <string>BNDL</string> <key>CFBundleShortVersionString</key> @@ -20,10 +22,14 @@ <string>????</string> <key>CFBundleVersion</key> <string>VERSION_FULL</string> + <key>NSHumanReadableCopyright</key> + <string>COPYRIGHT_INFO</string> <key>NSMainNibFile</key> <string>me2me_preference_pane</string> <key>NSPrefPaneIconFile</key> <string>chromoting128.png</string> + <key>NSPrefPaneIconLabel</key> + <string>PREF_PANE_ICON_LABEL</string> <key>NSPrincipalClass</key> <string>Me2MePreferencePane</string> </dict> diff --git a/remoting/host/mac/me2me_preference_pane-InfoPlist.strings.jinja2 b/remoting/host/mac/me2me_preference_pane-InfoPlist.strings.jinja2 deleted file mode 100644 index c0a7df6..0000000 --- a/remoting/host/mac/me2me_preference_pane-InfoPlist.strings.jinja2 +++ /dev/null @@ -1,3 +0,0 @@ -CFBundleName = "{% trans %}MAC_PREFPANE_BUNDLE_NAME{% endtrans %}"; -NSHumanReadableCopyright = "{% trans %}COPYRIGHT{% endtrans %}"; -NSPrefPaneIconLabel = "{% trans %}MAC_PREFPANE_ICON_LABEL{% endtrans %}"; diff --git a/remoting/host/me2me_desktop_environment.cc b/remoting/host/me2me_desktop_environment.cc index edc5b87..71dc6b7 100644 --- a/remoting/host/me2me_desktop_environment.cc +++ b/remoting/host/me2me_desktop_environment.cc @@ -65,6 +65,7 @@ Me2MeDesktopEnvironment::Me2MeDesktopEnvironment( bool Me2MeDesktopEnvironment::InitializeSecurity( base::WeakPtr<ClientSessionControl> client_session_control, + const UiStrings& ui_strings, bool curtain_enabled) { DCHECK(caller_task_runner()->BelongsToCurrentThread()); @@ -105,7 +106,7 @@ bool Me2MeDesktopEnvironment::InitializeSecurity( ui_task_runner(), client_session_control); - disconnect_window_ = HostWindow::CreateDisconnectWindow(); + disconnect_window_ = HostWindow::CreateDisconnectWindow(ui_strings); disconnect_window_.reset(new HostWindowProxy( caller_task_runner(), ui_task_runner(), @@ -119,10 +120,12 @@ bool Me2MeDesktopEnvironment::InitializeSecurity( Me2MeDesktopEnvironmentFactory::Me2MeDesktopEnvironmentFactory( scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, - scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, + const UiStrings& ui_strings) : BasicDesktopEnvironmentFactory(caller_task_runner, input_task_runner, - ui_task_runner), + ui_task_runner, + ui_strings), curtain_enabled_(false) { } @@ -138,6 +141,7 @@ scoped_ptr<DesktopEnvironment> Me2MeDesktopEnvironmentFactory::Create( input_task_runner(), ui_task_runner())); if (!desktop_environment->InitializeSecurity(client_session_control, + ui_strings(), curtain_enabled_)) { return scoped_ptr<DesktopEnvironment>(); } diff --git a/remoting/host/me2me_desktop_environment.h b/remoting/host/me2me_desktop_environment.h index f028664..f981a89 100644 --- a/remoting/host/me2me_desktop_environment.h +++ b/remoting/host/me2me_desktop_environment.h @@ -35,6 +35,7 @@ class Me2MeDesktopEnvironment : public BasicDesktopEnvironment { // and in-session UI). bool InitializeSecurity( base::WeakPtr<ClientSessionControl> client_session_control, + const UiStrings& ui_strings, bool curtain_enabled); private: @@ -57,7 +58,8 @@ class Me2MeDesktopEnvironmentFactory : public BasicDesktopEnvironmentFactory { Me2MeDesktopEnvironmentFactory( scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, - scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, + const UiStrings& ui_strings); virtual ~Me2MeDesktopEnvironmentFactory(); // DesktopEnvironmentFactory interface. diff --git a/remoting/host/plugin/constants.h b/remoting/host/plugin/constants.h new file mode 100644 index 0000000..780a2c9 --- /dev/null +++ b/remoting/host/plugin/constants.h @@ -0,0 +1,25 @@ +// Copyright (c) 2012 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. + +#ifndef REMOTING_HOST_PLUGIN_CONSTANTS_H_ +#define REMOTING_HOST_PLUGIN_CONSTANTS_H_ + +// Warning: If you modify any macro in this file, make sure to modify +// the following files too: +// - remoting/branding_Chrome +// - remoting/branding_Chromium +// - remoting/remoting.gyp +// - remoting/host/plugin/host_plugin.ver + +#define HOST_PLUGIN_DESCRIPTION \ + "Allow another user to access your computer securely over the Internet." +#define HOST_PLUGIN_MIME_TYPE "application/vnd.chromium.remoting-host" + +#if defined(GOOGLE_CHROME_BUILD) +#define HOST_PLUGIN_NAME "Chrome Remote Desktop Host" +#else +#define HOST_PLUGIN_NAME "Chromoting Host" +#endif // defined(GOOGLE_CHROME_BUILD) + +#endif // REMOTING_HOST_PLUGIN_CONSTANTS_H_ diff --git a/remoting/host/plugin/host_plugin-Info.plist b/remoting/host/plugin/host_plugin-Info.plist index a2ff900..42cecdd 100644 --- a/remoting/host/plugin/host_plugin-Info.plist +++ b/remoting/host/plugin/host_plugin-Info.plist @@ -13,17 +13,21 @@ <key>CFBundlePackageType</key> <string>BRPL</string> <key>CFBundleShortVersionString</key> - <string>VERSION_SHORT</string> + <string>1.0.0.0</string> <key>CFBundleVersion</key> - <string>VERSION_FULL</string> + <string>1.0.0.0</string> <key>CFBundleSignature</key> <string>${CHROMIUM_CREATOR}</string> <key>LSMinimumSystemVersion</key> <string>10.5.0</string> + <key>WebPluginName</key> + <string>HOST_PLUGIN_NAME</string> <key>WebPluginMIMETypes</key> <dict> <key>HOST_PLUGIN_MIME_TYPE</key> <dict/> </dict> + <key>WebPluginDescription</key> + <string>HOST_PLUGIN_DESCRIPTION</string> </dict> </plist> diff --git a/remoting/host/plugin/host_plugin-InfoPlist.strings.jinja2 b/remoting/host/plugin/host_plugin-InfoPlist.strings.jinja2 deleted file mode 100644 index 4bec263..0000000 --- a/remoting/host/plugin/host_plugin-InfoPlist.strings.jinja2 +++ /dev/null @@ -1,3 +0,0 @@ -NSHumanReadableCopyright = "{% trans %}COPYRIGHT{% endtrans %}"; -WebPluginDescription = "{% trans %}REMOTING_HOST_PLUGIN_NAME{% endtrans %}"; -WebPluginName = "{% trans %}REMOTING_HOST_PLUGIN_DESCRIPTION{% endtrans %}"; diff --git a/remoting/host/plugin/host_plugin.cc b/remoting/host/plugin/host_plugin.cc index a0a98549..80d7cce 100644 --- a/remoting/host/plugin/host_plugin.cc +++ b/remoting/host/plugin/host_plugin.cc @@ -15,8 +15,7 @@ #include "base/strings/stringize_macros.h" #include "net/socket/ssl_server_socket.h" #include "remoting/base/plugin_thread_task_runner.h" -#include "remoting/base/resources.h" -#include "remoting/base/string_resources.h" +#include "remoting/host/plugin/constants.h" #include "remoting/host/plugin/host_log_handler.h" #include "remoting/host/plugin/host_plugin_utils.h" #include "remoting/host/plugin/host_script_object.h" @@ -26,7 +25,6 @@ #include "third_party/npapi/bindings/npapi.h" #include "third_party/npapi/bindings/npfunctions.h" #include "third_party/npapi/bindings/npruntime.h" -#include "ui/base/l10n/l10n_util.h" // Symbol export is handled with a separate def file on Windows. #if defined (__GNUC__) && __GNUC__ >= 4 @@ -58,14 +56,8 @@ using remoting::StringFromNPIdentifier; namespace { -bool g_initialized = false; - base::AtExitManager* g_at_exit_manager = NULL; -// The plugin name and description returned by GetValue(). -std::string* g_ui_name = NULL; -std::string* g_ui_description = NULL; - // NPAPI plugin implementation for remoting host. // Documentation for most of the calls in this class can be found here: // https://developer.mozilla.org/en/Gecko_Plugin_API_Reference/Scripting_plugins @@ -363,36 +355,6 @@ class HostNPPlugin : public remoting::PluginThreadTaskRunner::Delegate { base::Lock timers_lock_; }; -void InitializePlugin() { - if (g_initialized) - return; - - g_initialized = true; - g_at_exit_manager = new base::AtExitManager; - - // Init an empty command line for common objects that use it. - CommandLine::Init(0, NULL); - - if (remoting::LoadResources("")) { - g_ui_name = new std::string( - l10n_util::GetStringUTF8(IDR_REMOTING_HOST_PLUGIN_NAME)); - g_ui_description = new std::string( - l10n_util::GetStringUTF8(IDR_REMOTING_HOST_PLUGIN_DESCRIPTION)); - } else { - g_ui_name = new std::string(); - g_ui_description = new std::string(); - } -} - -void ShutdownPlugin() { - delete g_ui_name; - delete g_ui_description; - - remoting::UnloadResources(); - - delete g_at_exit_manager; -} - // Utility functions to map NPAPI Entry Points to C++ Objects. HostNPPlugin* PluginFromInstance(NPP instance) { return reinterpret_cast<HostNPPlugin*>(instance->pdata); @@ -446,20 +408,17 @@ NPError DestroyPlugin(NPP instance, } NPError GetValue(NPP instance, NPPVariable variable, void* value) { - // NP_GetValue() can be called before NP_Initialize(). - InitializePlugin(); - switch(variable) { default: VLOG(2) << "GetValue - default " << variable; return NPERR_GENERIC_ERROR; case NPPVpluginNameString: VLOG(2) << "GetValue - name string"; - *reinterpret_cast<const char**>(value) = g_ui_name->c_str(); + *reinterpret_cast<const char**>(value) = HOST_PLUGIN_NAME; break; case NPPVpluginDescriptionString: VLOG(2) << "GetValue - description string"; - *reinterpret_cast<const char**>(value) = g_ui_description->c_str(); + *reinterpret_cast<const char**>(value) = HOST_PLUGIN_DESCRIPTION; break; case NPPVpluginNeedsXEmbed: VLOG(2) << "GetValue - NeedsXEmbed"; @@ -531,7 +490,8 @@ EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* npnetscape_funcs #endif ) { VLOG(2) << "NP_Initialize"; - InitializePlugin(); + if (g_at_exit_manager) + return NPERR_MODULE_LOAD_FAILED_ERROR; if(npnetscape_funcs == NULL) return NPERR_INVALID_FUNCTABLE_ERROR; @@ -539,10 +499,13 @@ EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* npnetscape_funcs if(((npnetscape_funcs->version & 0xff00) >> 8) > NP_VERSION_MAJOR) return NPERR_INCOMPATIBLE_VERSION_ERROR; + g_at_exit_manager = new base::AtExitManager; g_npnetscape_funcs = npnetscape_funcs; #if defined(OS_POSIX) && !defined(OS_MACOSX) NP_GetEntryPoints(nppfuncs); #endif + // Init an empty command line for common objects that use it. + CommandLine::Init(0, NULL); #if defined(OS_WIN) ui::EnableHighDPISupport(); @@ -553,8 +516,8 @@ EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* npnetscape_funcs EXPORT NPError API_CALL NP_Shutdown() { VLOG(2) << "NP_Shutdown"; - ShutdownPlugin(); - + delete g_at_exit_manager; + g_at_exit_manager = NULL; return NPERR_NO_ERROR; } diff --git a/remoting/host/plugin/host_script_object.cc b/remoting/host/plugin/host_script_object.cc index f9a8299..9b78eb3 100644 --- a/remoting/host/plugin/host_script_object.cc +++ b/remoting/host/plugin/host_script_object.cc @@ -18,7 +18,6 @@ #include "net/base/net_util.h" #include "remoting/base/auth_token_util.h" #include "remoting/base/auto_thread.h" -#include "remoting/base/resources.h" #include "remoting/base/rsa_key_pair.h" #include "remoting/host/chromoting_host.h" #include "remoting/host/chromoting_host_context.h" @@ -105,7 +104,8 @@ class HostNPScriptObject::It2MeImpl // Creates It2Me host structures and starts the host. void Connect(const std::string& uid, const std::string& auth_token, - const std::string& auth_service); + const std::string& auth_service, + const UiStrings& ui_strings); // Disconnects the host, ready for tear-down. // Also called internally, from the network thread. @@ -222,19 +222,22 @@ HostNPScriptObject::It2MeImpl::It2MeImpl( void HostNPScriptObject::It2MeImpl::Connect( const std::string& uid, const std::string& auth_token, - const std::string& auth_service) { + const std::string& auth_service, + const UiStrings& ui_strings) { if (!host_context_->ui_task_runner()->BelongsToCurrentThread()) { DCHECK(plugin_task_runner_->BelongsToCurrentThread()); host_context_->ui_task_runner()->PostTask( FROM_HERE, - base::Bind(&It2MeImpl::Connect, this, uid, auth_token, auth_service)); + base::Bind(&It2MeImpl::Connect, this, uid, auth_token, auth_service, + ui_strings)); return; } desktop_environment_factory_.reset(new It2MeDesktopEnvironmentFactory( host_context_->network_task_runner(), host_context_->input_task_runner(), - host_context_->ui_task_runner())); + host_context_->ui_task_runner(), + ui_strings)); // Start monitoring configured policies. policy_watcher_.reset( @@ -1053,7 +1056,7 @@ bool HostNPScriptObject::Connect(const NPVariant* args, it2me_impl_ = new It2MeImpl( host_context.Pass(), plugin_task_runner_, weak_ptr_, xmpp_server_config_, directory_bot_jid_); - it2me_impl_->Connect(uid, auth_token, auth_service); + it2me_impl_->Connect(uid, auth_token, auth_service, ui_strings_); return true; } @@ -1493,13 +1496,23 @@ void HostNPScriptObject::SetWindow(NPWindow* np_window) { void HostNPScriptObject::LocalizeStrings(NPObject* localize_func) { DCHECK(plugin_task_runner_->BelongsToCurrentThread()); - // Reload resources for the current locale. The default UI locale is used on - // Windows. -#if !defined(OS_WIN) - string16 ui_locale; - LocalizeString(localize_func, "@@ui_locale", &ui_locale); - remoting::LoadResources(UTF16ToUTF8(ui_locale)); -#endif // !defined(OS_WIN) + string16 direction; + LocalizeString(localize_func, "@@bidi_dir", &direction); + ui_strings_.direction = UTF16ToUTF8(direction) == "rtl" ? + remoting::UiStrings::RTL : remoting::UiStrings::LTR; + LocalizeString(localize_func, /*i18n-content*/"PRODUCT_NAME", + &ui_strings_.product_name); + LocalizeString(localize_func, /*i18n-content*/"DISCONNECT_OTHER_BUTTON", + &ui_strings_.disconnect_button_text); + LocalizeString(localize_func, /*i18n-content*/"CONTINUE_PROMPT", + &ui_strings_.continue_prompt); + LocalizeString(localize_func, /*i18n-content*/"CONTINUE_BUTTON", + &ui_strings_.continue_button_text); + LocalizeString(localize_func, /*i18n-content*/"STOP_SHARING_BUTTON", + &ui_strings_.stop_sharing_button_text); + LocalizeStringWithSubstitution(localize_func, + /*i18n-content*/"MESSAGE_SHARED", "$1", + &ui_strings_.disconnect_message); } bool HostNPScriptObject::LocalizeString(NPObject* localize_func, diff --git a/remoting/host/plugin/host_script_object.h b/remoting/host/plugin/host_script_object.h index e1120ec..a3d5bcd 100644 --- a/remoting/host/plugin/host_script_object.h +++ b/remoting/host/plugin/host_script_object.h @@ -25,6 +25,7 @@ #include "remoting/host/log_to_server.h" #include "remoting/host/plugin/host_plugin_utils.h" #include "remoting/host/setup/daemon_controller.h" +#include "remoting/host/ui_strings.h" #include "remoting/jingle_glue/xmpp_signal_strategy.h" #include "remoting/protocol/pairing_registry.h" #include "third_party/npapi/bindings/npapi.h" @@ -301,6 +302,9 @@ class HostNPScriptObject { base::TimeDelta access_code_lifetime_; std::string client_username_; + // Localized strings for use by the |it2me_impl_| UI. + UiStrings ui_strings_; + // IT2Me Talk server configuration used by |it2me_impl_| to connect. XmppSignalStrategy::XmppServerConfig xmpp_server_config_; diff --git a/remoting/host/remoting_me2me_host-Info.plist b/remoting/host/remoting_me2me_host-Info.plist index 1f2b9df..66f04b1 100644 --- a/remoting/host/remoting_me2me_host-Info.plist +++ b/remoting/host/remoting_me2me_host-Info.plist @@ -24,6 +24,8 @@ <string>VERSION_SHORT</string> <key>LSMinimumSystemVersion</key> <string>${MACOSX_DEPLOYMENT_TARGET}.0</string> + <key>NSHumanReadableCopyright</key> + <string>COPYRIGHT_INFO</string> <key>NSPrincipalClass</key> <string>CrApplication</string> <key>LSUIElement</key> diff --git a/remoting/host/remoting_me2me_host-InfoPlist.strings.jinja2 b/remoting/host/remoting_me2me_host-InfoPlist.strings.jinja2 deleted file mode 100644 index 4a650d8..0000000 --- a/remoting/host/remoting_me2me_host-InfoPlist.strings.jinja2 +++ /dev/null @@ -1 +0,0 @@ -NSHumanReadableCopyright = "{% trans %}COPYRIGHT{% endtrans %}"; diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc index 408d293..7b7d3e3 100644 --- a/remoting/host/remoting_me2me_host.cc +++ b/remoting/host/remoting_me2me_host.cc @@ -64,6 +64,7 @@ #include "remoting/host/session_manager_factory.h" #include "remoting/host/signaling_connector.h" #include "remoting/host/token_validator_factory_impl.h" +#include "remoting/host/ui_strings.h" #include "remoting/host/usage_stats_consent.h" #include "remoting/jingle_glue/network_settings.h" #include "remoting/jingle_glue/xmpp_signal_strategy.h" @@ -580,6 +581,9 @@ void HostProcess::StartOnUiThread() { } #endif // defined(OS_LINUX) + // TODO(alexeypa): Localize the UI strings. See http://crbug.com/155204. + UiStrings ui_strings; + // Create a desktop environment factory appropriate to the build type & // platform. #if defined(OS_WIN) @@ -596,7 +600,8 @@ void HostProcess::StartOnUiThread() { new Me2MeDesktopEnvironmentFactory( context_->network_task_runner(), context_->input_task_runner(), - context_->ui_task_runner()); + context_->ui_task_runner(), + ui_strings); #endif // !defined(OS_WIN) desktop_environment_factory_.reset(desktop_environment_factory); diff --git a/remoting/host/ui_strings.cc b/remoting/host/ui_strings.cc new file mode 100644 index 0000000..e59dd5c6 --- /dev/null +++ b/remoting/host/ui_strings.cc @@ -0,0 +1,34 @@ +// Copyright (c) 2012 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. + +#include "remoting/host/ui_strings.h" + +#include "base/strings/utf_string_conversions.h" + +namespace remoting { + +UiStrings::UiStrings() : + direction(LTR), + product_name(ASCIIToUTF16("Chromoting")), + // Audio is currently only supported for Me2Me, and not on Mac. However, + // for IT2Me, these strings are replaced during l10n, so it's fine to + // hard-code a mention of audio here. +#if defined(OS_MACOSX) + disconnect_message( + ASCIIToUTF16("Your desktop is currently shared with $1.")), +#else + disconnect_message(ASCIIToUTF16( + "Your desktop and any audio output are currently shared with $1.")), +#endif + disconnect_button_text(ASCIIToUTF16("Disconnect")), + continue_prompt(ASCIIToUTF16( + "You are currently sharing this machine with another user. " + "Please confirm that you want to continue sharing.")), + continue_button_text(ASCIIToUTF16("Continue")), + stop_sharing_button_text(ASCIIToUTF16("Stop Sharing")) { +} + +UiStrings::~UiStrings() {} + +} // namespace remoting diff --git a/remoting/host/ui_strings.h b/remoting/host/ui_strings.h new file mode 100644 index 0000000..356c27a --- /dev/null +++ b/remoting/host/ui_strings.h @@ -0,0 +1,50 @@ +// Copyright (c) 2011 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. + +#ifndef REMOTING_HOST_UI_STRINGS_H_ +#define REMOTING_HOST_UI_STRINGS_H_ + +#include "base/strings/string16.h" + +// This struct contains localized strings to be displayed in host dialogs. +// For the web-app, these are loaded from the appropriate messages.json +// file when the plugin is created. For remoting_simple_host, they are +// left set to the default (English) values. +// +// Since we don't anticipate having a significant host-side UI presented +// in this way, a namespace containing all available strings should be +// a reasonable way to implement this. + +namespace remoting { + +struct UiStrings { + UiStrings(); + ~UiStrings(); + + // The direction (left-to-right or right-to-left) for the current language. + enum Direction { RTL, LTR }; + Direction direction; + + // The product name (Chromoting or Chrome Remote Desktop). + string16 product_name; + + // The message in the disconnect dialog. + string16 disconnect_message; + + // The label on the disconnect dialog button, without the keyboard shortcut. + string16 disconnect_button_text; + + // The confirmation prompt displayed by the continue window. + string16 continue_prompt; + + // The label on the 'Continue' button of the continue window. + string16 continue_button_text; + + // The label on the 'Stop Sharing' button of the continue window. + string16 stop_sharing_button_text; +}; + +} + +#endif // REMOTING_HOST_UI_STRINGS_H_ diff --git a/remoting/host/win/core.rc.jinja2 b/remoting/host/win/core.rc.jinja2 index 528108b..cf7c1807 100644 --- a/remoting/host/win/core.rc.jinja2 +++ b/remoting/host/win/core.rc.jinja2 @@ -29,7 +29,7 @@ IDD_VERIFY_CONFIG_DIALOG ICON "remoting/resources/chromoting.ico" IDD_VERIFY_CONFIG_DIALOG DIALOGEX 0, 0, 221, 106 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUPWINDOW | WS_CAPTION -EXSTYLE 0 {% if IsRtlLanguage(lang) %} | WS_EX_LAYOUTRTL | WS_EX_RTLREADING {% endif %} +EXSTYLE 0 {% if IsRtlLanguage(lang) %} | WS_EX_LAYOUTRTL {% endif %} CAPTION "{% trans %}PRODUCT_NAME{% endtrans %}" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN @@ -44,10 +44,10 @@ END IDD_DISCONNECT DIALOGEX 0, 0, 145, 24 STYLE DS_SETFONT | WS_POPUP -EXSTYLE WS_EX_TOPMOST | WS_EX_TOOLWINDOW {% if IsRtlLanguage(lang) %} | WS_EX_LAYOUTRTL | WS_EX_RTLREADING {% endif %} +EXSTYLE WS_EX_TOPMOST | WS_EX_TOOLWINDOW {% if IsRtlLanguage(lang) %} | WS_EX_LAYOUTRTL {% endif %} FONT 9, "Microsoft Sans Serif", 400, 0, 0x0 BEGIN - DEFPUSHBUTTON "{% trans %}STOP_SHARING_BUTTON{% endtrans %}",IDC_DISCONNECT,68,5,70,14 + DEFPUSHBUTTON "{% trans %}DISCONNECT_OTHER_BUTTON{% endtrans %}",IDC_DISCONNECT,68,5,70,14 LTEXT "{% trans %}MESSAGE_SHARED{% endtrans %}",IDC_DISCONNECT_SHARINGWITH,18,7,43,8 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDVERT,6,6,1,12 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDVERT,8,6,1,12 @@ -55,7 +55,7 @@ END IDD_CONTINUE DIALOGEX 0, 0, 221, 58 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION -EXSTYLE WS_EX_TOPMOST | WS_EX_TOOLWINDOW {% if IsRtlLanguage(lang) %} | WS_EX_LAYOUTRTL | WS_EX_RTLREADING {% endif %} +EXSTYLE WS_EX_TOPMOST | WS_EX_TOOLWINDOW {% if IsRtlLanguage(lang) %} | WS_EX_LAYOUTRTL {% endif %} CAPTION "kTitle" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN diff --git a/remoting/host/win/session_desktop_environment.cc b/remoting/host/win/session_desktop_environment.cc index 82951ea..0f4ffda 100644 --- a/remoting/host/win/session_desktop_environment.cc +++ b/remoting/host/win/session_desktop_environment.cc @@ -44,10 +44,12 @@ SessionDesktopEnvironmentFactory::SessionDesktopEnvironmentFactory( scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, + const UiStrings& ui_strings, const base::Closure& inject_sas) : Me2MeDesktopEnvironmentFactory(caller_task_runner, input_task_runner, - ui_task_runner), + ui_task_runner, + ui_strings), inject_sas_(inject_sas) { DCHECK(caller_task_runner->BelongsToCurrentThread()); } @@ -65,6 +67,7 @@ scoped_ptr<DesktopEnvironment> SessionDesktopEnvironmentFactory::Create( ui_task_runner(), inject_sas_)); if (!desktop_environment->InitializeSecurity(client_session_control, + ui_strings(), curtain_enabled())) { return scoped_ptr<DesktopEnvironment>(); } diff --git a/remoting/host/win/session_desktop_environment.h b/remoting/host/win/session_desktop_environment.h index 7d14413..1eb9c6a 100644 --- a/remoting/host/win/session_desktop_environment.h +++ b/remoting/host/win/session_desktop_environment.h @@ -13,6 +13,8 @@ namespace remoting { +struct UiStrings; + // Used to create audio/video capturers and event executor that are compatible // with Windows sessions. class SessionDesktopEnvironment : public Me2MeDesktopEnvironment { @@ -43,6 +45,7 @@ class SessionDesktopEnvironmentFactory : public Me2MeDesktopEnvironmentFactory { scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, + const UiStrings& ui_strings, const base::Closure& inject_sas); virtual ~SessionDesktopEnvironmentFactory(); diff --git a/remoting/host/win/version.rc.jinja2 b/remoting/host/win/version.rc.jinja2 index 0480767..19ba83d 100644 --- a/remoting/host/win/version.rc.jinja2 +++ b/remoting/host/win/version.rc.jinja2 @@ -3,7 +3,6 @@ // found in the LICENSE file. #include <winresrc.h> - #ifdef IDC_STATIC #undef IDC_STATIC #endif @@ -58,7 +57,7 @@ BEGIN VALUE "FileDescription", "{% trans %}REMOTING_HOST_PLUGIN_DESCRIPTION{% endtrans %}" VALUE "InternalName", "remoting_host_plugin.dll" VALUE "OriginalFilename", "remoting_host_plugin.dll" - VALUE "MIMEType", HOST_PLUGIN_MIME_TYPE + VALUE "MIMEType", "application/vnd.chromium.remoting-host" #else #error BINARY must be set to one of BINARY_XXX values. #endif diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp index d1ca97e..248463d 100644 --- a/remoting/remoting.gyp +++ b/remoting/remoting.gyp @@ -43,10 +43,15 @@ '<!(python <(version_py_path) -f <(chrome_version_path) -f <(remoting_version_path) -t "@PATCH@")', 'branding_path': '../remoting/branding_<(branding)', + 'copyright_info': '<!(python <(version_py_path) -f <(branding_path) -t "@COPYRIGHT@")', 'webapp_locale_dir': '<(SHARED_INTERMEDIATE_DIR)/remoting/webapp/_locales', + # Use consistent strings across all platforms. + # These values must match host/plugin/constants.h 'host_plugin_mime_type': 'application/vnd.chromium.remoting-host', + 'host_plugin_description': '<!(python <(version_py_path) -f <(branding_path) -t "@HOST_PLUGIN_DESCRIPTION@")', + 'host_plugin_name': '<!(python <(version_py_path) -f <(branding_path) -t "@HOST_PLUGIN_FILE_NAME@")', 'conditions': [ # Remoting host is supported only on Windows, OSX and Linux (with X11). @@ -95,7 +100,6 @@ 'rdp_desktop_session_clsid': '<!(python tools/uuidgen.py 2)', }], ], - 'remoting_locales': [ 'ar', 'bg', 'ca', 'cs', 'da', 'de', 'el', 'en', 'en-GB', 'es', 'es-419', 'et', 'fi', 'fil', 'fr', 'he', 'hi', 'hr', 'hu', 'id', @@ -103,15 +107,10 @@ 'ro', 'ru', 'sk', 'sl', 'sr', 'sv', 'th', 'tr', 'uk', 'vi', 'zh-CN', 'zh-TW', ], - 'remoting_locale_files': [ - # Build the list of .pak files generated from remoting_strings.grd. - '<!@pymod_do_main(remoting_copy_locales -o -p <(OS) -x ' - '<(PRODUCT_DIR) <(remoting_locales))', - ], 'remoting_webapp_locale_files': [ # Build the list of .json files generated from remoting_strings.grd. '<!@pymod_do_main(remoting_localize --locale_output ' - '"<(webapp_locale_dir)/@{json_suffix}/messages.json" ' + '"<(webapp_locale_dir)/${json_suffix}/messages.json" ' '--print_only <(remoting_locales))', ], 'remoting_webapp_files': [ @@ -270,7 +269,6 @@ 'remoting_base', 'remoting_jingle_glue', 'remoting_protocol', - 'remoting_resources', '../crypto/crypto.gyp:crypto', '../google_apis/google_apis.gyp:google_apis', '../ipc/ipc.gyp:ipc', @@ -431,6 +429,8 @@ 'host/signaling_connector.h', 'host/token_validator_factory_impl.cc', 'host/token_validator_factory_impl.h', + 'host/ui_strings.cc', + 'host/ui_strings.h', 'host/usage_stats_consent.h', 'host/usage_stats_consent_mac.cc', 'host/usage_stats_consent_win.cc', @@ -639,23 +639,19 @@ 'variables': { 'enable_wexit_time_destructors': 1, }, 'product_extension': '<(host_plugin_extension)', 'product_prefix': '<(host_plugin_prefix)', - 'defines': [ - 'HOST_PLUGIN_MIME_TYPE="<(host_plugin_mime_type)"', - ], 'dependencies': [ - '../base/base.gyp:base_i18n', '../net/net.gyp:net', '../third_party/npapi/npapi.gyp:npapi', 'remoting_base', 'remoting_host', 'remoting_host_event_logger', 'remoting_host_logging', - 'remoting_infoplist_strings', 'remoting_host_setup_base', 'remoting_jingle_glue', - 'remoting_resources', ], 'sources': [ + '<(SHARED_INTERMEDIATE_DIR)/remoting/core.rc', + '<(SHARED_INTERMEDIATE_DIR)/remoting/version.rc', 'base/dispatch_win.h', 'host/plugin/host_log_handler.cc', 'host/plugin/host_log_handler.h', @@ -676,7 +672,7 @@ # TODO(maruel): Use INFOPLIST_PREFIX_HEADER to remove the need to # duplicate string once # http://code.google.com/p/gyp/issues/detail?id=243 is fixed. - 'INFOPLIST_PREPROCESSOR_DEFINITIONS': 'HOST_PLUGIN_MIME_TYPE="<(host_plugin_mime_type)" VERSION_FULL="<(version_full)" VERSION_SHORT="<(version_short)"', + 'INFOPLIST_PREPROCESSOR_DEFINITIONS': 'HOST_PLUGIN_MIME_TYPE="<(host_plugin_mime_type)" HOST_PLUGIN_NAME="<(host_plugin_name)" HOST_PLUGIN_DESCRIPTION="<(host_plugin_description)"', }, # TODO(mark): Come up with a fancier way to do this. It should # only be necessary to list host_plugin-Info.plist once, not the @@ -687,12 +683,6 @@ 'resources/chromoting16.png', 'resources/chromoting48.png', 'resources/chromoting128.png', - '<!@pymod_do_main(remoting_copy_locales -o -p <(OS) -x <(PRODUCT_DIR) <(remoting_locales))', - - # Localized strings for 'Info.plist' - '<!@pymod_do_main(remoting_localize --locale_output ' - '"<(SHARED_INTERMEDIATE_DIR)/remoting/host_plugin_resources/@{json_suffix}.lproj/InfoPlist.strings" ' - '--print_only <(remoting_locales))', ], 'mac_bundle_resources!': [ 'host/plugin/host_plugin-Info.plist', @@ -720,8 +710,6 @@ '<(INTERMEDIATE_DIR)', ], 'sources': [ - '<(SHARED_INTERMEDIATE_DIR)/remoting/core.rc', - '<(SHARED_INTERMEDIATE_DIR)/remoting/version.rc', 'host/plugin/host_plugin.def', ], 'msvs_settings': { @@ -741,103 +729,6 @@ }], ], }, # end of target 'remoting_host_plugin' - { - 'target_name': 'remoting_infoplist_strings', - 'type': 'none', - 'dependencies': [ - 'remoting_resources', - ], - 'actions': [ - { - 'action_name': 'generate_host_plugin_strings', - 'inputs': [ - '<(remoting_localize_path)', - 'host/plugin/host_plugin-InfoPlist.strings.jinja2', - ], - 'outputs': [ - '<!@pymod_do_main(remoting_localize --locale_output ' - '"<(SHARED_INTERMEDIATE_DIR)/remoting/host_plugin_resources/@{json_suffix}.lproj/InfoPlist.strings" ' - '--print_only <(remoting_locales))', - ], - 'action': [ - 'python', - '<(remoting_localize_path)', - '--locale_dir', '<(webapp_locale_dir)', - '--template', 'host/plugin/host_plugin-InfoPlist.strings.jinja2', - '--locale_output', - '<(SHARED_INTERMEDIATE_DIR)/remoting/host_plugin_resources/@{json_suffix}.lproj/InfoPlist.strings', - '--encoding', 'utf-8', - '<@(remoting_locales)', - ], - }, - { - 'action_name': 'generate_host_strings', - 'inputs': [ - '<(remoting_localize_path)', - 'host/remoting_me2me_host-InfoPlist.strings.jinja2', - ], - 'outputs': [ - '<!@pymod_do_main(remoting_localize --locale_output ' - '"<(SHARED_INTERMEDIATE_DIR)/remoting/host_resources/@{json_suffix}.lproj/InfoPlist.strings" ' - '--print_only <(remoting_locales))', - ], - 'action': [ - 'python', - '<(remoting_localize_path)', - '--locale_dir', '<(webapp_locale_dir)', - '--template', 'host/remoting_me2me_host-InfoPlist.strings.jinja2', - '--locale_output', - '<(SHARED_INTERMEDIATE_DIR)/remoting/host_resources/@{json_suffix}.lproj/InfoPlist.strings', - '--encoding', 'utf-8', - '<@(remoting_locales)', - ], - }, - { - 'action_name': 'generate_preference_pane_strings', - 'inputs': [ - '<(remoting_localize_path)', - 'host/mac/me2me_preference_pane-InfoPlist.strings.jinja2', - ], - 'outputs': [ - '<!@pymod_do_main(remoting_localize --locale_output ' - '"<(SHARED_INTERMEDIATE_DIR)/remoting/preference_pane_resources/@{json_suffix}.lproj/InfoPlist.strings" ' - '--print_only <(remoting_locales))', - ], - 'action': [ - 'python', - '<(remoting_localize_path)', - '--locale_dir', '<(webapp_locale_dir)', - '--template', 'host/mac/me2me_preference_pane-InfoPlist.strings.jinja2', - '--locale_output', - '<(SHARED_INTERMEDIATE_DIR)/remoting/preference_pane_resources/@{json_suffix}.lproj/InfoPlist.strings', - '--encoding', 'utf-8', - '<@(remoting_locales)', - ], - }, - { - 'action_name': 'generate_uninstaller_strings', - 'inputs': [ - '<(remoting_localize_path)', - 'host/installer/mac/uninstaller/remoting_uninstaller-InfoPlist.strings.jinja2', - ], - 'outputs': [ - '<!@pymod_do_main(remoting_localize --locale_output ' - '"<(SHARED_INTERMEDIATE_DIR)/remoting/uninstaller_resources/@{json_suffix}.lproj/InfoPlist.strings" ' - '--print_only <(remoting_locales))', - ], - 'action': [ - 'python', - '<(remoting_localize_path)', - '--locale_dir', '<(webapp_locale_dir)', - '--template', 'host/installer/mac/uninstaller/remoting_uninstaller-InfoPlist.strings.jinja2', - '--locale_output', - '<(SHARED_INTERMEDIATE_DIR)/remoting/uninstaller_resources/@{json_suffix}.lproj/InfoPlist.strings', - '--encoding', 'utf-8', - '<@(remoting_locales)', - ], - }, - ], - }, # end of target 'remoting_infoplist_strings' { 'target_name': 'remoting_native_messaging_host', @@ -955,7 +846,6 @@ 'remoting_host', 'remoting_host_event_logger', 'remoting_host_logging', - 'remoting_infoplist_strings', 'remoting_jingle_glue', 'remoting_me2me_host_static', ], @@ -976,18 +866,12 @@ 'xcode_settings': { 'INFOPLIST_FILE': 'host/remoting_me2me_host-Info.plist', 'INFOPLIST_PREPROCESS': 'YES', - 'INFOPLIST_PREPROCESSOR_DEFINITIONS': 'VERSION_FULL="<(version_full)" VERSION_SHORT="<(version_short)" BUNDLE_ID="<(host_bundle_id)"', + 'INFOPLIST_PREPROCESSOR_DEFINITIONS': 'VERSION_FULL="<(version_full)" VERSION_SHORT="<(version_short)" BUNDLE_ID="<(host_bundle_id)" COPYRIGHT_INFO="<(copyright_info)"', }, 'mac_bundle_resources': [ 'host/disconnect_window.xib', 'host/remoting_me2me_host.icns', 'host/remoting_me2me_host-Info.plist', - '<!@pymod_do_main(remoting_copy_locales -o -p <(OS) -x <(PRODUCT_DIR) <(remoting_locales))', - - # Localized strings for 'Info.plist' - '<!@pymod_do_main(remoting_localize --locale_output ' - '"<(SHARED_INTERMEDIATE_DIR)/remoting/host_resources/@{json_suffix}.lproj/InfoPlist.strings" ' - '--print_only <(remoting_locales))', ], 'mac_bundle_resources!': [ 'host/remoting_me2me_host-Info.plist', @@ -1104,10 +988,10 @@ 'mac_bundle': 1, 'variables': { 'bundle_id': '<!(python <(version_py_path) -f <(branding_path) -t "@MAC_UNINSTALLER_BUNDLE_ID@")', + 'bundle_name': '<!(python <(version_py_path) -f <(branding_path) -t "@MAC_UNINSTALLER_BUNDLE_NAME@")', }, 'dependencies': [ '<(DEPTH)/base/base.gyp:base', - 'remoting_infoplist_strings', ], 'sources': [ 'host/constants_mac.cc', @@ -1120,17 +1004,12 @@ 'xcode_settings': { 'INFOPLIST_FILE': 'host/installer/mac/uninstaller/remoting_uninstaller-Info.plist', 'INFOPLIST_PREPROCESS': 'YES', - 'INFOPLIST_PREPROCESSOR_DEFINITIONS': 'VERSION_FULL="<(version_full)" VERSION_SHORT="<(version_short)" BUNDLE_ID="<(bundle_id)"', + 'INFOPLIST_PREPROCESSOR_DEFINITIONS': 'VERSION_FULL="<(version_full)" VERSION_SHORT="<(version_short)" BUNDLE_NAME="<(bundle_name)" BUNDLE_ID="<(bundle_id)" COPYRIGHT_INFO="<(copyright_info)"', }, 'mac_bundle_resources': [ 'host/installer/mac/uninstaller/remoting_uninstaller.icns', 'host/installer/mac/uninstaller/remoting_uninstaller.xib', 'host/installer/mac/uninstaller/remoting_uninstaller-Info.plist', - - # Localized strings for 'Info.plist' - '<!@pymod_do_main(remoting_localize --locale_output ' - '"<(SHARED_INTERMEDIATE_DIR)/remoting/uninstaller_resources/@{json_suffix}.lproj/InfoPlist.strings" ' - '--print_only <(remoting_locales))', ], 'mac_bundle_resources!': [ 'host/installer/mac/uninstaller/remoting_uninstaller-Info.plist', @@ -1182,6 +1061,7 @@ 'VERSION_SHORT=<(version_short)', 'VERSION_MAJOR=<(version_major)', 'VERSION_MINOR=<(version_minor)', + 'COPYRIGHT_INFO=<(copyright_info)', 'HOST_NAME=<(host_name)', 'HOST_SERVICE_NAME=<(host_service_name)', 'HOST_UNINSTALLER_NAME=<(host_uninstaller_name)', @@ -1229,9 +1109,6 @@ 'defines': [ 'JSON_USE_EXCEPTION=0', ], - 'dependencies': [ - 'remoting_infoplist_strings', - ], 'include_dirs': [ '../third_party/jsoncpp/overrides/include/', '../third_party/jsoncpp/source/include/', @@ -1269,13 +1146,20 @@ }, 'variables': { 'bundle_id': '<!(python <(version_py_path) -f <(branding_path) -t "@MAC_PREFPANE_BUNDLE_ID@")', + 'bundle_name': '<!(python <(version_py_path) -f <(branding_path) -t "@MAC_PREFPANE_BUNDLE_NAME@")', + # The XML new-line entity splits the label into two lines, which + # is the maximum number of lines allowed by the System Preferences + # applet. + # TODO(lambroslambrou): When these strings are localized, use "\n" + # instead of "
" for linebreaks. + 'pref_pane_icon_label': '<!(python <(version_py_path) -f <(branding_path) -t "@MAC_PREFPANE_ICON_LABEL@")', }, 'xcode_settings': { 'ARCHS': ['i386', 'x86_64'], 'GCC_ENABLE_OBJC_GC': 'supported', 'INFOPLIST_FILE': 'host/mac/me2me_preference_pane-Info.plist', 'INFOPLIST_PREPROCESS': 'YES', - 'INFOPLIST_PREPROCESSOR_DEFINITIONS': 'VERSION_FULL="<(version_full)" VERSION_SHORT="<(version_short)" BUNDLE_ID="<(bundle_id)"', + 'INFOPLIST_PREPROCESSOR_DEFINITIONS': 'VERSION_FULL="<(version_full)" VERSION_SHORT="<(version_short)" BUNDLE_NAME="<(bundle_name)" BUNDLE_ID="<(bundle_id)" COPYRIGHT_INFO="<(copyright_info)" PREF_PANE_ICON_LABEL="<(pref_pane_icon_label)"', }, 'mac_bundle_resources': [ 'host/mac/me2me_preference_pane.xib', @@ -1283,11 +1167,6 @@ 'host/mac/me2me_preference_pane_disable.xib', 'host/mac/me2me_preference_pane-Info.plist', 'resources/chromoting128.png', - - # Localized strings for 'Info.plist' - '<!@pymod_do_main(remoting_localize --locale_output ' - '"<(SHARED_INTERMEDIATE_DIR)/remoting/preference_pane_resources/@{json_suffix}.lproj/InfoPlist.strings" ' - '--print_only <(remoting_locales))', ], 'mac_bundle_resources!': [ 'host/mac/me2me_preference_pane-Info.plist', @@ -2148,14 +2027,18 @@ 'remoting_resources', 'remoting_host_plugin', ], - 'locale_files': [ + 'sources': [ + 'webapp/build-webapp.py', + '<(remoting_version_path)', + '<(chrome_version_path)', + '<@(remoting_webapp_apps_v2_js_files)', + '<@(remoting_webapp_files)', + '<@(remoting_webapp_js_files)', '<@(remoting_webapp_locale_files)', + '<@(remoting_webapp_patch_files)', ], 'conditions': [ ['enable_remoting_host==1', { - 'locale_files': [ - '<@(remoting_locale_files)', - ], 'variables': { 'plugin_path': '<(PRODUCT_DIR)/<(host_plugin_prefix)remoting_host_plugin.<(host_plugin_extension)', }, @@ -2179,7 +2062,7 @@ '<(remoting_version_path)', '<@(remoting_webapp_files)', '<@(remoting_webapp_js_files)', - '<@(_locale_files)', + '<@(remoting_webapp_locale_files)', ], 'conditions': [ ['enable_remoting_host==1', { @@ -2203,7 +2086,7 @@ '<@(remoting_webapp_files)', '<@(remoting_webapp_js_files)', '--locales', - '<@(_locale_files)', + '<@(remoting_webapp_locale_files)', ], 'msvs_cygwin_shell': 1, }, @@ -2274,11 +2157,7 @@ 'grit_resource_ids': 'resources/resource_ids', 'sources': [ 'base/resources_unittest.cc', - 'host/continue_window_mac.mm', - 'host/disconnect_window_mac.mm', - 'host/installer/mac/uninstaller/remoting_uninstaller-InfoPlist.strings.jinja2', - 'host/mac/me2me_preference_pane-InfoPlist.strings.jinja2', - 'host/plugin/host_plugin-InfoPlist.strings.jinja2', + 'host/plugin/host_script_object.cc', 'host/win/core.rc.jinja2', 'host/win/host_messages.mc.jinja2', 'host/win/version.rc.jinja2', @@ -2286,8 +2165,8 @@ 'webapp/client_screen.js', 'webapp/error.js', 'webapp/host_list.js', - 'webapp/host_setup_dialog.js', 'webapp/host_table_entry.js', + 'webapp/host_setup_dialog.js', 'webapp/main.html', 'webapp/manifest.json', 'webapp/paired_client_manager.js', @@ -2299,6 +2178,7 @@ 'action_name': 'verify_resources', 'inputs': [ 'resources/remoting_strings.grd', + 'resources/common_resources.grd', 'tools/verify_resources.py', '<@(sources)' ], @@ -2310,6 +2190,7 @@ 'tools/verify_resources.py', '-t', '<(PRODUCT_DIR)/remoting_resources_verified.stamp', '-r', 'resources/remoting_strings.grd', + '-r', 'resources/common_resources.grd', '<@(sources)', ], }, @@ -2321,26 +2202,30 @@ 'includes': [ '../build/grit_action.gypi' ], }, { - 'action_name': 'copy_locales', + 'action_name': 'common_resources', 'variables': { - 'copy_output_dir%': '<(PRODUCT_DIR)', + 'grit_grd_file': 'resources/common_resources.grd', }, - 'inputs': [ - 'tools/build/remoting_copy_locales.py', - '<!@pymod_do_main(remoting_copy_locales -i -p <(OS) -g <(grit_out_dir) <(remoting_locales))' - ], - 'outputs': [ - '<!@pymod_do_main(remoting_copy_locales -o -p <(OS) -x <(copy_output_dir) <(remoting_locales))' - ], - 'action': [ - 'python', - 'tools/build/remoting_copy_locales.py', - '-p', '<(OS)', - '-g', '<(grit_out_dir)', - '-x', '<(copy_output_dir)/.', - '<@(remoting_locales)', + 'includes': [ '../build/grit_action.gypi' ], + }, + ], + 'copies': [ + # Copy results to the product directory. + { + 'destination': '<(PRODUCT_DIR)/remoting_locales', + 'files': [ + # Build the list of .pak files generated from remoting_strings.grd. + '<!@pymod_do_main(remoting_localize --locale_output ' + '"<(grit_out_dir)/remoting/resources/${pak_suffix}.pak" ' + '--print_only <(remoting_locales))', ], - } + }, + { + 'destination': '<(PRODUCT_DIR)', + 'files': [ + '<(grit_out_dir)/remoting/resources/chrome_remote_desktop.pak', + ] + }, ], 'includes': [ '../build/grit_target.gypi' ], }, # end of target 'remoting_resources' @@ -2394,10 +2279,8 @@ 'base/plugin_thread_task_runner.h', 'base/rate_counter.cc', 'base/rate_counter.h', + 'base/resources.cc', 'base/resources.h', - 'base/resources_linux.cc', - 'base/resources_mac.mm', - 'base/resources_win.cc', 'base/rsa_key_pair.cc', 'base/rsa_key_pair.h', 'base/running_average.cc', @@ -2807,20 +2690,6 @@ ], }, }], - ['OS=="mac"', { - 'mac_bundle': 1, - 'xcode_settings': { - 'INFOPLIST_FILE': 'unittests-Info.plist', - 'INFOPLIST_PREPROCESS': 'YES', - }, - 'mac_bundle_resources': [ - 'unittests-Info.plist', - '<!@pymod_do_main(remoting_copy_locales -o -p <(OS) -x <(PRODUCT_DIR) <(remoting_locales))', - ], - 'mac_bundle_resources!': [ - 'unittests-Info.plist', - ], - }], # OS=="mac" ['OS=="mac" or (OS=="linux" and chromeos==0)', { # Javascript unittests are disabled on CrOS because they cause # valgrind and test errors. diff --git a/remoting/resources/common_resources.grd b/remoting/resources/common_resources.grd new file mode 100644 index 0000000..e0d4520 --- /dev/null +++ b/remoting/resources/common_resources.grd @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> + +<grit base_dir="." latest_public_release="0" current_release="1" + source_lang_id="en" enc_check="möl"> + <outputs> + <output filename="remoting/base/common_resources.h" type="rc_header" context="default_100_percent"> + <emit emit_type='prepend'></emit> + </output> + <output filename="remoting/resources/chrome_remote_desktop.pak" type="data_package" + lang="en" context="default_100_percent" /> + </outputs> + <release seq="1" allow_pseudo="false"> + <structures fallback_to_low_resolution="true"> + <structure type="chrome_scaled_image" name="IDR_PRODUCT_LOGO_16" file="chromoting16.png" /> + <structure type="chrome_scaled_image" name="IDR_PRODUCT_LOGO_32" file="chromoting32.png" /> + </structures> + </release> +</grit> diff --git a/remoting/resources/remoting_strings.grd b/remoting/resources/remoting_strings.grd index f71fafd..3c69d18 100644 --- a/remoting/resources/remoting_strings.grd +++ b/remoting/resources/remoting_strings.grd @@ -5,91 +5,89 @@ <output filename="remoting/base/string_resources.h" type="rc_header"> <emit emit_type="prepend"/> </output> - + <output filename="remoting/resources/en-US.pak" lang="en" type="data_package"/> + <output filename="remoting/webapp/_locales/en/messages.json" lang="en" type="chrome_messages_json"/> <output filename="remoting/resources/ar.pak" lang="ar" type="data_package"/> - <output filename="remoting/resources/bg.pak" lang="bg" type="data_package"/> - <output filename="remoting/resources/ca.pak" lang="ca" type="data_package"/> - <output filename="remoting/resources/cs.pak" lang="cs" type="data_package"/> - <output filename="remoting/resources/da.pak" lang="da" type="data_package"/> - <output filename="remoting/resources/de.pak" lang="de" type="data_package"/> - <output filename="remoting/resources/el.pak" lang="el" type="data_package"/> - <output filename="remoting/resources/en-GB.pak" lang="en-GB" type="data_package"/> - <output filename="remoting/resources/en.pak" lang="en" type="data_package"/> - <output filename="remoting/resources/es-419.pak" lang="es-419" type="data_package"/> - <output filename="remoting/resources/es.pak" lang="es" type="data_package"/> - <output filename="remoting/resources/et.pak" lang="et" type="data_package"/> - <output filename="remoting/resources/fi.pak" lang="fi" type="data_package"/> - <output filename="remoting/resources/fil.pak" lang="fil" type="data_package"/> - <output filename="remoting/resources/fr.pak" lang="fr" type="data_package"/> - <output filename="remoting/resources/he.pak" lang="he" type="data_package"/> - <output filename="remoting/resources/hi.pak" lang="hi" type="data_package"/> - <output filename="remoting/resources/hr.pak" lang="hr" type="data_package"/> - <output filename="remoting/resources/hu.pak" lang="hu" type="data_package"/> - <output filename="remoting/resources/id.pak" lang="id" type="data_package"/> - <output filename="remoting/resources/it.pak" lang="it" type="data_package"/> - <output filename="remoting/resources/ja.pak" lang="ja" type="data_package"/> - <output filename="remoting/resources/ko.pak" lang="ko" type="data_package"/> - <output filename="remoting/resources/lt.pak" lang="lt" type="data_package"/> - <output filename="remoting/resources/lv.pak" lang="lv" type="data_package"/> - <output filename="remoting/resources/nb.pak" lang="nb" type="data_package"/> - <output filename="remoting/resources/nl.pak" lang="nl" type="data_package"/> - <output filename="remoting/resources/pl.pak" lang="pl" type="data_package"/> - <output filename="remoting/resources/pt-BR.pak" lang="pt-BR" type="data_package"/> - <output filename="remoting/resources/pt-PT.pak" lang="pt-PT" type="data_package"/> - <output filename="remoting/resources/ro.pak" lang="ro" type="data_package"/> - <output filename="remoting/resources/ru.pak" lang="ru" type="data_package"/> - <output filename="remoting/resources/sk.pak" lang="sk" type="data_package"/> - <output filename="remoting/resources/sl.pak" lang="sl" type="data_package"/> - <output filename="remoting/resources/sr.pak" lang="sr" type="data_package"/> - <output filename="remoting/resources/sv.pak" lang="sv" type="data_package"/> - <output filename="remoting/resources/th.pak" lang="th" type="data_package"/> - <output filename="remoting/resources/tr.pak" lang="tr" type="data_package"/> - <output filename="remoting/resources/uk.pak" lang="uk" type="data_package"/> - <output filename="remoting/resources/vi.pak" lang="vi" type="data_package"/> - <output filename="remoting/resources/zh-CN.pak" lang="zh-CN" type="data_package"/> - <output filename="remoting/resources/zh-TW.pak" lang="zh-TW" type="data_package"/> - <output filename="remoting/webapp/_locales/ar/messages.json" lang="ar" type="chrome_messages_json"/> + <output filename="remoting/resources/bg.pak" lang="bg" type="data_package"/> <output filename="remoting/webapp/_locales/bg/messages.json" lang="bg" type="chrome_messages_json"/> + <output filename="remoting/resources/ca.pak" lang="ca" type="data_package"/> <output filename="remoting/webapp/_locales/ca/messages.json" lang="ca" type="chrome_messages_json"/> + <output filename="remoting/resources/cs.pak" lang="cs" type="data_package"/> <output filename="remoting/webapp/_locales/cs/messages.json" lang="cs" type="chrome_messages_json"/> + <output filename="remoting/resources/da.pak" lang="da" type="data_package"/> <output filename="remoting/webapp/_locales/da/messages.json" lang="da" type="chrome_messages_json"/> + <output filename="remoting/resources/de.pak" lang="de" type="data_package"/> <output filename="remoting/webapp/_locales/de/messages.json" lang="de" type="chrome_messages_json"/> + <output filename="remoting/resources/el.pak" lang="el" type="data_package"/> <output filename="remoting/webapp/_locales/el/messages.json" lang="el" type="chrome_messages_json"/> - <output filename="remoting/webapp/_locales/en/messages.json" lang="en" type="chrome_messages_json"/> + <output filename="remoting/resources/en-GB.pak" lang="en-GB" type="data_package"/> <output filename="remoting/webapp/_locales/en_GB/messages.json" lang="en-GB" type="chrome_messages_json"/> + <output filename="remoting/resources/es.pak" lang="es" type="data_package"/> <output filename="remoting/webapp/_locales/es/messages.json" lang="es" type="chrome_messages_json"/> + <output filename="remoting/resources/es-419.pak" lang="es-419" type="data_package"/> <output filename="remoting/webapp/_locales/es_419/messages.json" lang="es-419" type="chrome_messages_json"/> + <output filename="remoting/resources/et.pak" lang="et" type="data_package"/> <output filename="remoting/webapp/_locales/et/messages.json" lang="et" type="chrome_messages_json"/> + <output filename="remoting/resources/fi.pak" lang="fi" type="data_package"/> <output filename="remoting/webapp/_locales/fi/messages.json" lang="fi" type="chrome_messages_json"/> + <output filename="remoting/resources/fil.pak" lang="fil" type="data_package"/> <output filename="remoting/webapp/_locales/fil/messages.json" lang="fil" type="chrome_messages_json"/> + <output filename="remoting/resources/fr.pak" lang="fr" type="data_package"/> <output filename="remoting/webapp/_locales/fr/messages.json" lang="fr" type="chrome_messages_json"/> + <output filename="remoting/resources/he.pak" lang="he" type="data_package"/> <output filename="remoting/webapp/_locales/he/messages.json" lang="he" type="chrome_messages_json"/> + <output filename="remoting/resources/hi.pak" lang="hi" type="data_package"/> <output filename="remoting/webapp/_locales/hi/messages.json" lang="hi" type="chrome_messages_json"/> + <output filename="remoting/resources/hr.pak" lang="hr" type="data_package"/> <output filename="remoting/webapp/_locales/hr/messages.json" lang="hr" type="chrome_messages_json"/> + <output filename="remoting/resources/hu.pak" lang="hu" type="data_package"/> <output filename="remoting/webapp/_locales/hu/messages.json" lang="hu" type="chrome_messages_json"/> + <output filename="remoting/resources/id.pak" lang="id" type="data_package"/> <output filename="remoting/webapp/_locales/id/messages.json" lang="id" type="chrome_messages_json"/> + <output filename="remoting/resources/it.pak" lang="it" type="data_package"/> <output filename="remoting/webapp/_locales/it/messages.json" lang="it" type="chrome_messages_json"/> + <output filename="remoting/resources/ja.pak" lang="ja" type="data_package"/> <output filename="remoting/webapp/_locales/ja/messages.json" lang="ja" type="chrome_messages_json"/> + <output filename="remoting/resources/ko.pak" lang="ko" type="data_package"/> <output filename="remoting/webapp/_locales/ko/messages.json" lang="ko" type="chrome_messages_json"/> + <output filename="remoting/resources/lt.pak" lang="lt" type="data_package"/> <output filename="remoting/webapp/_locales/lt/messages.json" lang="lt" type="chrome_messages_json"/> + <output filename="remoting/resources/lv.pak" lang="lv" type="data_package"/> <output filename="remoting/webapp/_locales/lv/messages.json" lang="lv" type="chrome_messages_json"/> + <output filename="remoting/resources/nb.pak" lang="nb" type="data_package"/> <output filename="remoting/webapp/_locales/nb/messages.json" lang="nb" type="chrome_messages_json"/> + <output filename="remoting/resources/nl.pak" lang="nl" type="data_package"/> <output filename="remoting/webapp/_locales/nl/messages.json" lang="nl" type="chrome_messages_json"/> + <output filename="remoting/resources/pl.pak" lang="pl" type="data_package"/> <output filename="remoting/webapp/_locales/pl/messages.json" lang="pl" type="chrome_messages_json"/> + <output filename="remoting/resources/pt-BR.pak" lang="pt-BR" type="data_package"/> <output filename="remoting/webapp/_locales/pt_BR/messages.json" lang="pt-BR" type="chrome_messages_json"/> + <output filename="remoting/resources/pt-PT.pak" lang="pt-PT" type="data_package"/> <output filename="remoting/webapp/_locales/pt_PT/messages.json" lang="pt-PT" type="chrome_messages_json"/> + <output filename="remoting/resources/ro.pak" lang="ro" type="data_package"/> <output filename="remoting/webapp/_locales/ro/messages.json" lang="ro" type="chrome_messages_json"/> + <output filename="remoting/resources/ru.pak" lang="ru" type="data_package"/> <output filename="remoting/webapp/_locales/ru/messages.json" lang="ru" type="chrome_messages_json"/> + <output filename="remoting/resources/sk.pak" lang="sk" type="data_package"/> <output filename="remoting/webapp/_locales/sk/messages.json" lang="sk" type="chrome_messages_json"/> + <output filename="remoting/resources/sl.pak" lang="sl" type="data_package"/> <output filename="remoting/webapp/_locales/sl/messages.json" lang="sl" type="chrome_messages_json"/> + <output filename="remoting/resources/sr.pak" lang="sr" type="data_package"/> <output filename="remoting/webapp/_locales/sr/messages.json" lang="sr" type="chrome_messages_json"/> + <output filename="remoting/resources/sv.pak" lang="sv" type="data_package"/> <output filename="remoting/webapp/_locales/sv/messages.json" lang="sv" type="chrome_messages_json"/> + <output filename="remoting/resources/th.pak" lang="th" type="data_package"/> <output filename="remoting/webapp/_locales/th/messages.json" lang="th" type="chrome_messages_json"/> + <output filename="remoting/resources/tr.pak" lang="tr" type="data_package"/> <output filename="remoting/webapp/_locales/tr/messages.json" lang="tr" type="chrome_messages_json"/> + <output filename="remoting/resources/uk.pak" lang="uk" type="data_package"/> <output filename="remoting/webapp/_locales/uk/messages.json" lang="uk" type="chrome_messages_json"/> + <output filename="remoting/resources/vi.pak" lang="vi" type="data_package"/> <output filename="remoting/webapp/_locales/vi/messages.json" lang="vi" type="chrome_messages_json"/> + <output filename="remoting/resources/zh-CN.pak" lang="zh-CN" type="data_package"/> <output filename="remoting/webapp/_locales/zh_CN/messages.json" lang="zh-CN" type="chrome_messages_json"/> + <output filename="remoting/resources/zh-TW.pak" lang="zh-TW" type="data_package"/> <output filename="remoting/webapp/_locales/zh_TW/messages.json" lang="zh-TW" type="chrome_messages_json"/> </outputs> <translations> @@ -219,18 +217,6 @@ <message name="IDR_VERIFY_PIN_DIALOG_MESSAGE" desc="The message displayed by the PIN verification dialog."> Please confirm your account and PIN below to allow access by Chrome Remote Desktop. </message> - <message name="IDR_REMOTING_HOST_PLUGIN_NAME" desc="Name of Chrome Remote Desktop Host plugin displayed by Chrome at about:plugins."> - Chrome Remote Desktop Host - </message> - <message name="IDR_MAC_PREFPANE_BUNDLE_NAME" desc="The bundle name specified in the property list of Chrome Remote Desktop Host Preferences bundle on MacOS."> - Chrome Remote Desktop Host Preferences - </message> - <message name="IDR_MAC_PREFPANE_ICON_LABEL" desc="The name of Chrome Remote Desktop Host icon in Preference Pane on MacOS. The carriage return makes sure that the label is not truncated."> - Chrome Remote
Desktop Host - </message> - <message name="IDR_MAC_UNINSTALLER_BUNDLE_NAME" desc="The bundle name specified in the property list of Chrome Remote Desktop Host Uninstaller bundle on MacOS."> - Chrome Remote Desktop Host Uninstaller - </message> </if> <if expr="not pp_ifdef('_google_chrome')"> @@ -315,18 +301,6 @@ <message name="IDR_VERIFY_PIN_DIALOG_MESSAGE" desc="The message displayed by the PIN verification dialog."> Please confirm your account and PIN below to allow access by Chromoting. </message> - <message name="IDR_REMOTING_HOST_PLUGIN_NAME" desc="Name of Chromoting Host plugin displayed by Chrome at about:plugins."> - Chromoting Host - </message> - <message name="IDR_MAC_PREFPANE_BUNDLE_NAME" desc="The bundle name specified in the property list of Chromoting Host Preferences bundle on MacOS."> - Chromoting Host Preferences - </message> - <message name="IDR_MAC_PREFPANE_ICON_LABEL" desc="The name of Chromoting Host icon in Preference Pane on MacOS. The carriage return makes sure that the label is not truncated."> - Chromoting
Host - </message> - <message name="IDR_MAC_UNINSTALLER_BUNDLE_NAME" desc="The bundle name specified in the property list of Chromoting Host Uninstaller bundle on MacOS."> - Chromoting Host Uninstaller - </message> </if> <message desc="Label for the access code entry box. This is where the client user enters the code that permits access to the host." name="IDR_ACCESS_CODE"> @@ -389,6 +363,9 @@ <message desc="Label for the client-side disconnect button. Clicking this button disconnects oneself from the host." name="IDR_DISCONNECT_MYSELF_BUTTON"> Disconnect </message> + <message desc="Label for the host-side disconnect button, without keyboard shortcuts. Only used in case we aren't able to enable hot-key support. Clicking this button disconnects the remote user." name="IDR_DISCONNECT_OTHER_BUTTON"> + Disconnect + </message> <message desc="Column header in the connection history table showing the length of time for which a connection was active, if available." name="IDR_DURATION_HEADER"> Duration </message> diff --git a/remoting/resources/resource_ids b/remoting/resources/resource_ids index 3becde5..fc0ba05 100644 --- a/remoting/resources/resource_ids +++ b/remoting/resources/resource_ids @@ -19,4 +19,7 @@ "remoting/resources/remoting_strings.grd": { "messages": [1000], }, + "remoting/resources/common_resources.grd": { + "structures": [10000], + }, } diff --git a/remoting/tools/build/remoting_copy_locales.py b/remoting/tools/build/remoting_copy_locales.py deleted file mode 100755 index 4d1d41a..0000000 --- a/remoting/tools/build/remoting_copy_locales.py +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env python -# 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. - -"""Helper script to repack paks for a list of locales. - -Gyp doesn't have any built-in looping capability, so this just provides a way to -loop over a list of locales when repacking pak files, thus avoiding a -proliferation of mostly duplicate, cut-n-paste gyp actions. -""" - -import optparse -import os -import sys - -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..', - 'tools', 'grit')) -from grit.format import data_pack - -# Some build paths defined by gyp. -GRIT_DIR = None -INT_DIR = None - -# The target platform. If it is not defined, sys.platform will be used. -OS = None - -# Extra input files. -EXTRA_INPUT_FILES = [] - -class Usage(Exception): - def __init__(self, msg): - self.msg = msg - - -def calc_output(locale): - """Determine the file that will be generated for the given locale.""" - #e.g. '<(INTERMEDIATE_DIR)/remoting_locales/da.pak', - if OS == 'mac' or OS == 'ios': - # For Cocoa to find the locale at runtime, it needs to use '_' instead - # of '-' (http://crbug.com/20441). - return os.path.join(INT_DIR, 'remoting', 'resources', - '%s.lproj' % locale.replace('-', '_'), 'locale.pak') - else: - return os.path.join(INT_DIR, 'remoting_locales', locale + '.pak') - - -def calc_inputs(locale): - """Determine the files that need processing for the given locale.""" - inputs = [] - - #e.g. '<(grit_out_dir)/remoting/resources/da.pak' - inputs.append(os.path.join(GRIT_DIR, 'remoting/resources/%s.pak' % locale)) - - # Add any extra input files. - for extra_file in EXTRA_INPUT_FILES: - inputs.append('%s_%s.pak' % (extra_file, locale)) - - return inputs - - -def list_outputs(locales): - """Returns the names of files that will be generated for the given locales. - - This is to provide gyp the list of output files, so build targets can - properly track what needs to be built. - """ - outputs = [] - for locale in locales: - outputs.append(calc_output(locale)) - # Quote each element so filename spaces don't mess up gyp's attempt to parse - # it into a list. - return " ".join(['"%s"' % x for x in outputs]) - - -def list_inputs(locales): - """Returns the names of files that will be processed for the given locales. - - This is to provide gyp the list of input files, so build targets can properly - track their prerequisites. - """ - inputs = [] - for locale in locales: - inputs += calc_inputs(locale) - # Quote each element so filename spaces don't mess up gyp's attempt to parse - # it into a list. - return " ".join(['"%s"' % x for x in inputs]) - - -def repack_locales(locales): - """ Loop over and repack the given locales.""" - for locale in locales: - inputs = calc_inputs(locale) - output = calc_output(locale) - data_pack.DataPack.RePack(output, inputs) - - -def DoMain(argv): - global GRIT_DIR - global INT_DIR - global OS - global EXTRA_INPUT_FILES - - parser = optparse.OptionParser("usage: %prog [options] locales") - parser.add_option("-i", action="store_true", dest="inputs", default=False, - help="Print the expected input file list, then exit.") - parser.add_option("-o", action="store_true", dest="outputs", default=False, - help="Print the expected output file list, then exit.") - parser.add_option("-g", action="store", dest="grit_dir", - help="GRIT build files output directory.") - parser.add_option("-x", action="store", dest="int_dir", - help="Intermediate build files output directory.") - parser.add_option("-e", action="append", dest="extra_input", default=[], - help="Full path to an extra input pak file without the\ - locale suffix and \".pak\" extension.") - parser.add_option("-p", action="store", dest="os", - help="The target OS. (e.g. mac, linux, win, etc.)") - options, locales = parser.parse_args(argv) - - if not locales: - parser.error('Please specificy at least one locale to process.\n') - - print_inputs = options.inputs - print_outputs = options.outputs - GRIT_DIR = options.grit_dir - INT_DIR = options.int_dir - EXTRA_INPUT_FILES = options.extra_input - OS = options.os - - if not OS: - if sys.platform == 'darwin': - OS = 'mac' - elif sys.platform.startswith('linux'): - OS = 'linux' - elif sys.platform in ('cygwin', 'win32'): - OS = 'win' - else: - OS = sys.platform - - if print_inputs and print_outputs: - parser.error('Please specify only one of "-i" or "-o".\n') - if print_inputs and not GRIT_DIR: - parser.error('Please specify "-g".\n') - if print_outputs and not INT_DIR: - parser.error('Please specify "-x".\n') - if not (print_inputs or print_outputs or (GRIT_DIR and INT_DIR)): - parser.error('Please specify both "-g" and "-x".\n') - - if print_inputs: - return list_inputs(locales) - - if print_outputs: - return list_outputs(locales) - - return repack_locales(locales) - -if __name__ == '__main__': - results = DoMain(sys.argv[1:]) - if results: - print results diff --git a/remoting/tools/build/remoting_localize.py b/remoting/tools/build/remoting_localize.py index 6a88884..8dc0538 100755 --- a/remoting/tools/build/remoting_localize.py +++ b/remoting/tools/build/remoting_localize.py @@ -542,10 +542,7 @@ def IsRtlLanguage(language): def NormalizeLanguageCode(language): - lang = language.replace('_', '-', 1) - if lang == 'en-US': - lang = 'en' - return lang + return language.replace('_', '-', 1) def GetDataPackageSuffix(language): @@ -642,12 +639,6 @@ class MessageMap: return lambda message: self.GetText(message) -# Use '@' as a delimiter for string templates instead of '$' to avoid unintended -# expansion when passing the string from GYP. -class GypTemplate(Template): - delimiter = '@' - - def Localize(source, locales, options): # Set the list of languages to use. languages = map(NormalizeLanguageCode, locales) @@ -710,13 +701,12 @@ def Localize(source, locales, options): # Generate a separate file per each locale if requested. outputs = [] if options.locale_output: - target = GypTemplate(options.locale_output) + target = Template(options.locale_output) for lang in languages: context['languages'] = [ lang ] context['language'] = lang context['pak_suffix'] = GetDataPackageSuffix(lang) context['json_suffix'] = GetJsonSuffix(lang) - message_map.SelectLanguage(lang) template_file_name = target.safe_substitute(context) outputs.append(template_file_name) diff --git a/remoting/tools/verify_resources.py b/remoting/tools/verify_resources.py index eb59b2f..4ffd494 100755 --- a/remoting/tools/verify_resources.py +++ b/remoting/tools/verify_resources.py @@ -62,7 +62,7 @@ def ExtractTagFromLine(file_type, line): # Javascript style m = re.search('/\*i18n-content\*/[\'"]([^\`"]*)[\'"]', line) if m: return m.group(1) - elif file_type == 'cc' or file_type == 'mm': + elif file_type == 'cc': # C++ style m = re.search('IDR_([A-Z0-9_]*)', line) if m: return m.group(1) @@ -89,7 +89,7 @@ def VerifyFile(filename, messages, used_tags): base_name, extension = os.path.splitext(filename) extension = extension[1:] - if extension not in ['js', 'cc', 'html', 'json', 'jinja2', 'mm']: + if extension not in ['js', 'cc', 'html', 'json', 'jinja2']: raise Exception("Unknown file type: %s" % extension) result = True diff --git a/remoting/unittests-Info.plist b/remoting/unittests-Info.plist deleted file mode 100644 index fcb8ee6..0000000 --- a/remoting/unittests-Info.plist +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleDevelopmentRegion</key> - <string>English</string> - <key>CFBundleExecutable</key> - <string>${EXECUTABLE_NAME}</string> - <key>CFBundleIdentifier</key> - <string>org.chromium.chromoting.remoting_unittests</string> - <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> - <key>CFBundlePackageType</key> - <string>BRPL</string> - <key>CFBundleShortVersionString</key> - <string>1.0.0.0</string> - <key>CFBundleVersion</key> - <string>1.0.0.0</string> - <key>CFBundleSignature</key> - <string>${CHROMIUM_CREATOR}</string> - <key>LSMinimumSystemVersion</key> - <string>10.5.0</string> -</dict> -</plist> diff --git a/remoting/webapp/build-webapp.py b/remoting/webapp/build-webapp.py index 384aaf1..d221d3d 100755 --- a/remoting/webapp/build-webapp.py +++ b/remoting/webapp/build-webapp.py @@ -124,23 +124,21 @@ def buildWebApp(buildtype, version, mimetype, destination, zip_path, plugin, # Copy all the locales, preserving directory structure destination_locales = os.path.join(destination, "_locales") os.mkdir(destination_locales , 0775) - remoting_locales = os.path.join(destination, "remoting_locales") - os.mkdir(remoting_locales , 0775) + locale_dir = "/_locales/" for current_locale in locales: - extension = os.path.splitext(current_locale)[1] - if extension == '.json': - locale_id = os.path.split(os.path.split(current_locale)[0])[1] - destination_dir = os.path.join(destination_locales, locale_id) - destination_file = os.path.join(destination_dir, - os.path.split(current_locale)[1]) - os.mkdir(destination_dir, 0775) - shutil.copy2(current_locale, destination_file) - elif extension == '.pak': - destination_file = os.path.join(remoting_locales, - os.path.split(current_locale)[1]) - shutil.copy2(current_locale, destination_file) - else: - raise Exception("Unknown extension: " + current_locale); + pos = current_locale.find(locale_dir) + if (pos == -1): + raise Exception("Missing locales directory in " + current_locale) + subtree = current_locale[pos + len(locale_dir):] + pos = subtree.find("/") + if (pos == -1): + raise Exception("Malformed locale: " + current_locale) + locale_id = subtree[:pos] + messages = subtree[pos+1:] + destination_dir = os.path.join(destination_locales, locale_id) + destination_file = os.path.join(destination_dir, messages) + os.mkdir(destination_dir, 0775) + shutil.copy2(current_locale, destination_file) # Create fake plugin files to appease the manifest checker. # It requires that if there is a plugin listed in the manifest that |