summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorweitaosu@chromium.org <weitaosu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-25 17:46:40 +0000
committerweitaosu@chromium.org <weitaosu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-25 17:46:40 +0000
commit39073fd86f92a429b1e3b571dbffd45ca9625fbb (patch)
tree705a0ac1532a4e907179a86b552beb30a63fc34a
parent5ccc6ee339e62d35a91f57d1df82bec0d4576592 (diff)
downloadchromium_src-39073fd86f92a429b1e3b571dbffd45ca9625fbb.zip
chromium_src-39073fd86f92a429b1e3b571dbffd45ca9625fbb.tar.gz
chromium_src-39073fd86f92a429b1e3b571dbffd45ca9625fbb.tar.bz2
Moving me2me native messaging host implementation to remoting_core on Windows.
This significantly reduces the size of remoting_native_messaging_host.exe and thus the download size of the Windows host package. The size of the debug binary was reduced to 440k from 17M. BUG=325567 Review URL: https://codereview.chromium.org/166203003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@253186 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--remoting/host/host_main.cc20
-rw-r--r--remoting/host/host_main.h1
-rw-r--r--remoting/host/setup/me2me_native_messaging_host_entry_point.cc9
-rw-r--r--remoting/host/setup/me2me_native_messaging_host_main.cc12
-rw-r--r--remoting/host/setup/me2me_native_messaging_host_main.h17
-rw-r--r--remoting/remoting_host.gypi66
-rw-r--r--remoting/remoting_host_win.gypi27
-rw-r--r--remoting/remoting_test.gypi2
8 files changed, 87 insertions, 67 deletions
diff --git a/remoting/host/host_main.cc b/remoting/host/host_main.cc
index 2e7dc66..9a19b46f 100644
--- a/remoting/host/host_main.cc
+++ b/remoting/host/host_main.cc
@@ -52,11 +52,8 @@ const char kProcessTypeController[] = "controller";
const char kProcessTypeDaemon[] = "daemon";
const char kProcessTypeDesktop[] = "desktop";
const char kProcessTypeHost[] = "host";
-const char kProcessTypeNativeMessagingHost[] = "native_messaging_host";
const char kProcessTypeRdpDesktopSession[] = "rdp_desktop_session";
-const char kExtensionOriginPrefix[] = "chrome-extension://";
-
namespace {
typedef int (*MainRoutineFn)();
@@ -146,8 +143,6 @@ MainRoutineFn SelectMainRoutine(const std::string& process_type) {
main_routine = &ElevatedControllerMain;
} else if (process_type == kProcessTypeRdpDesktopSession) {
main_routine = &RdpDesktopSessionMain;
- } else if (process_type == kProcessTypeNativeMessagingHost) {
- main_routine = &Me2MeNativeMessagingHostMain;
#endif // defined(OS_WIN)
}
@@ -211,21 +206,6 @@ int HostMain(int argc, char** argv) {
std::string process_type = kProcessTypeHost;
if (command_line->HasSwitch(kProcessTypeSwitchName)) {
process_type = command_line->GetSwitchValueASCII(kProcessTypeSwitchName);
- } else {
- // Assume that it is the native messaging host starting if "--type" is
- // missing and the first argument looks like an origin that represents
- // an extension.
- CommandLine::StringVector args = command_line->GetArgs();
- if (!args.empty()) {
-#if defined(OS_WIN)
- std::string origin = base::UTF16ToUTF8(args[0]);
-#else
- std::string origin = args[0];
-#endif
- if (StartsWithASCII(origin, kExtensionOriginPrefix, true)) {
- process_type = kProcessTypeNativeMessagingHost;
- }
- }
}
MainRoutineFn main_routine = SelectMainRoutine(process_type);
diff --git a/remoting/host/host_main.h b/remoting/host/host_main.h
index 95ac3e9..527e4b3 100644
--- a/remoting/host/host_main.h
+++ b/remoting/host/host_main.h
@@ -20,7 +20,6 @@ extern const char kProcessTypeController[];
extern const char kProcessTypeDaemon[];
extern const char kProcessTypeDesktop[];
extern const char kProcessTypeHost[];
-extern const char kProcessTypeNativeMessagingHost[];
extern const char kProcessTypeRdpDesktopSession[];
// The common entry point exported from remoting_core.dll. It uses
diff --git a/remoting/host/setup/me2me_native_messaging_host_entry_point.cc b/remoting/host/setup/me2me_native_messaging_host_entry_point.cc
new file mode 100644
index 0000000..c49b261
--- /dev/null
+++ b/remoting/host/setup/me2me_native_messaging_host_entry_point.cc
@@ -0,0 +1,9 @@
+// Copyright 2014 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/setup/me2me_native_messaging_host_main.h"
+
+int main(int argc, char** argv) {
+ return remoting::Me2MeNativeMessagingHostMain(argc, argv);
+}
diff --git a/remoting/host/setup/me2me_native_messaging_host_main.cc b/remoting/host/setup/me2me_native_messaging_host_main.cc
index ac929b8..7326cc7 100644
--- a/remoting/host/setup/me2me_native_messaging_host_main.cc
+++ b/remoting/host/setup/me2me_native_messaging_host_main.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "remoting/host/setup/me2me_native_messaging_host_main.h"
+
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
@@ -51,7 +53,7 @@ bool IsProcessElevated() {
}
#endif // defined(OS_WIN)
-int Me2MeNativeMessagingHostMain() {
+int StartMe2MeNativeMessagingHost() {
// Mac OS X requires that the main thread be a UI message loop in order to
// receive distributed notifications from the System Preferences pane. An
// IO thread is needed for the pairing registry and URL context getter.
@@ -213,14 +215,14 @@ int Me2MeNativeMessagingHostMain() {
return kSuccessExitCode;
}
-} // namespace remoting
-
-int main(int argc, char** argv) {
+int Me2MeNativeMessagingHostMain(int argc, char** argv) {
// This object instance is required by Chrome code (such as MessageLoop).
base::AtExitManager exit_manager;
CommandLine::Init(argc, argv);
remoting::InitHostLogging();
- return remoting::Me2MeNativeMessagingHostMain();
+ return StartMe2MeNativeMessagingHost();
}
+
+} // namespace remoting
diff --git a/remoting/host/setup/me2me_native_messaging_host_main.h b/remoting/host/setup/me2me_native_messaging_host_main.h
new file mode 100644
index 0000000..c3fce61
--- /dev/null
+++ b/remoting/host/setup/me2me_native_messaging_host_main.h
@@ -0,0 +1,17 @@
+// Copyright 2014 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_SETUP_ME2ME_NATIVE_MESSAGING_HOST_MAIN_H_
+#define REMOTING_HOST_SETUP_ME2ME_NATIVE_MESSAGING_HOST_MAIN_H_
+
+#include "remoting/host/host_export.h"
+
+namespace remoting {
+
+// The me2me native messaging host entry point exported from remoting_core.dll.
+HOST_EXPORT int Me2MeNativeMessagingHostMain(int argc, char** argv);
+
+} // namespace remoting
+
+#endif // REMOTING_HOST_SETUP_ME2ME_NATIVE_MESSAGING_HOST_MAIN_H_
diff --git a/remoting/remoting_host.gypi b/remoting/remoting_host.gypi
index ed1dc33..4639e18 100644
--- a/remoting/remoting_host.gypi
+++ b/remoting/remoting_host.gypi
@@ -413,8 +413,6 @@
'host/setup/daemon_controller_delegate_win.h',
'host/setup/daemon_installer_win.cc',
'host/setup/daemon_installer_win.h',
- 'host/setup/me2me_native_messaging_host.cc',
- 'host/setup/me2me_native_messaging_host.h',
'host/setup/oauth_client.cc',
'host/setup/oauth_client.h',
'host/setup/oauth_helper.cc',
@@ -564,44 +562,6 @@
],
}, # end of target 'remoting_it2me_host_static'
{
- 'target_name': 'remoting_me2me_native_messaging_host',
- 'type': 'executable',
- 'product_name': 'remoting_native_messaging_host',
- 'variables': { 'enable_wexit_time_destructors': 1, },
- 'dependencies': [
- '../base/base.gyp:base',
- 'remoting_host',
- 'remoting_host_setup_base',
- 'remoting_native_messaging_base',
- ],
- 'sources': [
- 'host/setup/me2me_native_messaging_host_main.cc',
- ],
- 'conditions': [
- ['OS=="linux" and linux_use_tcmalloc==1', {
- 'dependencies': [
- '../base/allocator/allocator.gyp:allocator',
- ],
- }],
- ['OS=="win"', {
- 'defines' : [
- 'BINARY=BINARY_NATIVE_MESSAGING_HOST',
- ],
- 'dependencies': [
- 'remoting_windows_resources',
- ],
- 'sources': [
- '<(SHARED_INTERMEDIATE_DIR)/remoting/version.rc',
- ],
- 'msvs_settings': {
- 'VCLinkerTool': {
- 'SubSystem': '1', # /SUBSYSTEM:CONSOLE
- },
- },
- }],
- ],
- }, # end of target 'remoting_me2me_native_messaging_host'
- {
'target_name': 'remoting_it2me_native_messaging_host',
'type': 'executable',
'variables': { 'enable_wexit_time_destructors': 1, },
@@ -845,6 +805,32 @@
}], # OS=linux
], # end of 'conditions'
}, # end of target 'remoting_me2me_host'
+ {
+ 'target_name': 'remoting_me2me_native_messaging_host',
+ 'type': 'executable',
+ 'product_name': 'remoting_native_messaging_host',
+ 'variables': { 'enable_wexit_time_destructors': 1, },
+ 'dependencies': [
+ '../base/base.gyp:base',
+ 'remoting_host',
+ 'remoting_host_setup_base',
+ 'remoting_native_messaging_base',
+ ],
+ 'sources': [
+ 'host/setup/me2me_native_messaging_host.cc',
+ 'host/setup/me2me_native_messaging_host.h',
+ 'host/setup/me2me_native_messaging_host_entry_point.cc',
+ 'host/setup/me2me_native_messaging_host_main.cc',
+ 'host/setup/me2me_native_messaging_host_main.h',
+ ],
+ 'conditions': [
+ ['OS=="linux" and linux_use_tcmalloc==1', {
+ 'dependencies': [
+ '../base/allocator/allocator.gyp:allocator',
+ ],
+ }],
+ ],
+ }, # end of target 'remoting_me2me_native_messaging_host'
], # end of 'targets'
}], # OS!="win"
diff --git a/remoting/remoting_host_win.gypi b/remoting/remoting_host_win.gypi
index faeb3de..c1ff262 100644
--- a/remoting/remoting_host_win.gypi
+++ b/remoting/remoting_host_win.gypi
@@ -203,7 +203,10 @@
'host/remoting_me2me_host.cc',
'host/sas_injector.h',
'host/sas_injector_win.cc',
+ 'host/setup/me2me_native_messaging_host.cc',
+ 'host/setup/me2me_native_messaging_host.h',
'host/setup/me2me_native_messaging_host_main.cc',
+ 'host/setup/me2me_native_messaging_host_main.h',
'host/verify_config_window_win.cc',
'host/verify_config_window_win.h',
'host/win/chromoting_module.cc',
@@ -316,13 +319,35 @@
'VCLinkerTool': {
'EntryPointSymbol': 'HostEntryPoint',
'IgnoreAllDefaultLibraries': 'true',
- 'ImportLibrary': '$(OutDir)\\lib\\remoting_host_exe.lib',
'OutputFile': '$(OutDir)\\remoting_host.exe',
'SubSystem': '2', # /SUBSYSTEM:WINDOWS
},
},
}, # end of target 'remoting_host_exe'
{
+ 'target_name': 'remoting_me2me_native_messaging_host',
+ 'type': 'executable',
+ 'product_name': 'remoting_native_messaging_host',
+ 'variables': { 'enable_wexit_time_destructors': 1, },
+ 'defines' : [
+ 'BINARY=BINARY_NATIVE_MESSAGING_HOST',
+ ],
+ 'dependencies': [
+ 'remoting_core',
+ 'remoting_windows_resources',
+ ],
+ 'sources': [
+ '<(SHARED_INTERMEDIATE_DIR)/remoting/version.rc',
+ 'host/setup/me2me_native_messaging_host_entry_point.cc',
+ ],
+ 'msvs_settings': {
+ 'VCLinkerTool': {
+ 'IgnoreAllDefaultLibraries': 'true',
+ 'SubSystem': '1', # /SUBSYSTEM:CONSOLE
+ },
+ },
+ }, # end of target 'remoting_me2me_native_messaging_host'
+ {
'target_name': 'remoting_host_messages',
'type': 'none',
'dependencies': [
diff --git a/remoting/remoting_test.gypi b/remoting/remoting_test.gypi
index 0979c9b..2ef35a4a 100644
--- a/remoting/remoting_test.gypi
+++ b/remoting/remoting_test.gypi
@@ -100,6 +100,8 @@
'host/register_support_host_request_unittest.cc',
'host/remote_input_filter_unittest.cc',
'host/resizing_host_observer_unittest.cc',
+ 'host/setup/me2me_native_messaging_host.cc',
+ 'host/setup/me2me_native_messaging_host.h',
'host/screen_capturer_fake.cc',
'host/screen_capturer_fake.h',
'host/screen_resolution_unittest.cc',