diff options
author | scottbyer@chromium.org <scottbyer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-27 18:38:25 +0000 |
---|---|---|
committer | scottbyer@chromium.org <scottbyer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-27 18:38:25 +0000 |
commit | 0233759c8f0a17a73899bfed59ae21a777a3d637 (patch) | |
tree | 80d589261b7970c8980eb741fb69430a82dce892 /chrome | |
parent | c5a272dbd00c74dffe922523811a4ecbcd7f882b (diff) | |
download | chromium_src-0233759c8f0a17a73899bfed59ae21a777a3d637.zip chromium_src-0233759c8f0a17a73899bfed59ae21a777a3d637.tar.gz chromium_src-0233759c8f0a17a73899bfed59ae21a777a3d637.tar.bz2 |
Cloud print proxy management UI.
Based in the Under-the-Hood section of options, this UI allows mere mortals to turn on and off the cloud print proxy. Currently working on Windows only, behind a flag.
BUG=none
TEST=Open up the options, turn CPP on and off.
Review URL: http://codereview.chromium.org/3450021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60684 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/generated_resources.grd | 24 | ||||
-rw-r--r-- | chrome/browser/browser.cc | 6 | ||||
-rw-r--r-- | chrome/browser/browser.h | 1 | ||||
-rw-r--r-- | chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc | 430 | ||||
-rw-r--r-- | chrome/browser/printing/cloud_print/cloud_print_setup_flow.h | 132 | ||||
-rw-r--r-- | chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.cc | 47 | ||||
-rw-r--r-- | chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.h | 38 | ||||
-rw-r--r-- | chrome/browser/service/service_process_control.cc | 33 | ||||
-rw-r--r-- | chrome/browser/service/service_process_control.h | 19 | ||||
-rw-r--r-- | chrome/browser/views/options/advanced_contents_view.cc | 162 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 4 | ||||
-rw-r--r-- | chrome/common/net/gaia/gaia_constants.cc | 2 | ||||
-rw-r--r-- | chrome/common/net/gaia/gaia_constants.h | 1 | ||||
-rw-r--r-- | chrome/common/service_messages_internal.h | 13 | ||||
-rw-r--r-- | chrome/service/service_ipc_server.cc | 8 | ||||
-rw-r--r-- | chrome/service/service_ipc_server.h | 2 |
16 files changed, 907 insertions, 15 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 76c87d4..8fa976a 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -4942,6 +4942,11 @@ Keep your key file in a safe place. You will need it to create new versions of y Print </message> + <!-- Cloud Print proxy strings --> + <message name="IDS_CLOUD_PRINT_SETUP_DIALOG_TITLE" desc="Title of the cloud print setup dialog."> + Set up cloud printing + </message> + <!-- Load State --> <message name="IDS_LOAD_STATE_IDLE"></message> <message name="IDS_LOAD_STATE_WAITING_FOR_CACHE"> @@ -6381,6 +6386,22 @@ Keep your key file in a safe place. You will need it to create new versions of y Change proxy settings </message> + <message name="IDS_OPTIONS_CLOUD_PRINT_PROXY_DISABLED_LABEL" desc="The label of the cloud print setup button when it hasn't been set up yet."> + <ph name="CLOUD_PRINT_NAME">Cloud Print</ph> lets you access this computer's printers from anywhere. Sign in to enable. + </message> + <message name="IDS_OPTIONS_CLOUD_PRINT_PROXY_DISABLED_BUTTON" desc="The label of the cloud proxy configure button when it hasn't been set up yet."> + Sign in to <ph name="CLOUD_PRINT_NAME">Cloud Print</ph> + </message> + <message name="IDS_OPTIONS_CLOUD_PRINT_PROXY_ENABLED_LABEL" desc="The label of the cloud print setup button when it has been set up."> + You are currently sharing your printers under the account <ph name="EMAIL">$1<ex>foo@bar.com</ex></ph> + </message> + <message name="IDS_OPTIONS_CLOUD_PRINT_PROXY_ENABLED_BUTTON" desc="The label of the cloud proxy configure button when it has been set up."> + Disable <ph name="CLOUD_PRINT_NAME">Cloud Print</ph> + </message> + <message name="IDS_OPTIONS_CLOUD_PRINT_PROXY_ENABLED_MANAGE_BUTTON" desc="The label of the link item for the cloud print management URL."> + Manage Print Settings... + </message> + <message name="IDS_OPTIONS_COOKIES_ACCEPT_LABEL" desc="The documentation string of the 'accept cookies' preference"> Cookie settings: </message> @@ -7163,6 +7184,9 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_OPTIONS_ADVANCED_SECTION_TITLE_TRANSLATE"> Translate </message> + <message name="IDS_OPTIONS_ADVANCED_SECTION_TITLE_CLOUD_PRINT"> + <ph name="CLOUD_PRINT_NAME">Cloud Print</ph> + </message> <!-- Script Timeout Dialog --> <message name="IDS_SCRIPT_TIMEOUT_DIALOG_TITLE" desc="Title of the script timeout dialog."> diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 4b74a78..2b20772 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -62,6 +62,7 @@ #include "chrome/browser/options_window.h" #include "chrome/browser/platform_util.h" #include "chrome/browser/prefs/pref_service.h" +#include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/renderer_host/site_instance.h" @@ -1931,6 +1932,10 @@ void Browser::OpenLanguageOptionsDialog() { } #endif +void Browser::OpenCloudPrintProxySetupDialog() { + CloudPrintSetupFlow::OpenDialog(profile_); +} + /////////////////////////////////////////////////////////////////////////////// // static @@ -1995,6 +2000,7 @@ void Browser::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(prefs::kUseVerticalTabs, false); prefs->RegisterBooleanPref(prefs::kEnableTranslate, true); prefs->RegisterBooleanPref(prefs::kRemotingHasSetupCompleted, false); + prefs->RegisterStringPref(prefs::kCloudPrintEmail, std::string()); } // static diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h index ecfef28..2ba9000 100644 --- a/chrome/browser/browser.h +++ b/chrome/browser/browser.h @@ -547,6 +547,7 @@ class Browser : public TabStripModelDelegate, void OpenLanguageOptionsDialog(); void OpenSystemOptionsDialog(); #endif + void OpenCloudPrintProxySetupDialog(); virtual void UpdateDownloadShelfVisibility(bool visible); diff --git a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc new file mode 100644 index 0000000..566fed4 --- /dev/null +++ b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc @@ -0,0 +1,430 @@ +// Copyright (c) 2010 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 "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" + +#include "app/gfx/font_util.h" +#include "base/json/json_writer.h" +#include "base/singleton.h" +#include "base/string_util.h" +#include "base/utf_string_conversions.h" +#include "base/values.h" +#include "chrome/browser/browser.h" +#include "chrome/browser/browser_list.h" +#include "chrome/browser/dom_ui/chrome_url_data_manager.h" +#include "chrome/browser/dom_ui/dom_ui_util.h" +#include "chrome/browser/platform_util.h" +#include "chrome/browser/prefs/pref_service.h" +#include "chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.h" +#include "chrome/browser/profile.h" +#include "chrome/browser/remoting/remoting_resources_source.h" +#include "chrome/browser/renderer_host/render_view_host.h" +#include "chrome/browser/service/service_process_control.h" +#include "chrome/browser/service/service_process_control_manager.h" +#include "chrome/browser/tab_contents/tab_contents.h" +#include "chrome/common/net/gaia/gaia_authenticator2.h" +#include "chrome/common/net/gaia/gaia_constants.h" +#include "chrome/common/net/gaia/google_service_auth_error.h" +#include "chrome/common/pref_names.h" +#include "chrome/common/service_messages.h" +#include "chrome/common/service_process_type.h" +#include "gfx/font.h" +#include "grit/locale_settings.h" + +static const wchar_t kLoginIFrameXPath[] = L"//iframe[@id='login']"; +static const wchar_t kDoneIframeXPath[] = L"//iframe[@id='done']"; + +//////////////////////////////////////////////////////////////////////////////// +// CloudPrintServiceProcessHelper +// +// This is a helper class to perform actions when the service process +// is connected or launched. The events are sent back to CloudPrintSetupFlow +// when the dialog is still active. CloudPrintSetupFlow can detach from this +// helper class when the dialog is closed. + +class CloudPrintServiceProcessHelper + : public base::RefCountedThreadSafe<CloudPrintServiceProcessHelper> { + public: + explicit CloudPrintServiceProcessHelper(CloudPrintSetupFlow* flow) + : flow_(flow) { + } + + void Detach() { + flow_ = NULL; + } + + void OnProcessLaunched() { + DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); + // If the flow is detached then show the done page. + if (!flow_) + return; + + flow_->OnProcessLaunched(); + } + + private: + CloudPrintSetupFlow* flow_; + + DISALLOW_COPY_AND_ASSIGN(CloudPrintServiceProcessHelper); +}; + +//////////////////////////////////////////////////////////////////////////////// +// CloudPrintServiceDisableTask +// +// This is a helper class to get the proxy service launched if it +// isn't, in order to properly inform it that it should be disabled. + +class CloudPrintServiceDisableTask + : public base::RefCountedThreadSafe<CloudPrintServiceDisableTask> { + public: + explicit CloudPrintServiceDisableTask(Profile* profile) + : profile_(profile), + process_control_(NULL) { + } + + void StartDisable() { + DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); + + process_control_ = + ServiceProcessControlManager::instance()->GetProcessControl( + profile_, + kServiceProcessCloudPrint); + + if (process_control_) { + // If the process isn't connected, launch it now. This will run + // the task whether the process is already launched or not, as + // long as it's able to connect back up. + process_control_->Launch( + NewRunnableMethod( + this, &CloudPrintServiceDisableTask::OnProcessLaunched)); + } + } + + void OnProcessLaunched() { + DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); + DCHECK(process_control_); + if (process_control_->is_connected()) + process_control_->Send(new ServiceMsg_DisableCloudPrintProxy()); + profile_->GetPrefs()->SetString(prefs::kCloudPrintEmail, std::string()); + } + + private: + Profile* profile_; + ServiceProcessControl* process_control_; + + DISALLOW_COPY_AND_ASSIGN(CloudPrintServiceDisableTask); +}; + +//////////////////////////////////////////////////////////////////////////////// +// CloudPrintServiceRefreshTask +// +// This is a helper class to perform a preferences refresh of the +// enablement state and registered e-mail from the cloud print proxy +// service. + +class CloudPrintServiceRefreshTask + : public base::RefCountedThreadSafe<CloudPrintServiceRefreshTask> { + public: + explicit CloudPrintServiceRefreshTask( + Profile* profile, + Callback2<bool, std::string>::Type* callback) + : profile_(profile), + process_control_(NULL), + callback_(callback) { + DCHECK(callback); + } + + void StartRefresh() { + DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); + + process_control_ = + ServiceProcessControlManager::instance()->GetProcessControl( + profile_, + kServiceProcessCloudPrint); + + if (process_control_) { + // If the process isn't connected, launch it now. This will run + // the task whether the process is already launched or not, as + // long as it's able to connect back up. + process_control_->Launch( + NewRunnableMethod( + this, &CloudPrintServiceRefreshTask::OnProcessLaunched)); + } + } + + void OnProcessLaunched() { + DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); + DCHECK(process_control_); + + if (callback_ != NULL) + process_control_->GetCloudPrintProxyStatus(callback_.release()); + } + + private: + Profile* profile_; + ServiceProcessControl* process_control_; + + // Callback that gets invoked when a status message is received from + // the cloud print proxy. + scoped_ptr<Callback2<bool, std::string>::Type> callback_; + + DISALLOW_COPY_AND_ASSIGN(CloudPrintServiceRefreshTask); +}; + +//////////////////////////////////////////////////////////////////////////////// +// CloudPrintSetupFlow implementation. + +// static +CloudPrintSetupFlow* CloudPrintSetupFlow::OpenDialog(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()->HasPrefPath(prefs::kCloudPrintEmail) && + !profile->GetPrefs()->GetString(prefs::kCloudPrintEmail).empty()) { + args.SetString("iframeToShow", "done"); + } + + std::string json_args; + base::JSONWriter::Write(&args, false, &json_args); + + // Create a browser to run the dialog. The new CloudPrintSetupFlow + // class takes ownership. + Browser* browser = Browser::CreateForPopup(profile); + DCHECK(browser); + + CloudPrintSetupFlow* flow = new CloudPrintSetupFlow(json_args, browser); + browser->BrowserShowHtmlDialog(flow, NULL); + return flow; +} + +// static +void CloudPrintSetupFlow::DisableCloudPrintProxy(Profile* profile) { + scoped_refptr<CloudPrintServiceDisableTask> refresh_task = + new CloudPrintServiceDisableTask(profile); + ChromeThread::PostTask( + ChromeThread::UI, FROM_HERE, + NewRunnableMethod(refresh_task.get(), + &CloudPrintServiceDisableTask::StartDisable)); +} + +// static +void CloudPrintSetupFlow::RefreshPreferencesFromService( + Profile* profile, + Callback2<bool, std::string>::Type* callback) { + scoped_refptr<CloudPrintServiceRefreshTask> refresh_task = + new CloudPrintServiceRefreshTask(profile, callback); + ChromeThread::PostTask( + ChromeThread::UI, FROM_HERE, + NewRunnableMethod(refresh_task.get(), + &CloudPrintServiceRefreshTask::StartRefresh)); +} + +CloudPrintSetupFlow::CloudPrintSetupFlow(const std::string& args, + Browser* browser) + : dom_ui_(NULL), + dialog_start_args_(args), + process_control_(NULL) { + // TODO(hclam): The data source should be added once. + browser_.reset(browser); + ChromeThread::PostTask( + ChromeThread::IO, FROM_HERE, + NewRunnableMethod(Singleton<ChromeURLDataManager>::get(), + &ChromeURLDataManager::AddDataSource, + make_scoped_refptr(new RemotingResourcesSource()))); +} + +CloudPrintSetupFlow::~CloudPrintSetupFlow() { +} + +void CloudPrintSetupFlow::Focus() { + // TODO(pranavk): implement this method. + NOTIMPLEMENTED(); +} + +/////////////////////////////////////////////////////////////////////////////// +// HtmlDialogUIDelegate implementation. +GURL CloudPrintSetupFlow::GetDialogContentURL() const { + return GURL("chrome://remotingresources/setup"); +} + +void CloudPrintSetupFlow::GetDOMMessageHandlers( + std::vector<DOMMessageHandler*>* handlers) const { + // Create the message handler only after we are asked, the caller is + // responsible for deleting the objects. + handlers->push_back( + new CloudPrintSetupMessageHandler( + const_cast<CloudPrintSetupFlow*>(this))); +} + +void CloudPrintSetupFlow::GetDialogSize(gfx::Size* size) const { + PrefService* prefs = browser_->profile()->GetPrefs(); + gfx::Font approximate_web_font( + UTF8ToWide(prefs->GetString(prefs::kWebKitSansSerifFontFamily)), + prefs->GetInteger(prefs::kWebKitDefaultFontSize)); + + // TODO(pranavk) Replace the following SYNC resources with REMOTING Resources. + *size = gfx::GetLocalizedContentsSizeForFont( + IDS_SYNC_SETUP_WIZARD_WIDTH_CHARS, + IDS_SYNC_SETUP_WIZARD_HEIGHT_LINES, + approximate_web_font); +} + +// A callback to notify the delegate that the dialog closed. +void CloudPrintSetupFlow::OnDialogClosed(const std::string& json_retval) { + // If we are fetching the token then cancel the request. + if (authenticator_.get()) + authenticator_->CancelRequest(); + + // If the service process helper is still active then detach outself from it. + // This is because the dialog is closing and this object is going to be + // deleted but the service process launch is still in progress so we don't + // the service process helper to call us when the process is launched. + if (service_process_helper_.get()) + service_process_helper_->Detach(); + delete this; +} + +std::string CloudPrintSetupFlow::GetDialogArgs() const { + return dialog_start_args_; +} + +void CloudPrintSetupFlow::OnCloseContents(TabContents* source, + bool* out_close_dialog) { +} + +std::wstring CloudPrintSetupFlow::GetDialogTitle() const { + return l10n_util::GetString(IDS_CLOUD_PRINT_SETUP_DIALOG_TITLE); +} + +bool CloudPrintSetupFlow::IsDialogModal() const { + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// GaiaAuthConsumer implementation. +void CloudPrintSetupFlow::OnClientLoginFailure( + const GoogleServiceAuthError& error) { + ShowGaiaFailed(error); + authenticator_.reset(); +} + +void CloudPrintSetupFlow::OnClientLoginSuccess( + const GaiaAuthConsumer::ClientLoginResult& credentials) { + // Save the token for the cloud print proxy. + lsid_ = credentials.lsid; + + // Show that Gaia login has succeeded. + ShowGaiaSuccessAndSettingUp(); + authenticator_.reset(); + + // And then launch the service process if it has not started yet. + // If we have already connected to the service process then submit the tokens + // to it to register the host. + process_control_ = + ServiceProcessControlManager::instance()->GetProcessControl( + browser_->profile(), + kServiceProcessCloudPrint); + +#if defined(OS_WIN) + // TODO(hclam): This call only works on Windows. I need to make it + // work on other platforms. + service_process_helper_ = new CloudPrintServiceProcessHelper(this); + + // If the process isn't connected, launch it now. This will run the + // task whether the process is already launched or not, as long as + // it's able to connect back up. + process_control_->Launch( + NewRunnableMethod(service_process_helper_.get(), + &CloudPrintServiceProcessHelper::OnProcessLaunched)); +#else + ShowSetupDone(); +#endif +} + +/////////////////////////////////////////////////////////////////////////////// +// Methods called by CloudPrintSetupMessageHandler +void CloudPrintSetupFlow::Attach(DOMUI* dom_ui) { + dom_ui_ = dom_ui; +} + +void CloudPrintSetupFlow::OnUserSubmittedAuth(const std::string& user, + const std::string& password, + const std::string& captcha) { + // Save the login name only. + login_ = user; + + // Start the authenticator. + authenticator_.reset( + new GaiaAuthenticator2(this, GaiaConstants::kChromeSource, + browser_->profile()->GetRequestContext())); + authenticator_->StartClientLogin(user, password, + GaiaConstants::kCloudPrintService, + "", captcha); +} + +/////////////////////////////////////////////////////////////////////////////// +// Method called by CloudPrintServiceProcessHelper +void CloudPrintSetupFlow::OnProcessLaunched() { + DCHECK(process_control_->is_connected()); + // TODO(scottbyer): Need to wait for an ACK to be sure that it is + // actually active. + if (!lsid_.empty()) + process_control_->Send(new ServiceMsg_EnableCloudPrintProxy(lsid_)); + + // Save the preference that we have completed the setup of cloud + // print. + browser_->profile()->GetPrefs()->SetString(prefs::kCloudPrintEmail, login_); + ShowSetupDone(); +} + +/////////////////////////////////////////////////////////////////////////////// +// Helper methods for showing contents of the DOM UI +void CloudPrintSetupFlow::ShowGaiaLogin(const DictionaryValue& args) { + if (dom_ui_) + dom_ui_->CallJavascriptFunction(L"showGaiaLoginIframe"); + + std::string json; + base::JSONWriter::Write(&args, false, &json); + std::wstring javascript = std::wstring(L"showGaiaLogin") + + L"(" + UTF8ToWide(json) + L");"; + ExecuteJavascriptInIFrame(kLoginIFrameXPath, javascript); +} + +void CloudPrintSetupFlow::ShowGaiaSuccessAndSettingUp() { + ExecuteJavascriptInIFrame(kLoginIFrameXPath, + L"showGaiaSuccessAndSettingUp();"); +} + +void CloudPrintSetupFlow::ShowGaiaFailed(const GoogleServiceAuthError& error) { + DictionaryValue args; + args.SetString("iframeToShow", "login"); + args.SetString("user", ""); + args.SetInteger("error", error.state()); + args.SetBoolean("editable_user", true); + args.SetString("captchaUrl", error.captcha().image_url.spec()); + ShowGaiaLogin(args); +} + +void CloudPrintSetupFlow::ShowSetupDone() { + std::wstring javascript = L"setMessage('You are all set!');"; + ExecuteJavascriptInIFrame(kDoneIframeXPath, javascript); + + if (dom_ui_) + dom_ui_->CallJavascriptFunction(L"showSetupDone"); + + ExecuteJavascriptInIFrame(kDoneIframeXPath, L"onPageShown();"); +} + +void CloudPrintSetupFlow::ExecuteJavascriptInIFrame( + const std::wstring& iframe_xpath, + const std::wstring& js) { + if (dom_ui_) { + RenderViewHost* rvh = dom_ui_->tab_contents()->render_view_host(); + rvh->ExecuteJavascriptInWebFrame(iframe_xpath, js); + } +} diff --git a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.h b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.h new file mode 100644 index 0000000..551e163 --- /dev/null +++ b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.h @@ -0,0 +1,132 @@ +// Copyright (c) 2010 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 CHROME_BROWSER_PRINTING_CLOUD_PRINT_CLOUD_PRINT_SETUP_FLOW_H_ +#define CHROME_BROWSER_PRINTING_CLOUD_PRINT_CLOUD_PRINT_SETUP_FLOW_H_ + +#include <string> +#include <vector> + +#include "app/l10n_util.h" +#include "base/time.h" +#include "chrome/browser/dom_ui/html_dialog_ui.h" +#include "chrome/common/net/gaia/gaia_auth_consumer.h" +#include "chrome/common/net/gaia/gaia_authenticator2.h" +#include "gfx/native_widget_types.h" +#include "grit/generated_resources.h" + +class GaiaAuthenticator2; +class CloudPrintServiceProcessHelper; +class CloudPrintSetupMessageHandler; +class ServiceProcessControl; +class GoogleServiceAuthError; +class Browser; + +// This class is responsible for showing a cloud print setup dialog +// and perform operations to fill the content of the dialog and handle +// user actions in the dialog. +// +// It is responsible for: +// 1. Showing the setup dialog. +// 2. Providing the URL for the content of the dialog. +// 3. Providing a data source to provide the content HTML files. +// 4. Providing a message handler to handle user actions in the DOM UI. +// 5. Responding to actions received in the message handler. +// +// The architecture for DOMUI is designed such that only the message handler +// can access the DOMUI. This splits the flow control across the message +// handler and this class. In order to centralize all the flow control and +// content in the DOMUI, the DOMUI object is given to this object by the +// message handler through the Attach(DOMUI*) method. +class CloudPrintSetupFlow : public HtmlDialogUIDelegate, + public GaiaAuthConsumer { + public: + virtual ~CloudPrintSetupFlow(); + + // Runs a flow from |start| to |end|, and does the work of actually showing + // the HTML dialog. |container| is kept up-to-date with the lifetime of the + // flow (e.g it is emptied on dialog close). + static CloudPrintSetupFlow* OpenDialog(Profile* service); + + // Disables the cloud print proxy if it's enabled and running. + static void DisableCloudPrintProxy(Profile* profile); + + // Ping the cloud print proxy service in order to get the true + // enablement state and user e-mail that the service is using, and + // reflect those back into the browser preferences. + static void RefreshPreferencesFromService( + Profile* profile, Callback2<bool, std::string>::Type* callback); + + // Focuses the dialog. This is useful in cases where the dialog has been + // obscured by a browser window. + void Focus(); + + // HtmlDialogUIDelegate implementation. + virtual GURL GetDialogContentURL() const; + virtual void GetDOMMessageHandlers( + std::vector<DOMMessageHandler*>* handlers) const; + virtual void GetDialogSize(gfx::Size* size) const; + virtual std::string GetDialogArgs() const; + virtual void OnDialogClosed(const std::string& json_retval); + virtual void OnCloseContents(TabContents* source, bool* out_close_dialog); + virtual std::wstring GetDialogTitle() const; + virtual bool IsDialogModal() const; + + // GaiaAuthConsumer implementation. + virtual void OnClientLoginFailure( + const GoogleServiceAuthError& error); + virtual void OnClientLoginSuccess( + const GaiaAuthConsumer::ClientLoginResult& credentials); + + private: + friend class CloudPrintServiceProcessHelper; + friend class CloudPrintSetupMessageHandler; + + // Use static Run method to get an instance. This class takes + // ownership of browser and is responsible for it's destruction. + CloudPrintSetupFlow(const std::string& args, Browser* browser); + + // Called CloudPrintSetupMessageHandler when a DOM is attached. This method + // is called when the HTML page is fully loaded. We then operate on this + // DOMUI object directly. + void Attach(DOMUI* dom_ui); + + // Called by CloudPrintSetupMessageHandler when user authentication is + // registered. + void OnUserSubmittedAuth(const std::string& user, + const std::string& password, + const std::string& captcha); + + // Event triggered when the service process was launched. + void OnProcessLaunched(); + + // The following methods control which iframe is visible. + void ShowGaiaLogin(const DictionaryValue& args); + void ShowGaiaSuccessAndSettingUp(); + void ShowGaiaFailed(const GoogleServiceAuthError& error); + void ShowSetupDone(); + void ExecuteJavascriptInIFrame(const std::wstring& iframe_xpath, + const std::wstring& js); + + // Pointer to the DOM UI. This is provided by CloudPrintSetupMessageHandler + // when attached. + DOMUI* dom_ui_; + + // The args to pass to the initial page. + std::string dialog_start_args_; + scoped_ptr<Browser> browser_; + + // Fetcher to obtain the Chromoting Directory token. + scoped_ptr<GaiaAuthenticator2> authenticator_; + std::string login_; + std::string lsid_; + + // Handle to the ServiceProcessControl which talks to the service process. + ServiceProcessControl* process_control_; + scoped_refptr<CloudPrintServiceProcessHelper> service_process_helper_; + + DISALLOW_COPY_AND_ASSIGN(CloudPrintSetupFlow); +}; + +#endif // CHROME_BROWSER_PRINTING_CLOUD_PRINT_CLOUD_PRINT_SETUP_FLOW_H_ diff --git a/chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.cc b/chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.cc new file mode 100644 index 0000000..ece0e8e --- /dev/null +++ b/chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.cc @@ -0,0 +1,47 @@ +// Copyright (c) 2010 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 "chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.h" + +#include "base/scoped_ptr.h" +#include "base/json/json_reader.h" +#include "base/json/json_writer.h" +#include "chrome/browser/dom_ui/dom_ui_util.h" +#include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" + +DOMMessageHandler* CloudPrintSetupMessageHandler::Attach(DOMUI* dom_ui) { + // Pass the DOMUI object to the setup flow. + flow_->Attach(dom_ui); + return DOMMessageHandler::Attach(dom_ui); +} + +void CloudPrintSetupMessageHandler::RegisterMessages() { + dom_ui_->RegisterMessageCallback("SubmitAuth", + NewCallback(this, &CloudPrintSetupMessageHandler::HandleSubmitAuth)); +} + +void CloudPrintSetupMessageHandler::HandleSubmitAuth(const ListValue* args) { + std::string json(dom_ui_util::GetJsonResponseFromFirstArgumentInList(args)); + std::string username, password, captcha; + if (json.empty()) + return; + + scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false)); + if (!parsed_value.get() || !parsed_value->IsType(Value::TYPE_DICTIONARY)) { + NOTREACHED() << "Unable to parse auth data"; + return; + } + + DictionaryValue* result = static_cast<DictionaryValue*>(parsed_value.get()); + if (!result->GetString("user", &username) || + !result->GetString("pass", &password) || + !result->GetString("captcha", &captcha)) { + NOTREACHED() << "Unable to parse auth data"; + return; + } + + // Pass the information to the flow. + if (flow_) + flow_->OnUserSubmittedAuth(username, password, captcha); +} diff --git a/chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.h b/chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.h new file mode 100644 index 0000000..c59afb3 --- /dev/null +++ b/chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.h @@ -0,0 +1,38 @@ +// Copyright (c) 2010 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 CHROME_BROWSER_PRINTING_CLOUD_PRINT_CLOUD_PRINT_SETUP_MESSAGE_HANDLER_H_ +#define CHROME_BROWSER_PRINTING_CLOUD_PRINT_CLOUD_PRINT_SETUP_MESSAGE_HANDLER_H_ + +#include <string> + +#include "base/values.h" +#include "chrome/browser/dom_ui/html_dialog_ui.h" + +class CloudPrintSetupFlow; + +// This class is used to handle DOM messages from the setup dialog. +class CloudPrintSetupMessageHandler : public DOMMessageHandler { + public: + explicit CloudPrintSetupMessageHandler(CloudPrintSetupFlow* flow) + : flow_(flow) {} + virtual ~CloudPrintSetupMessageHandler() {} + + // DOMMessageHandler implementation. + virtual DOMMessageHandler* Attach(DOMUI* dom_ui); + + protected: + // DOMMessageHandler implementation. + virtual void RegisterMessages(); + + // Callbacks from the page. + void HandleSubmitAuth(const ListValue* args); + + private: + CloudPrintSetupFlow* flow_; + + DISALLOW_COPY_AND_ASSIGN(CloudPrintSetupMessageHandler); +}; + +#endif // CHROME_BROWSER_PRINTING_CLOUD_PRINT_CLOUD_PRINT_SETUP_MESSAGE_HANDLER_H_ diff --git a/chrome/browser/service/service_process_control.cc b/chrome/browser/service/service_process_control.cc index 05dc446..c3c16d8 100644 --- a/chrome/browser/service/service_process_control.cc +++ b/chrome/browser/service/service_process_control.cc @@ -171,11 +171,11 @@ void ServiceProcessControl::OnProcessLaunched(Task* task) { } void ServiceProcessControl::OnMessageReceived(const IPC::Message& message) { - if (!message_handler_) - return; - - if (message.type() == ServiceHostMsg_GoodDay::ID) - message_handler_->OnGoodDay(); + IPC_BEGIN_MESSAGE_MAP(ServiceProcessControl, message) + IPC_MESSAGE_HANDLER(ServiceHostMsg_GoodDay, OnGoodDay) + IPC_MESSAGE_HANDLER(ServiceHostMsg_CloudPrintProxy_IsEnabled, + OnCloudPrintProxyIsEnabled) + IPC_END_MESSAGE_MAP() } void ServiceProcessControl::OnChannelConnected(int32 peer_pid) { @@ -202,6 +202,22 @@ bool ServiceProcessControl::Send(IPC::Message* message) { return channel_->Send(message); } +void ServiceProcessControl::OnGoodDay() { + if (!message_handler_) + return; + + message_handler_->OnGoodDay(); +} + +void ServiceProcessControl::OnCloudPrintProxyIsEnabled(bool enabled, + std::string email) { + DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); + if (cloud_print_status_callback_ != NULL) { + cloud_print_status_callback_->Run(enabled, email); + cloud_print_status_callback_.reset(); + } +} + bool ServiceProcessControl::SendHello() { return Send(new ServiceMsg_Hello()); } @@ -221,4 +237,11 @@ bool ServiceProcessControl::EnableRemotingWithTokens( talk_token)); } +bool ServiceProcessControl::GetCloudPrintProxyStatus( + Callback2<bool, std::string>::Type* cloud_print_status_callback) { + DCHECK(cloud_print_status_callback); + cloud_print_status_callback_.reset(cloud_print_status_callback); + return Send(new ServiceMsg_IsCloudPrintProxyEnabled); +} + DISABLE_RUNNABLE_METHOD_REFCOUNT(ServiceProcessControl); diff --git a/chrome/browser/service/service_process_control.h b/chrome/browser/service/service_process_control.h index 53f40de..46c2a18 100644 --- a/chrome/browser/service/service_process_control.h +++ b/chrome/browser/service/service_process_control.h @@ -6,8 +6,10 @@ #define CHROME_BROWSER_SERVICE_SERVICE_PROCESS_CONTROL_H_ #include <queue> +#include <string> #include "base/id_map.h" +#include "base/callback.h" #include "base/process.h" #include "base/scoped_ptr.h" #include "base/task.h" @@ -69,6 +71,10 @@ class ServiceProcessControl : public IPC::Channel::Sender, // IPC::Channel::Sender implementation virtual bool Send(IPC::Message* message); + // Message handlers + void OnGoodDay(); + void OnCloudPrintProxyIsEnabled(bool enabled, std::string email); + // Send a hello message to the service process for testing purpose. // Return true if the message was sent. bool SendHello(); @@ -84,6 +90,13 @@ class ServiceProcessControl : public IPC::Channel::Sender, const std::string& remoting_token, const std::string& talk_token); + // Send a message to the service process to request a response + // containing the enablement status of the cloud print proxy and the + // registered email address. The callback gets the information when + // received. + bool GetCloudPrintProxyStatus( + Callback2<bool, std::string>::Type* cloud_print_status_callback); + // Set the message handler for receiving messages from the service process. // TODO(hclam): Allow more than 1 handler. void SetMessageHandler(MessageHandler* message_handler) { @@ -113,8 +126,12 @@ class ServiceProcessControl : public IPC::Channel::Sender, // connect. scoped_ptr<Task> connect_done_task_; + // Callback that gets invoked when a status message is received from + // the cloud print proxy. + scoped_ptr<Callback2<bool, std::string>::Type> cloud_print_status_callback_; + // Handler for messages from service process. MessageHandler* message_handler_; }; -#endif // CHROME_BROWSER_SERVICE_SERVICE_PROCESS_H_ +#endif // CHROME_BROWSER_SERVICE_SERVICE_PROCESS_CONTROL_H_ diff --git a/chrome/browser/views/options/advanced_contents_view.cc b/chrome/browser/views/options/advanced_contents_view.cc index 6270e4f..3200494 100644 --- a/chrome/browser/views/options/advanced_contents_view.cc +++ b/chrome/browser/views/options/advanced_contents_view.cc @@ -19,6 +19,7 @@ #include "base/i18n/rtl.h" #include "base/message_loop.h" #include "base/path_service.h" +#include "base/scoped_callback_factory.h" #include "base/thread.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser.h" @@ -32,6 +33,7 @@ #include "chrome/browser/prefs/pref_member.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/pref_set_observer.h" +#include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/resource_dispatcher_host.h" #include "chrome/browser/safe_browsing/safe_browsing_service.h" @@ -1365,6 +1367,161 @@ void ChromeAppsSection::NotifyPrefChanged(const std::string* pref_name) { } //////////////////////////////////////////////////////////////////////////////// +// CloudPrintProxySection + +class CloudPrintProxySection : public AdvancedSection, + public views::ButtonListener { + public: + explicit CloudPrintProxySection(Profile* profile); + virtual ~CloudPrintProxySection() {} + + // Overridden from views::ButtonListener: + virtual void ButtonPressed(views::Button* sender, const views::Event& event); + + // Callback that gets the cloud print proxy status. + void StatusCallback(bool enabled, std::string email); + + protected: + // OptionsPageView overrides: + virtual void InitControlLayout(); + virtual void NotifyPrefChanged(const std::string* pref_name); + + private: + bool Enabled() const; + + // Controls for this section: + views::Label* section_description_label_; + views::NativeButton* enable_disable_button_; + views::NativeButton* manage_printer_button_; + + // Preferences we tie things to. + StringPrefMember cloud_print_proxy_email_; + + base::ScopedCallbackFactory<CloudPrintProxySection> factory_; + + DISALLOW_COPY_AND_ASSIGN(CloudPrintProxySection); +}; + +CloudPrintProxySection::CloudPrintProxySection(Profile* profile) + : section_description_label_(NULL), + enable_disable_button_(NULL), + manage_printer_button_(NULL), + factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), + AdvancedSection(profile, + l10n_util::GetString( + IDS_OPTIONS_ADVANCED_SECTION_TITLE_CLOUD_PRINT)) { +} + +void CloudPrintProxySection::ButtonPressed(views::Button* sender, + const views::Event& event) { + if (sender == enable_disable_button_) { + if (Enabled()) { + // Enabled, we must be the disable button. + UserMetricsRecordAction( + UserMetricsAction("Options_DisableCloudPrintProxy"), NULL); + CloudPrintSetupFlow::DisableCloudPrintProxy(profile()); + } else { + UserMetricsRecordAction( + UserMetricsAction("Options_EnableCloudPrintProxy"), NULL); + // We open a new browser window so the Options dialog doesn't + // get lost behind other windows. + CloudPrintSetupFlow::OpenDialog(profile()); + } + } else if (sender == manage_printer_button_) { + // Open a new browser window for the management tab. The browser + // will go away when the user closes that tab. + Browser* browser = Browser::Create(profile()); + // FIXME(scottbyer): Refactor Cloud Print URL creation. + // http://code.google.com/p/chromium/issues/detail?id=56850 + browser->OpenURL(GURL("https://www.google.com/cloudprint/manage.html"), + GURL(), NEW_WINDOW, PageTransition::LINK); + } +} + +void CloudPrintProxySection::StatusCallback(bool enabled, std::string email) { + profile()->GetPrefs()->SetString(prefs::kCloudPrintEmail, + enabled ? email : std::string()); +} + +void CloudPrintProxySection::InitControlLayout() { + AdvancedSection::InitControlLayout(); + + section_description_label_ = new views::Label( + l10n_util::GetString(IDS_OPTIONS_CLOUD_PRINT_PROXY_DISABLED_LABEL)); + enable_disable_button_ = new views::NativeButton(this, + l10n_util::GetString(IDS_OPTIONS_CLOUD_PRINT_PROXY_DISABLED_BUTTON)); + manage_printer_button_ = new views::NativeButton(this, + l10n_util::GetString( + IDS_OPTIONS_CLOUD_PRINT_PROXY_ENABLED_MANAGE_BUTTON)); + + GridLayout* layout = new GridLayout(contents_); + contents_->SetLayoutManager(layout); + + const int single_column_view_set_id = 0; + AddWrappingColumnSet(layout, single_column_view_set_id); + const int control_view_set_id = 1; + AddDependentTwoColumnSet(layout, control_view_set_id); + + // The description label at the top and label. + section_description_label_->SetMultiLine(true); + AddWrappingLabelRow(layout, section_description_label_, + single_column_view_set_id, true); + + // The enable / disable button and manage button. + AddTwoColumnRow(layout, enable_disable_button_, manage_printer_button_, false, + control_view_set_id, kRelatedControlVerticalSpacing); + + // Attach the preferences so we can flip things appropriately. + cloud_print_proxy_email_.Init(prefs::kCloudPrintEmail, + profile()->GetPrefs(), this); + + // Start the UI off in the state we think it should be in. + std::string pref_string(prefs::kCloudPrintEmail); + NotifyPrefChanged(&pref_string); + + // Kick off a task to ask the background service what the real + // answer is. + CloudPrintSetupFlow::RefreshPreferencesFromService( + profile(), + factory_.NewCallback(&CloudPrintProxySection::StatusCallback)); +} + +void CloudPrintProxySection::NotifyPrefChanged(const std::string* pref_name) { + if (pref_name == NULL) + return; + + if (*pref_name == prefs::kCloudPrintEmail) { + if (Enabled()) { + std::string email; + if (profile()->GetPrefs()->HasPrefPath(prefs::kCloudPrintEmail)) + email = profile()->GetPrefs()->GetString(prefs::kCloudPrintEmail); + + section_description_label_->SetText( + l10n_util::GetStringF(IDS_OPTIONS_CLOUD_PRINT_PROXY_ENABLED_LABEL, + UTF8ToWide(email))); + enable_disable_button_->SetLabel( + l10n_util::GetString(IDS_OPTIONS_CLOUD_PRINT_PROXY_ENABLED_BUTTON)); + enable_disable_button_->InvalidateLayout(); + manage_printer_button_->SetVisible(true); + manage_printer_button_->InvalidateLayout(); + } else { + section_description_label_->SetText( + l10n_util::GetString(IDS_OPTIONS_CLOUD_PRINT_PROXY_DISABLED_LABEL)); + enable_disable_button_->SetLabel( + l10n_util::GetString(IDS_OPTIONS_CLOUD_PRINT_PROXY_DISABLED_BUTTON)); + enable_disable_button_->InvalidateLayout(); + manage_printer_button_->SetVisible(false); + } + Layout(); + } +} + +bool CloudPrintProxySection::Enabled() const { + return profile()->GetPrefs()->HasPrefPath(prefs::kCloudPrintEmail) && + !profile()->GetPrefs()->GetString(prefs::kCloudPrintEmail).empty(); +} + +//////////////////////////////////////////////////////////////////////////////// // AdvancedContentsView class AdvancedContentsView : public OptionsPageView { @@ -1462,6 +1619,11 @@ void AdvancedContentsView::InitControlLayout() { layout->StartRow(0, single_column_view_set_id); layout->AddView(new SecuritySection(profile())); if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableCloudPrintProxy)) { + layout->StartRow(0, single_column_view_set_id); + layout->AddView(new CloudPrintProxySection(profile())); + } + if (CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableBackgroundMode)) { layout->StartRow(0, single_column_view_set_id); layout->AddView(new ChromeAppsSection(profile())); diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index b0551a6..fe83f8d 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -2315,6 +2315,10 @@ 'browser/printing/printer_query.h', 'browser/printing/cloud_print/cloud_print_proxy_service.cc', 'browser/printing/cloud_print/cloud_print_proxy_service.h', + 'browser/printing/cloud_print/cloud_print_setup_flow.cc', + 'browser/printing/cloud_print/cloud_print_setup_flow.h', + 'browser/printing/cloud_print/cloud_print_setup_message_handler.cc', + 'browser/printing/cloud_print/cloud_print_setup_message_handler.h', 'browser/process_info_snapshot_mac.cc', 'browser/process_info_snapshot.h', 'browser/process_singleton.h', diff --git a/chrome/common/net/gaia/gaia_constants.cc b/chrome/common/net/gaia/gaia_constants.cc index 60f7fbb..810055e 100644 --- a/chrome/common/net/gaia/gaia_constants.cc +++ b/chrome/common/net/gaia/gaia_constants.cc @@ -20,5 +20,7 @@ const char kSyncService[] = "chromiumsync"; const char kTalkService[] = "talk"; // Service name for remoting. const char kRemotingService[] = "chromoting"; +// Service name for cloud print. +const char kCloudPrintService[] = "cloudprint"; } // namespace GaiaConstants diff --git a/chrome/common/net/gaia/gaia_constants.h b/chrome/common/net/gaia/gaia_constants.h index 3daf858..b1a2617 100644 --- a/chrome/common/net/gaia/gaia_constants.h +++ b/chrome/common/net/gaia/gaia_constants.h @@ -18,6 +18,7 @@ extern const char kContactsService[]; extern const char kTalkService[]; extern const char kSyncService[]; extern const char kRemotingService[]; +extern const char kCloudPrintService[]; } // namespace GaiaConstants diff --git a/chrome/common/service_messages_internal.h b/chrome/common/service_messages_internal.h index 26225e4..bdacb34 100644 --- a/chrome/common/service_messages_internal.h +++ b/chrome/common/service_messages_internal.h @@ -29,11 +29,9 @@ IPC_BEGIN_MESSAGES(Service) // Tell the service process to disable the cloud proxy. IPC_MESSAGE_CONTROL0(ServiceMsg_DisableCloudPrintProxy) - // Queries whether the cloud print proxy is enabled. - IPC_SYNC_MESSAGE_ROUTED0_2(ServiceMsg_IsCloudPrintProxyEnabled, - bool, /* out: is_enabled*/ - std::string /* out: Email address of account */ - /* used for Cloud Print, if enabled*/) + // Requests a message back on whether the cloud print proxy is + // enabled. + IPC_MESSAGE_CONTROL0(ServiceMsg_IsCloudPrintProxyEnabled) // This message is for testing purpose. IPC_MESSAGE_CONTROL0(ServiceMsg_Hello) @@ -57,6 +55,11 @@ IPC_BEGIN_MESSAGES(ServiceHost) // Sent when the cloud print proxy has an authentication error. IPC_MESSAGE_CONTROL0(ServiceHostMsg_CloudPrintProxy_AuthError) + // Sent as a response to a request for enablement status. + IPC_MESSAGE_CONTROL2(ServiceHostMsg_CloudPrintProxy_IsEnabled, + bool, /* Is the proxy enabled? */ + std::string /* Email address of account */) + // Sent from the service process in response to a Hello message. IPC_MESSAGE_CONTROL0(ServiceHostMsg_GoodDay) diff --git a/chrome/service/service_ipc_server.cc b/chrome/service/service_ipc_server.cc index 5663f49..958eade 100644 --- a/chrome/service/service_ipc_server.cc +++ b/chrome/service/service_ipc_server.cc @@ -93,9 +93,11 @@ void ServiceIPCServer::OnEnableCloudPrintProxyWithTokens( NOTIMPLEMENTED(); } -void ServiceIPCServer::OnIsCloudPrintProxyEnabled(bool* is_enabled, - std::string* email) { - *is_enabled = g_service_process->GetCloudPrintProxy()->IsEnabled(email); +void ServiceIPCServer::OnIsCloudPrintProxyEnabled() { + std::string email; + bool is_enabled = g_service_process->GetCloudPrintProxy()->IsEnabled(&email); + channel_->Send(new ServiceHostMsg_CloudPrintProxy_IsEnabled(is_enabled, + email)); } void ServiceIPCServer::OnEnableRemotingWithTokens( diff --git a/chrome/service/service_ipc_server.h b/chrome/service/service_ipc_server.h index 5cd8624..02bf3bb 100644 --- a/chrome/service/service_ipc_server.h +++ b/chrome/service/service_ipc_server.h @@ -40,7 +40,7 @@ class ServiceIPCServer : public IPC::Channel::Listener, void OnEnableCloudPrintProxy(const std::string& lsid); void OnEnableCloudPrintProxyWithTokens(const std::string& cloud_print_token, const std::string& talk_token); - void OnIsCloudPrintProxyEnabled(bool* is_enabled, std::string* email); + void OnIsCloudPrintProxyEnabled(); void OnEnableRemotingWithTokens(const std::string& login, const std::string& remoting_token, |