diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-18 22:15:09 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-18 22:15:09 +0000 |
commit | b9eb8b20e029cf288b36da336e4c5611c9a65a55 (patch) | |
tree | 4134579298bc01ebbedc060f511caa40902a8d84 /chrome/browser | |
parent | c3265d8866e5b0d2c1b129e4da685755a35a84b2 (diff) | |
download | chromium_src-b9eb8b20e029cf288b36da336e4c5611c9a65a55.zip chromium_src-b9eb8b20e029cf288b36da336e4c5611c9a65a55.tar.gz chromium_src-b9eb8b20e029cf288b36da336e4c5611c9a65a55.tar.bz2 |
Revert 56600 - ServiceProcessControlBrowserTest.LaunchAndIPC crashes.
Start/stop service process when browser starts and stop
Save the information that the setup of remoting has completed.
After setup has been completed we start and stop service process when
--enable-remoting presents when browser starts.
Also save the information in the service process that host is registered
and ready to be used. Again start chromoting host automatically once
the host registration is done.
Review URL: http://codereview.chromium.org/3185015
TBR=hclam@chromium.org
Review URL: http://codereview.chromium.org/3107024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56610 0039d316-1c4b-4281-b951-d872f2087c98
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, 21 insertions, 50 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 3f10c59..ac91d86 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -1965,7 +1965,6 @@ 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 108f6f1..b5fa926 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -59,8 +59,6 @@ #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" @@ -75,7 +73,6 @@ #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" @@ -1369,19 +1366,6 @@ 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 984bc53..f49e335 100644 --- a/chrome/browser/remoting/remoting_resources_source.cc +++ b/chrome/browser/remoting/remoting_resources_source.cc @@ -51,7 +51,9 @@ 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", ""); + localized_strings.SetString("introduction", + ASCIIToUTF16("Remoting ") + + l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); 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 1f4411b..27deaff 100644 --- a/chrome/browser/remoting/remoting_setup_flow.cc +++ b/chrome/browser/remoting/remoting_setup_flow.cc @@ -68,6 +68,14 @@ 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. @@ -160,24 +168,13 @@ 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; - 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"); - } - + GetArgsForGaiaLogin(&args); std::string json_args; base::JSONWriter::Write(&args, false, &json_args); @@ -197,7 +194,7 @@ void OpenRemotingSetupDialog(Profile* profile) { RemotingSetupFlow::Run(profile->GetOriginalProfile()); } -// TODO(hclam): Need to refcount RemotingSetupFlow. I need to fix -// lifetime of objects. +// TODO(hclam): Need to refcount RemotingSetupFlow. I need to lifetime of +// objects are all correct. 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 70311f8..88a365c 100644 --- a/chrome/browser/remoting/resources/setup_done.html +++ b/chrome/browser/remoting/resources/setup_done.html @@ -44,7 +44,8 @@ html[os='mac'] input[type='submit'] { </style> <script> function setShowFirstTimeSetupSummary() { - // TODO(hclam): Show the information for the first time setup. + document.getElementById("summary").innerHTML = + templateData['firsttimesetupsummary']; } function setMessage(msg) { document.getElementById('msgContent').innerHTML = msg; @@ -56,7 +57,8 @@ html[os='mac'] input[type='submit'] { </head> <body i18n-values=".style.fontFamily:fontfamily"> <div class="remoting-header" i18n-content="success"></div> - <div id="msgContent">Setup completed.</div> + <div id="msgContent"></div> + <div id="summary" i18n-content="setupsummary"></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 5979084..9b76dc7 100644 --- a/chrome/browser/service/service_process_control.cc +++ b/chrome/browser/service/service_process_control.cc @@ -109,7 +109,6 @@ 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, @@ -121,10 +120,8 @@ void ServiceProcessControl::ConnectInternal() { void ServiceProcessControl::Launch(Task* task) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); if (channel_.get()) { - if (task) { - task->Run(); - delete task; - } + task->Run(); + delete task; return; } @@ -165,7 +162,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 if (task) { + } else { // If we don't have process handle that means launching the service process // has failed. task->Run(); @@ -186,8 +183,6 @@ 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(); } @@ -195,8 +190,6 @@ 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 6c946b4..821de9a 100644 --- a/chrome/browser/service/service_process_control_manager.cc +++ b/chrome/browser/service/service_process_control_manager.cc @@ -36,12 +36,6 @@ 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_); } |