summaryrefslogtreecommitdiffstats
path: root/chrome/service/service_main.cc
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-10 18:45:40 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-10 18:45:40 +0000
commit2b610dd17148a71cad5da51b3eabf31d2cdc80c7 (patch)
tree348566efe4aa3220c4197df3b38d0ddce3d4e1a4 /chrome/service/service_main.cc
parentba70635dfed6674b8a87d581bb3241d1765cdafe (diff)
downloadchromium_src-2b610dd17148a71cad5da51b3eabf31d2cdc80c7.zip
chromium_src-2b610dd17148a71cad5da51b3eabf31d2cdc80c7.tar.gz
chromium_src-2b610dd17148a71cad5da51b3eabf31d2cdc80c7.tar.bz2
Resubmit "Start chromoting host in the service process though a method call"
This change exposes method calls to configure the chromoting host and allow it to be started from a method. This will allow us to use IPC message to start the chromoting host. TEST=unit_tests --gtest_filter=ServiceProcess* BUG=50243, 50244 Review URL: http://codereview.chromium.org/3105002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55593 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/service/service_main.cc')
-rw-r--r--chrome/service/service_main.cc58
1 files changed, 1 insertions, 57 deletions
diff --git a/chrome/service/service_main.cc b/chrome/service/service_main.cc
index 8994c12..2670c5c 100644
--- a/chrome/service/service_main.cc
+++ b/chrome/service/service_main.cc
@@ -11,22 +11,6 @@
#include "chrome/service/cloud_print/cloud_print_proxy.h"
#include "chrome/service/service_process.h"
-#if defined(ENABLE_REMOTING)
-#include "remoting/host/json_host_config.h"
-#include "remoting/host/chromoting_host.h"
-#include "remoting/host/chromoting_host_context.h"
-
-// This method is called as a signal that the Chromoting Host Process is
-// shutting down because of failure or a request made by the user.
-// We'll then post a task to |message_loop| to stop the chromoting host
-// context to finish the final cleanup.
-static void OnChromotingHostShutdown(
- MessageLoop* message_loop, remoting::ChromotingHostContext* context) {
- message_loop->PostTask(FROM_HERE,
- NewRunnableMethod(context, &remoting::ChromotingHostContext::Stop));
-}
-#endif
-
// Mainline routine for running as the service process.
int ServiceProcessMain(const MainFunctionParams& parameters) {
MessageLoopForUI main_message_loop;
@@ -40,7 +24,7 @@ int ServiceProcessMain(const MainFunctionParams& parameters) {
#endif // defined(OS_WIN)
ServiceProcess service_process;
- service_process.Initialize();
+ service_process.Initialize(&main_message_loop);
// Enable Cloud Print if needed.
if (parameters.command_line_.HasSwitch(switches::kEnableCloudPrintProxy)) {
@@ -50,47 +34,7 @@ int ServiceProcessMain(const MainFunctionParams& parameters) {
service_process.GetCloudPrintProxy()->EnableForUser(lsid);
}
-#if defined(ENABLE_REMOTING)
- // Enable Chromoting Host if needed.
- // TODO(hclam): Merge this config file with Cloud Printing.
- // TODO(hclam): There is only start but not stop of the chromoting host
- // process.
- FilePath user_data_dir;
- PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
- FilePath chromoting_config_path =
- user_data_dir.Append(FILE_PATH_LITERAL(".ChromotingConfig.json"));
- scoped_refptr<remoting::JsonHostConfig> chromoting_config;
- scoped_ptr<remoting::ChromotingHostContext> chromoting_context;
- scoped_refptr<remoting::ChromotingHost> chromoting_host;
- if (parameters.command_line_.HasSwitch(switches::kEnableRemoting)) {
- chromoting_config = new remoting::JsonHostConfig(
- chromoting_config_path,
- service_process.file_thread()->message_loop_proxy());
- if (!chromoting_config->Read()) {
- LOG(ERROR) << "Failed to read chromoting config file.";
- } else {
- chromoting_context.reset(new remoting::ChromotingHostContext());
-
- // Create the Chromoting Host Process with the context and config.
- chromoting_host = service_process.CreateChromotingHost(
- chromoting_context.get(), chromoting_config);
-
- // And start the context and the host process.
- chromoting_context->Start();
-
- // When ChromotingHost is shutdown because of failure or a request that
- // we made. ShutdownChromotingTask() is calls.
- // ShutdownChromotingTask() will then post a task to
- // |main_message_loop| to shutdown the chromoting context.
- chromoting_host->Start(
- NewRunnableFunction(&OnChromotingHostShutdown,
- &main_message_loop, chromoting_context.get()));
- }
- }
-#endif
-
MessageLoop::current()->Run();
service_process.Teardown();
-
return 0;
}