diff options
Diffstat (limited to 'chrome/browser')
| -rw-r--r-- | chrome/browser/browser.cc | 1 | ||||
| -rw-r--r-- | chrome/browser/browser_main.cc | 16 | ||||
| -rw-r--r-- | chrome/browser/remoting/remoting_resources_source.cc | 4 | ||||
| -rw-r--r-- | chrome/browser/remoting/remoting_setup_flow.cc | 25 | ||||
| -rw-r--r-- | chrome/browser/remoting/resources/setup_done.html | 6 | ||||
| -rw-r--r-- | chrome/browser/service/service_process_control.cc | 13 | ||||
| -rw-r--r-- | chrome/browser/service/service_process_control_manager.cc | 6 |
7 files changed, 50 insertions, 21 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index ac91d86..3f10c59 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -1965,6 +1965,7 @@ void Browser::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(prefs::kWebAppCreateInQuickLaunchBar, true); prefs->RegisterBooleanPref(prefs::kUseVerticalTabs, false); prefs->RegisterBooleanPref(prefs::kEnableTranslate, true); + prefs->RegisterBooleanPref(prefs::kRemotingHasSetupCompleted, false); } // static diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index b5fa926..108f6f1 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -59,6 +59,8 @@ #include "chrome/browser/renderer_host/resource_dispatcher_host.h" #include "chrome/browser/search_engines/template_url_model.h" #include "chrome/browser/search_engines/template_url_prepopulate_data.h" +#include "chrome/browser/service/service_process_control.h" +#include "chrome/browser/service/service_process_control_manager.h" #include "chrome/browser/shell_integration.h" #include "chrome/browser/translate/translate_manager.h" #include "chrome/common/child_process.h" @@ -73,6 +75,7 @@ #include "chrome/common/net/net_resource_provider.h" #include "chrome/common/pref_names.h" #include "chrome/common/result_codes.h" +#include "chrome/common/service_process_type.h" #include "chrome/installer/util/google_update_settings.h" #include "chrome/installer/util/master_preferences.h" #include "grit/app_locale_settings.h" @@ -1366,6 +1369,19 @@ int BrowserMain(const MainFunctionParams& parameters) { ChildProcess::WaitForDebugger(L"Browser"); } + // If remoting or cloud print proxy is enabled and setup has been completed + // we start the service process here. + // The prerequisite for running the service process is that we have IO, UI + // and PROCESS_LAUNCHER threads up and running. + // TODO(hclam): Need to check for cloud print proxy too. + if (parsed_command_line.HasSwitch(switches::kEnableRemoting)) { + if (user_prefs->GetBoolean(prefs::kRemotingHasSetupCompleted)) { + ServiceProcessControl* control = ServiceProcessControlManager::instance() + ->GetProcessControl(profile, kServiceProcessRemoting); + control->Launch(NULL); + } + } + int result_code = ResultCodes::NORMAL_EXIT; if (parameters.ui_task) { // We are in test mode. Run one task and enter the main message loop. diff --git a/chrome/browser/remoting/remoting_resources_source.cc b/chrome/browser/remoting/remoting_resources_source.cc index f49e335..984bc53 100644 --- a/chrome/browser/remoting/remoting_resources_source.cc +++ b/chrome/browser/remoting/remoting_resources_source.cc @@ -51,9 +51,7 @@ void RemotingResourcesSource::StartDataRequest(const std::string& path_raw, localized_strings.SetString("settingupsync", l10n_util::GetStringUTF16(IDS_SYNC_LOGIN_SETTING_UP_SYNC)); - localized_strings.SetString("introduction", - ASCIIToUTF16("Remoting ") + - l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); + localized_strings.SetString("introduction", ""); localized_strings.SetString("signinprefix", l10n_util::GetStringUTF16(IDS_SYNC_LOGIN_SIGNIN_PREFIX)); localized_strings.SetString("signinsuffix", diff --git a/chrome/browser/remoting/remoting_setup_flow.cc b/chrome/browser/remoting/remoting_setup_flow.cc index 27deaff..1f4411b 100644 --- a/chrome/browser/remoting/remoting_setup_flow.cc +++ b/chrome/browser/remoting/remoting_setup_flow.cc @@ -68,14 +68,6 @@ void RemotingSetupFlow::OnDialogClosed(const std::string& json_retval) { delete this; } -// static -void RemotingSetupFlow::GetArgsForGaiaLogin(DictionaryValue* args) { - args->SetString("iframeToShow", "login"); - args->SetString("user", ""); - args->SetInteger("error", 0); - args->SetBoolean("editable_user", true); -} - void RemotingSetupFlow::GetDOMMessageHandlers( std::vector<DOMMessageHandler*>* handlers) const { // Create the message handler only after we are asked. @@ -168,13 +160,24 @@ void RemotingSetupFlow::OnProcessLaunched() { process_control_->EnableRemotingWithTokens(login_, remoting_token_, sync_token_); message_handler_->ShowSetupDone(); + + // Save the preference that we have completed the setup of remoting. + profile_->GetPrefs()->SetBoolean(prefs::kRemotingHasSetupCompleted, true); } // static RemotingSetupFlow* RemotingSetupFlow::Run(Profile* profile) { // Set the arguments for showing the gaia login page. DictionaryValue args; - GetArgsForGaiaLogin(&args); + args.SetString("iframeToShow", "login"); + args.SetString("user", ""); + args.SetInteger("error", 0); + args.SetBoolean("editable_user", true); + + if (profile->GetPrefs()->GetBoolean(prefs::kRemotingHasSetupCompleted)) { + args.SetString("iframeToShow", "done"); + } + std::string json_args; base::JSONWriter::Write(&args, false, &json_args); @@ -194,7 +197,7 @@ void OpenRemotingSetupDialog(Profile* profile) { RemotingSetupFlow::Run(profile->GetOriginalProfile()); } -// TODO(hclam): Need to refcount RemotingSetupFlow. I need to lifetime of -// objects are all correct. +// TODO(hclam): Need to refcount RemotingSetupFlow. I need to fix +// lifetime of objects. DISABLE_RUNNABLE_METHOD_REFCOUNT(RemotingSetupFlow); DISABLE_RUNNABLE_METHOD_REFCOUNT(RemotingSetupMessageHandler); diff --git a/chrome/browser/remoting/resources/setup_done.html b/chrome/browser/remoting/resources/setup_done.html index 88a365c..70311f8 100644 --- a/chrome/browser/remoting/resources/setup_done.html +++ b/chrome/browser/remoting/resources/setup_done.html @@ -44,8 +44,7 @@ html[os='mac'] input[type='submit'] { </style> <script> function setShowFirstTimeSetupSummary() { - document.getElementById("summary").innerHTML = - templateData['firsttimesetupsummary']; + // TODO(hclam): Show the information for the first time setup. } function setMessage(msg) { document.getElementById('msgContent').innerHTML = msg; @@ -57,8 +56,7 @@ html[os='mac'] input[type='submit'] { </head> <body i18n-values=".style.fontFamily:fontfamily"> <div class="remoting-header" i18n-content="success"></div> - <div id="msgContent"></div> - <div id="summary" i18n-content="setupsummary"></div> + <div id="msgContent">Setup completed.</div> <div class="remoting-footer"> <input id="close" type="submit" i18n-values="value:okay" onclick='chrome.send("DialogClose", [""])' /> diff --git a/chrome/browser/service/service_process_control.cc b/chrome/browser/service/service_process_control.cc index 9b76dc7..5979084 100644 --- a/chrome/browser/service/service_process_control.cc +++ b/chrome/browser/service/service_process_control.cc @@ -109,6 +109,7 @@ void ServiceProcessControl::ConnectInternal() { base::Thread* io_thread = g_browser_process->io_thread(); // TODO(hclam): Determine the the channel id from profile and type. + // TODO(hclam): Handle error connecting to channel. const std::string channel_id = GetServiceProcessChannelName(type_); channel_.reset( new IPC::SyncChannel(channel_id, IPC::Channel::MODE_CLIENT, this, NULL, @@ -120,8 +121,10 @@ void ServiceProcessControl::ConnectInternal() { void ServiceProcessControl::Launch(Task* task) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); if (channel_.get()) { - task->Run(); - delete task; + if (task) { + task->Run(); + delete task; + } return; } @@ -162,7 +165,7 @@ void ServiceProcessControl::OnProcessLaunched(Task* task) { // After we have successfully created the service process we try to connect // to it. The launch task is transfered to a connect task. ConnectInternal(); - } else { + } else if (task) { // If we don't have process handle that means launching the service process // has failed. task->Run(); @@ -183,6 +186,8 @@ void ServiceProcessControl::OnMessageReceived(const IPC::Message& message) { void ServiceProcessControl::OnChannelConnected(int32 peer_pid) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); + if (!connect_done_task_.get()) + return; connect_done_task_->Run(); connect_done_task_.reset(); } @@ -190,6 +195,8 @@ void ServiceProcessControl::OnChannelConnected(int32 peer_pid) { void ServiceProcessControl::OnChannelError() { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); channel_.reset(); + if (!connect_done_task_.get()) + return; connect_done_task_->Run(); connect_done_task_.reset(); } diff --git a/chrome/browser/service/service_process_control_manager.cc b/chrome/browser/service/service_process_control_manager.cc index 821de9a..6c946b4 100644 --- a/chrome/browser/service/service_process_control_manager.cc +++ b/chrome/browser/service/service_process_control_manager.cc @@ -36,6 +36,12 @@ ServiceProcessControl* ServiceProcessControlManager::GetProcessControl( } void ServiceProcessControlManager::Shutdown() { + // TODO(hclam): Normally we should just delete the list but for simplicity + // we also shutdown the service processes. + for (ServiceProcessControlList::iterator i = process_control_list_.begin(); + i != process_control_list_.end(); ++i) { + (*i)->Shutdown(); + } STLDeleteElements(&process_control_list_); } |
