diff options
author | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-10 18:19:32 +0000 |
---|---|---|
committer | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-10 18:19:32 +0000 |
commit | bb76fd4253554e9e622f85aa68bbf6a092cb1481 (patch) | |
tree | 39ad412ccd8c0a9d4099e7af9847586420bc1db1 | |
parent | 13bbbd19b7e90b1b4c3449f8945aab132eec8767 (diff) | |
download | chromium_src-bb76fd4253554e9e622f85aa68bbf6a092cb1481.zip chromium_src-bb76fd4253554e9e622f85aa68bbf6a092cb1481.tar.gz chromium_src-bb76fd4253554e9e622f85aa68bbf6a092cb1481.tar.bz2 |
Remove the Remoting Host component from Chrome.
* Update the Remoting feature flag description.
* Fix license headers.
* Remove files from gyp definitions.
* Remove Chromoting trigger for Service Process launch on browser startup, and Chromoting setup HTML resources.
* Remove Chromoting Host registration components from Browser.
* Remove resources for Chromoting Host options UI.
* Remove Service Process control APIs for Chromoting Host.
* Remove Chromoting Host prefs from Browser UI.
* Remove WebUI for Chromoting Host.
* Remove WebUI options for Chromoting Host.
* Remove Chromoting Host policy options, and don't warn if Chromoting is entirely disabled by policy, since there are no user-visible settings for it anyway.
* Remove Chromoting Host preference names, service IPCs and URL constants.
* Remove Chromoting Host from Service Process.
* Remove remoting strings, locale settings and setup "Id".
BUG=
TEST=Run Service Process from a profile in which Chromoting Host had previously been configured, and Cloud Print NOT configured. Chromoting Host should not be accessible, and Service Process should quit after about a minute.
Review URL: http://codereview.chromium.org/6955010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84819 0039d316-1c4b-4281-b951-d872f2087c98
63 files changed, 11 insertions, 3068 deletions
diff --git a/chrome/app/chrome_command_ids.h b/chrome/app/chrome_command_ids.h index 5d870da..b269d83 100644 --- a/chrome/app/chrome_command_ids.h +++ b/chrome/app/chrome_command_ids.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -188,9 +188,6 @@ #define IDC_WRITING_DIRECTION_LTR 41122 // OSX only #define IDC_WRITING_DIRECTION_RTL 41123 // OSX only -// Remoting -#define IDC_REMOTING_SETUP 41140 - // Translate #define IDC_TRANSLATE_OPTIONS_ALWAYS 42000 #define IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_LANG 42001 diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 93e1286..3ef2a05 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -4064,7 +4064,7 @@ Keep your key file in a safe place. You will need it to create new versions of y Remoting </message> <message name="IDS_FLAGS_REMOTING_DESCRIPTION" desc="Description of the 'Remoting' client lab."> - Enable the UI plus backing code for the Remoting serivce process, and client plugin. Warning: This is currently for developer testing only. Unless you are on the dev team and whitelisted, nothing in the enabled UI will work. + Enable the Remoting client plugin. Warning: This is currently for developer testing only. Unless you are on the dev team and whitelisted, nothing in the enabled UI will work. </message> <message name="IDS_FLAGS_FOCUS_EXISTING_TAB_ON_OPEN_NAME" desc="Name for 'Focus existing tab on open' lab"> Focus existing tab on open @@ -8587,53 +8587,6 @@ Keep your key file in a safe place. You will need it to create new versions of y Type your search query here </message> - <!-- Remoting strings --> - <message name="IDS_OPTIONS_ADVANCED_SECTION_TITLE_REMOTING" desc="Title for the remoting options section."> - Remoting - </message> - <message name="IDS_OPTIONS_REMOTING_SETUP_BUTTON" desc="Title for the remoting setup button."> - Set up this computer for remote access... - </message> - <message name="IDS_OPTIONS_REMOTING_STOP_BUTTON" desc="Title for the remoting stop button."> - Disable remote access to this computer - </message> - <message name="IDS_REMOTING_SETUP_DIALOG_TITLE" desc="Title of the remoting setup dialog."> - Set up remote access - </message> - <message name="IDS_REMOTING_SETTING_UP_MESSAGE" desc="Message shown while remoting host is being started"> - Setting up remote access to this computer. - </message> - <message name="IDS_REMOTING_SUCCESS_TITLE" desc="Header of the page that is shown when remoting configuration is finished."> - Success! - </message> - <message name="IDS_REMOTING_SUCCESS_MESSAGE" desc="Message shown during remoting host setup after the host is successfully initialized."> - Remoting was started successfully. Now you should be able to connect to this computer remotely. - </message> - <message name="IDS_REMOTING_SERVICE_PROCESS_FAILED_MESSAGE" desc="Message shown during remoting host setup if there was an error starting service process."> - Unable to start service process. - </message> - <message name="IDS_REMOTING_REGISTRATION_FAILED_MESSAGE" desc="Message shown during remoting host setup if there was an error registering the host."> - Failed to register this computer for remote access. - </message> - <message name="IDS_REMOTING_REGISTRATION_ACCESS_DENIED" desc="Error message during remoting host setup if access to the remoting directory was denied."> - Access to the remoting host directory was denied. Please try with another account. - </message> - <message name="IDS_REMOTING_RETRY_BUTTON_TEXT" desc="Text for retry button"> - Retry - </message> - <message name="IDS_REMOTING_STATUS_DISABLED_TEXT" desc="Status string shown when remoting is completely disabled."> - Remote access to or from this computer is disabled. - </message> - <message name="IDS_REMOTING_STATUS_ENABLED_TEXT" desc="Status string shown when a machine is enabled to be a remote access viewer (but not a host)."> - Remote access to other computers is enabled. - </message> - <message name="IDS_REMOTING_STATUS_HOST_ENABLED_TEXT" desc="Status string shown when a machine is enabled to be a remote access host, but has not yet been configured."> - Remote access to this computer is not set up. - </message> - <message name="IDS_REMOTING_STATUS_CONFIGURED_TEXT" desc="Status string shown when a machine has been configured as a host for remote access."> - Remote access to this computer is set up for <ph name="USER_EMAIL_ADDRESS">$1<ex>foo@gmail.com</ex></ph>. - </message> - <!-- Sync strings --> <!-- Sync options dialog strings --> diff --git a/chrome/app/policy/policy_templates.json b/chrome/app/policy/policy_templates.json index 487f2c6..0d1b210 100644 --- a/chrome/app/policy/policy_templates.json +++ b/chrome/app/policy/policy_templates.json @@ -803,76 +803,6 @@ ], }, { - 'name': 'Chromoting', - 'type': 'group', - 'caption': '''Remote access''', - 'desc': '''Configure remote access in <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> and prevent users from changing it. - - Enabling these features requires that the Chromoting application be installed.''', - 'policies': [ - { - 'name': 'ChromotingEnabled', - 'type': 'main', - 'supported_on': ['chrome.*:13-', 'chrome_os:0.13-'], - 'features': {'dynamic_refresh': 1}, - 'example_value': True, - 'id': 87, - 'caption': '''Enable remote access.''', - 'desc': '''Enables basic remote access features from within <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>, which includes the ability to access other machines that have been shared with the current user. - - Note that enabling this setting has no effect unless the Chromoting application has been installed. - - If this setting is enabled, then users can access other machines that have been shared with them. - - If this setting is disabled, then all remote access features are disabled, even if the Chromoting application has been installed. - - If this setting is not configured, then the value of this setting depends on whether or not there is a group policy in place. If there is a group policy, then this option defaults to being disabled. If there is no group policy, then this option defaults to being enabled. - - If you enable or disable this setting, users cannot change or override this setting in <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>.''', - }, - { - 'name': 'ChromotingHostEnabled', - 'type': 'main', - 'supported_on': ['chrome.*:13-', 'chrome_os:0.13-'], - 'features': {'dynamic_refresh': 1}, - 'example_value': True, - 'id': 88, - 'caption': '''Enable sharing of this machine for remote access.''', - 'desc': '''Enables the option to share this machine so that it can be accessed from another machine running <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>. - - Note that enabling this setting has no effect unless the Chromoting application has been installed and the ChromotingEnabled setting is enabled. - - If this setting is enabled, then users have the option to share their machine to allow remote access from another machine. - - If this setting is disabled, then users cannot share their machine for remote access. Note that they will still be able to access other remote machines if the ChromotingEnabled setting is enabled. - - If this setting is not configured, then the value of this setting depends on whether or not there is a group policy in place. If there is a group policy, then this option defaults to being disabled. If there is no group policy, then this option defaults to being enabled. - - If you enable or disable this setting, users cannot change or override this setting in <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>.''', - }, - { - 'name': 'ChromotingHostFirewallTraversal', - 'type': 'main', - 'supported_on': ['chrome.*:13-', 'chrome_os:0.13-'], - 'features': {'dynamic_refresh': 1}, - 'example_value': True, - 'id': 89, - 'caption': '''Enable access to this machine through a firewall.''', - 'desc': '''If the machine is being shared as a host, then this enables the ability for viewers to discover and connect to this machine, even the two machines are separated by a firewall. - - Note that enabling this setting has no effect unless the Chromoting application has been installed, the ChromotingEnabled and ChromotingHostEnabled settings have been enabled. - - If this setting is enabled, then remote viewers can discover and connect to this machine even if they are separated by a firewall. - - If this setting is disabled, then only machines within the local network (i.e., not separated by a firewall) are allowed to connect to this machine. - - If this setting is not configured, then the value of this setting depends on whether or not there is a group policy in place. If there is a group policy, then this option defaults to being disabled. If there is no group policy, then this option defaults to being enabled. - - If you enable or disable this setting, users cannot change or override this setting in <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>.''', - }, - ], - }, - { 'name': 'ShowHomeButton', 'type': 'main', 'supported_on': ['chrome.*:8-', 'chrome_os:0.11-'], diff --git a/chrome/app/resources/locale_settings.grd b/chrome/app/resources/locale_settings.grd index 1fb1d5e..4e70fe2 100644 --- a/chrome/app/resources/locale_settings.grd +++ b/chrome/app/resources/locale_settings.grd @@ -455,16 +455,6 @@ https://www.google.com/accounts/IssuedAuthSubTokens?hl=[GRITLANGCODE] </message> - <!-- The width of the remoting setup wizard / login dialog in characters. --> - <message name="IDS_REMOTING_SETUP_WIZARD_WIDTH_CHARS" use_name_for_id="true"> - 56 - </message> - - <!-- The height of the remoting setup wizard / login dialog in lines. --> - <message name="IDS_REMOTING_SETUP_WIZARD_HEIGHT_LINES" use_name_for_id="true"> - 16 - </message> - <!-- The width of the cloud print setup wizard / login dialog in --> <!-- characters. --> <message name="IDS_CLOUD_PRINT_SETUP_WIZARD_WIDTH_CHARS" diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 5fb61be..68da6cb 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -1817,20 +1817,6 @@ int BrowserMain(const MainFunctionParams& parameters) { ChildProcess::WaitForDebugger("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::GetInstance()->GetProcessControl( - profile); - control->Launch(NULL, NULL); - } - } - #if defined(OS_CHROMEOS) // Run the Out of Memory priority manager while in this scope. Wait // until here to start so that we give the most amount of time for diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd index a9cacac..7b20ac9 100644 --- a/chrome/browser/browser_resources.grd +++ b/chrome/browser/browser_resources.grd @@ -73,10 +73,6 @@ <include name="IDR_SYNC_SETTING_UP_HTML" file="sync\resources\setting_up.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_SYNC_SETUP_DONE_HTML" file="sync\resources\setup_done.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_SYNC_SETUP_FLOW_HTML" file="sync\resources\setup_flow.html" flattenhtml="true" type="BINDATA" /> - <include name="IDR_REMOTING_SETUP_FLOW_HTML" file="remoting\resources\remoting_setup_flow.html" flattenhtml="true" type="BINDATA" /> - <include name="IDR_REMOTING_SETUP_DONE_HTML" file="remoting\resources\remoting_setup_done.html" flattenhtml="true" type="BINDATA" /> - <include name="IDR_REMOTING_SETUP_ERROR_HTML" file="remoting\resources\remoting_setup_error.html" flattenhtml="true" type="BINDATA" /> - <include name="IDR_REMOTING_SETTING_UP_HTML" file="remoting\resources\remoting_setting_up.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_CLOUD_PRINT_SETUP_FLOW_HTML" file="printing\cloud_print\resources\cloud_print_setup_flow.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_CLOUD_PRINT_SETUP_LOGIN_HTML" file="printing\cloud_print\resources\cloud_print_setup_login.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_CLOUD_PRINT_SETUP_DONE_HTML" file="printing\cloud_print\resources\cloud_print_setup_done.html" flattenhtml="true" type="BINDATA" /> diff --git a/chrome/browser/policy/configuration_policy_pref_store.cc b/chrome/browser/policy/configuration_policy_pref_store.cc index 0d71a3b..68fe0d0 100644 --- a/chrome/browser/policy/configuration_policy_pref_store.cc +++ b/chrome/browser/policy/configuration_policy_pref_store.cc @@ -263,12 +263,6 @@ const ConfigurationPolicyPrefKeeper::PolicyToPreferenceMapEntry prefs::kEditBookmarksEnabled }, { Value::TYPE_BOOLEAN, kPolicyAllowFileSelectionDialogs, prefs::kAllowFileSelectionDialogs }, - { Value::TYPE_BOOLEAN, kPolicyChromotingEnabled, - prefs::kChromotingEnabled }, - { Value::TYPE_BOOLEAN, kPolicyChromotingHostEnabled, - prefs::kChromotingHostEnabled }, - { Value::TYPE_BOOLEAN, kPolicyChromotingHostFirewallTraversal, - prefs::kChromotingHostFirewallTraversal }, #if defined(OS_CHROMEOS) { Value::TYPE_BOOLEAN, kPolicyChromeOsLockOnIdleSuspend, @@ -1007,12 +1001,6 @@ ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList() { key::kEditBookmarksEnabled }, { kPolicyAllowFileSelectionDialogs, Value::TYPE_BOOLEAN, key::kAllowFileSelectionDialogs }, - { kPolicyChromotingEnabled, Value::TYPE_BOOLEAN, - key::kChromotingEnabled }, - { kPolicyChromotingHostEnabled, Value::TYPE_BOOLEAN, - key::kChromotingHostEnabled }, - { kPolicyChromotingHostFirewallTraversal, Value::TYPE_BOOLEAN, - key::kChromotingHostFirewallTraversal }, #if defined(OS_CHROMEOS) { kPolicyChromeOsLockOnIdleSuspend, Value::TYPE_BOOLEAN, diff --git a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc index f780430..07eed39 100644 --- a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc +++ b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc @@ -225,13 +225,7 @@ INSTANTIATE_TEST_CASE_P( TypeAndName(kPolicyEditBookmarksEnabled, prefs::kEditBookmarksEnabled), TypeAndName(kPolicyAllowFileSelectionDialogs, - prefs::kAllowFileSelectionDialogs), - TypeAndName(kPolicyChromotingEnabled, - prefs::kChromotingEnabled), - TypeAndName(kPolicyChromotingHostEnabled, - prefs::kChromotingHostEnabled), - TypeAndName(kPolicyChromotingHostFirewallTraversal, - prefs::kChromotingHostFirewallTraversal))); + prefs::kAllowFileSelectionDialogs))); #if defined(OS_CHROMEOS) INSTANTIATE_TEST_CASE_P( diff --git a/chrome/browser/policy/managed_prefs_banner_base.cc b/chrome/browser/policy/managed_prefs_banner_base.cc index ac105c5..9ca5fc7 100644 --- a/chrome/browser/policy/managed_prefs_banner_base.cc +++ b/chrome/browser/policy/managed_prefs_banner_base.cc @@ -96,8 +96,6 @@ void ManagedPrefsBannerBase::Init(PrefService* local_state, AddUserPref(prefs::kDownloadDefaultDirectory); AddUserPref(prefs::kPromptForDownload); AddUserPref(prefs::kEnableTranslate); - AddUserPref(prefs::kChromotingEnabled); - AddUserPref(prefs::kChromotingHostEnabled); break; #if defined(OS_CHROMEOS) case OPTIONS_PAGE_ACCOUNTS: diff --git a/chrome/browser/remoting/directory_add_request.cc b/chrome/browser/remoting/directory_add_request.cc deleted file mode 100644 index d6dae8e..0000000 --- a/chrome/browser/remoting/directory_add_request.cc +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) 2011 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/remoting/directory_add_request.h" - -#include <vector> - -#include "base/json/json_reader.h" -#include "base/json/json_writer.h" -#include "base/values.h" -#include "chrome/common/net/http_return.h" -#include "net/http/http_request_headers.h" -#include "net/url_request/url_request_context_getter.h" -#include "net/url_request/url_request_status.h" - -namespace remoting { - -static const char kRemotingDirectoryUrl[] = - "https://www.googleapis.com/chromoting/v1/@me/hosts"; - -DirectoryAddRequest::DirectoryAddRequest(net::URLRequestContextGetter* getter) - : getter_(getter) { -} - -DirectoryAddRequest::~DirectoryAddRequest() { - DCHECK(!fetcher_.get()) << "URLFetcher not destroyed."; -} - -void DirectoryAddRequest::AddHost(const remoting::ChromotingHostInfo& host_info, - const std::string& auth_token, - DoneCallback* done_callback) { - DCHECK(done_callback); - done_callback_.reset(done_callback); - - // Prepare the parameters for the request. - DictionaryValue data; - data.SetString("hostId", host_info.host_id); - data.SetString("hostName", host_info.hostname); - data.SetString("publicKey", host_info.public_key); - - // Generate the final json query. - DictionaryValue args; - args.Set("data", data.DeepCopy()); - std::string request_content; - base::JSONWriter::Write(&args, false, &request_content); - - // Prepare the HTTP header for authentication. - net::HttpRequestHeaders headers; - headers.SetHeader("Authorization", "GoogleLogin auth=" + auth_token); - fetcher_.reset( - new URLFetcher(GURL(kRemotingDirectoryUrl), URLFetcher::POST, this)); - fetcher_->set_request_context(getter_); - fetcher_->set_upload_data("application/json", request_content); - fetcher_->set_extra_request_headers(headers.ToString()); - - // And then start the request. - fetcher_->Start(); -} - -void DirectoryAddRequest::OnURLFetchComplete( - const URLFetcher* source, - const GURL& url, - const net::URLRequestStatus& status, - int response_code, - const net::ResponseCookies& cookies, - const std::string& data) { - DCHECK_EQ(source, fetcher_.get()); - - // Destroy the fetcher after the response has been received. - fetcher_.reset(); - - Result result; - std::string error_message; - - if (status.is_success()) { - DictionaryValue* response = NULL; - scoped_ptr<Value> response_json(base::JSONReader::Read(data, true)); - if (response_json != NULL && - response_json->IsType(Value::TYPE_DICTIONARY)) { - response = static_cast<DictionaryValue*>(response_json.get()); - response->GetString("error.message", &error_message); - } - - switch (response_code) { - case RC_REQUEST_OK: - result = SUCCESS; - break; - - case RC_BAD_REQUEST: - // TODO(sergeyu): Implement duplicate error detection that doesn't - // depend on error message. - if (error_message.find("duplicate") != std::string::npos) { - result = ERROR_EXISTS; - } else { - result = ERROR_INVALID_REQUEST; - } - break; - - case RC_UNAUTHORIZED: - result = ERROR_AUTH; - break; - - case RC_INTERNAL_SERVER_ERROR: - result = ERROR_SERVER; - break; - - default: - result = ERROR_OTHER; - } - } else { - result = ERROR_OTHER; - } - - if (result != SUCCESS) { - LOG(WARNING) << "Received error when trying to register Chromoting host. " - << "status.is_success(): " << status.is_success() - << " response_code: " << response_code - << " error_message: " << error_message; - } - - done_callback_->Run(result, error_message); -} - -} // namespace remoting diff --git a/chrome/browser/remoting/directory_add_request.h b/chrome/browser/remoting/directory_add_request.h deleted file mode 100644 index f03b820..0000000 --- a/chrome/browser/remoting/directory_add_request.h +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2011 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_REMOTING_DIRECTORY_ADD_REQUEST_H_ -#define CHROME_BROWSER_REMOTING_DIRECTORY_ADD_REQUEST_H_ - -#include <string> - -#include "base/callback_old.h" -#include "base/memory/scoped_ptr.h" -#include "chrome/common/remoting/chromoting_host_info.h" -#include "chrome/common/net/url_fetcher.h" -#include "googleurl/src/gurl.h" - -namespace remoting { - -// A class implements REST API insert call for the Chromoting directory service. -class DirectoryAddRequest : public URLFetcher::Delegate { - public: - enum Result { - // Host was added successfully. - SUCCESS, - // Invalid authentication token. - ERROR_AUTH, - // Server rejected request because it was invalid (e.g. specified - // public key is invalid). - ERROR_INVALID_REQUEST, - // Host is already registered. - ERROR_EXISTS, - // Internal server error. - ERROR_SERVER, - // Timeout expired. - ERROR_TIMEOUT_EXPIRED, - // Some other error, e.g. network failure. - ERROR_OTHER, - }; - - // Callback called when request is finished. The second parameter - // contains error message in case of an error. The error message may - // not be localized, and should be used for logging, but not shown - // to the user. - typedef Callback2<Result, const std::string&>::Type DoneCallback; - - explicit DirectoryAddRequest(net::URLRequestContextGetter* getter); - ~DirectoryAddRequest(); - - // Add this computer as a host. Use the token for - // authentication. |done_callback| is called when the request is - // finished. Request can be cancelled by destroying this object. - void AddHost(const remoting::ChromotingHostInfo& host_info, - const std::string& auth_token, - DoneCallback* done_callback); - - // URLFetcher::Delegate implementation. - virtual void OnURLFetchComplete(const URLFetcher* source, - const GURL& url, - const net::URLRequestStatus& status, - int response_code, - const net::ResponseCookies& cookies, - const std::string& data); - - private: - friend class DirectoryAddRequestTest; - - net::URLRequestContextGetter* getter_; - scoped_ptr<DoneCallback> done_callback_; - scoped_ptr<URLFetcher> fetcher_; - - DISALLOW_COPY_AND_ASSIGN(DirectoryAddRequest); -}; - -} // namespace remoting - -#endif // CHROME_BROWSER_REMOTING_DIRECTORY_ADD_REQUEST_H_ diff --git a/chrome/browser/remoting/directory_add_request_unittest.cc b/chrome/browser/remoting/directory_add_request_unittest.cc deleted file mode 100644 index 625262f..0000000 --- a/chrome/browser/remoting/directory_add_request_unittest.cc +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2011 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/remoting/directory_add_request.h" -#include "chrome/test/testing_profile.h" -#include "net/url_request/url_request_status.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace remoting { - -namespace { -class MockDoneCallback { - public: - MOCK_METHOD2(OnDone, - void(DirectoryAddRequest::Result, - const std::string& message)); -}; -} // namespace - -class DirectoryAddRequestTest : public testing::Test { - protected: - virtual void SetUp() { - target_.reset(new DirectoryAddRequest(profile_.GetRequestContext())); - } - - void TestResult(int response_code, const std::string& data, - DirectoryAddRequest::Result expected_result, - const std::string& expected_message) { - MockDoneCallback callback; - EXPECT_CALL(callback, OnDone(expected_result, expected_message)) - .Times(1); - - target_->done_callback_.reset( - NewCallback(&callback, &MockDoneCallback::OnDone)); - - GURL url; - net::URLRequestStatus status_ok; - net::ResponseCookies cookies; - target_->OnURLFetchComplete(NULL, url, status_ok, response_code, - cookies, data); - } - - TestingProfile profile_; - scoped_ptr<DirectoryAddRequest> target_; -}; - -TEST_F(DirectoryAddRequestTest, Success) { - TestResult(200, "{\"data\":{\"kind\":\"chromoting#host\"," - "\"hostId\":\"e64906c9-fdc9-4921-80cb-563cf7f564f3\"," - "\"hostName\":\"host_name\",\"publicKey\":\"PUBLIC+KEY\"}}", - DirectoryAddRequest::SUCCESS, ""); -} - -TEST_F(DirectoryAddRequestTest, Duplicate) { - TestResult(400, "{\"error\":{\"errors\":[{\"domain\":\"global\"," - "\"reason\":\"invalid\",\"message\":\"Attempt to register " - "a duplicate host.\"}],\"code\":400,\"message\":\"Attempt to " - "register a duplicate host.\"}}", - DirectoryAddRequest::ERROR_EXISTS, - "Attempt to register a duplicate host."); -} - -TEST_F(DirectoryAddRequestTest, InvalidRequest) { - TestResult(400, "{\"error\":{\"errors\":[{\"domain\":\"global\"," - "\"reason\":\"invalid\",\"message\":\"Invalid Value\"}]," - "\"code\":400,\"message\":\"Invalid Value\"}}", - DirectoryAddRequest::ERROR_INVALID_REQUEST, - "Invalid Value"); -} - -TEST_F(DirectoryAddRequestTest, InvalidToken) { - TestResult(401, "{\"error\":{\"errors\":[{\"domain\":\"global\"," - "\"reason\":\"invalid\",\"message\":\"Token invalid\"," - "\"locationType\":\"header\",\"location\":\"Authorization\"}]," - "\"code\":401,\"message\":\"Token invalid\"}}", - DirectoryAddRequest::ERROR_AUTH, - "Token invalid"); -} - -} // namespace remoting diff --git a/chrome/browser/remoting/remoting_options_handler.cc b/chrome/browser/remoting/remoting_options_handler.cc deleted file mode 100644 index 33ccb70..0000000 --- a/chrome/browser/remoting/remoting_options_handler.cc +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) 2011 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/remoting/remoting_options_handler.h" - -#include "base/utf_string_conversions.h" -#include "base/values.h" -#include "chrome/browser/prefs/pref_service.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/service/service_process_control_manager.h" -#include "chrome/common/pref_names.h" -#include "chrome/common/remoting/chromoting_host_info.h" -#include "content/browser/webui/web_ui.h" -#include "grit/generated_resources.h" -#include "ui/base/l10n/l10n_util.h" - -namespace remoting { - -RemotingOptionsHandler::RemotingOptionsHandler() - : web_ui_(NULL), - process_control_(NULL) { -} - -RemotingOptionsHandler::~RemotingOptionsHandler() { - if (process_control_) - process_control_->RemoveMessageHandler(this); -} - -void RemotingOptionsHandler::Init(WebUI* web_ui) { - web_ui_ = web_ui; - - process_control_ = - ServiceProcessControlManager::GetInstance()->GetProcessControl( - web_ui_->GetProfile()); - process_control_->AddMessageHandler(this); - - PrefService* prefs = web_ui_->GetProfile()->GetPrefs(); - - if (!process_control_->RequestRemotingHostStatus()) { - // Assume that host is not started if we can't request status. - bool enabled = prefs->GetBoolean(prefs::kChromotingEnabled); - bool host_enabled = prefs->GetBoolean(prefs::kChromotingHostEnabled); - SetStatus(enabled, host_enabled, false, ""); - } - prefs->SetBoolean(prefs::kRemotingHasSetupCompleted, false); -} - -// ServiceProcessControl::MessageHandler interface -void RemotingOptionsHandler::OnRemotingHostInfo( - const remoting::ChromotingHostInfo& host_info) { - PrefService* prefs = web_ui_->GetProfile()->GetPrefs(); - bool enabled = prefs->GetBoolean(prefs::kChromotingEnabled); - bool host_enabled = prefs->GetBoolean(prefs::kChromotingHostEnabled); - DCHECK(enabled && host_enabled); - - bool host_configured = host_info.enabled; - SetStatus(enabled, host_enabled, host_configured, host_info.login); -} - -void RemotingOptionsHandler::SetStatus( - bool enabled, bool host_enabled, bool host_configured, - const std::string& login) { - string16 status; - if (enabled) { - if (host_enabled) { - if (host_configured) { - status = l10n_util::GetStringFUTF16(IDS_REMOTING_STATUS_CONFIGURED_TEXT, - UTF8ToUTF16(login)); - } else { - status = l10n_util::GetStringUTF16( - IDS_REMOTING_STATUS_HOST_ENABLED_TEXT); - } - } else { - status = l10n_util::GetStringUTF16(IDS_REMOTING_STATUS_ENABLED_TEXT); - } - } else { - status = l10n_util::GetStringUTF16(IDS_REMOTING_STATUS_DISABLED_TEXT); - } - - FundamentalValue enabled_value(enabled); - FundamentalValue configured_value(host_configured); - StringValue status_value(status); - web_ui_->CallJavascriptFunction( - "options.AdvancedOptions.SetRemotingStatus", - enabled_value, configured_value, status_value); -} - -} // namespace remoting diff --git a/chrome/browser/remoting/remoting_options_handler.h b/chrome/browser/remoting/remoting_options_handler.h deleted file mode 100644 index 77c6ab2..0000000 --- a/chrome/browser/remoting/remoting_options_handler.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2011 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_REMOTING_REMOTING_OPTIONS_HANDLER_H_ -#define CHROME_BROWSER_REMOTING_REMOTING_OPTIONS_HANDLER_H_ - -#include "base/basictypes.h" -#include "chrome/browser/service/service_process_control.h" - -class WebUI; - -namespace remoting { - -// Remoting options handler is responsinble for showing correct status -// of the chromoting host in the preferences. It listens to the -// messages from the service process (by registering MessageHandler -// callback in the ServiceProcessControl) and updates current status -// as neccessary. -class RemotingOptionsHandler : public ServiceProcessControl::MessageHandler { - public: - RemotingOptionsHandler(); - virtual ~RemotingOptionsHandler(); - - void Init(WebUI* web_ui); - - // ServiceProcessControl::MessageHandler interface. - virtual void OnRemotingHostInfo( - const remoting::ChromotingHostInfo& host_info); - - private: - void SetStatus(bool enabled, bool host_enabled, bool host_configured, - const std::string& login); - - WebUI* web_ui_; - ServiceProcessControl* process_control_; - - DISALLOW_COPY_AND_ASSIGN(RemotingOptionsHandler); -}; - -} // namespace remoting - -#endif // CHROME_BROWSER_REMOTING_REMOTING_OPTIONS_HANDLER_H_ diff --git a/chrome/browser/remoting/remoting_resources_source.cc b/chrome/browser/remoting/remoting_resources_source.cc deleted file mode 100644 index 0106836..0000000 --- a/chrome/browser/remoting/remoting_resources_source.cc +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) 2011 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/remoting/remoting_resources_source.h" - -#include <algorithm> -#include <string> - -#include "base/message_loop.h" -#include "base/utf_string_conversions.h" -#include "base/values.h" -#include "chrome/browser/google/google_util.h" -#include "chrome/common/jstemplate_builder.h" -#include "googleurl/src/gurl.h" -#include "grit/app_resources.h" -#include "grit/browser_resources.h" -#include "grit/chromium_strings.h" -#include "grit/generated_resources.h" -#include "grit/locale_settings.h" -#include "ui/base/l10n/l10n_util.h" -#include "ui/base/resource/resource_bundle.h" - -// Define the values of standard URLs. -const char RemotingResourcesSource::kInvalidPasswordHelpUrl[] = - "https://www.google.com/support/accounts/bin/answer.py?ctx=ch&answer=27444"; -const char RemotingResourcesSource::kCanNotAccessAccountUrl[] = - "https://www.google.com/support/accounts/bin/answer.py?answer=48598"; -const char RemotingResourcesSource::kCreateNewAccountUrl[] = - "https://www.google.com/accounts/NewAccount?service=chromiumsync"; - -RemotingResourcesSource::RemotingResourcesSource() - : DataSource(chrome::kChromeUIRemotingResourcesHost, - MessageLoop::current()) { -} - -void RemotingResourcesSource::StartDataRequest(const std::string& path_raw, - bool is_incognito, - int request_id) { - const char kRemotingGaiaLoginPath[] = "gaialogin"; - const char kRemotingSetupFlowPath[] = "setup"; - const char kRemotingSetupDonePath[] = "setupdone"; - const char kRemotingSettingUpPath[] = "settingup"; - const char kRemotingSetupErrorPath[] = "setuperror"; - - std::string response; - if (path_raw == kRemotingGaiaLoginPath) { - DictionaryValue localized_strings; - - // Start by setting the per-locale URLs we show on the setup wizard. - localized_strings.SetString("invalidpasswordhelpurl", - GetLocalizedUrl(kInvalidPasswordHelpUrl)); - localized_strings.SetString("cannotaccessaccounturl", - GetLocalizedUrl(kCanNotAccessAccountUrl)); - localized_strings.SetString("createnewaccounturl", - GetLocalizedUrl(kCreateNewAccountUrl)); - - localized_strings.SetString("settingupsync", - l10n_util::GetStringUTF16(IDS_SYNC_LOGIN_SETTING_UP_SYNC)); - localized_strings.SetString("introduction", ""); - localized_strings.SetString("signinprefix", - l10n_util::GetStringUTF16(IDS_SYNC_LOGIN_SIGNIN_PREFIX)); - localized_strings.SetString("signinsuffix", - l10n_util::GetStringUTF16(IDS_SYNC_LOGIN_SIGNIN_SUFFIX)); - localized_strings.SetString("cannotbeblank", - l10n_util::GetStringUTF16(IDS_SYNC_CANNOT_BE_BLANK)); - localized_strings.SetString("emaillabel", - l10n_util::GetStringUTF16(IDS_SYNC_LOGIN_EMAIL)); - localized_strings.SetString("passwordlabel", - l10n_util::GetStringUTF16(IDS_SYNC_LOGIN_PASSWORD)); - localized_strings.SetString("invalidcredentials", - l10n_util::GetStringUTF16(IDS_SYNC_INVALID_USER_CREDENTIALS)); - localized_strings.SetString("signin", - l10n_util::GetStringUTF16(IDS_SYNC_SIGNIN)); - localized_strings.SetString("couldnotconnect", - l10n_util::GetStringUTF16(IDS_SYNC_LOGIN_COULD_NOT_CONNECT)); - localized_strings.SetString("cannotaccessaccount", - l10n_util::GetStringUTF16(IDS_SYNC_CANNOT_ACCESS_ACCOUNT)); - localized_strings.SetString("createaccount", - l10n_util::GetStringUTF16(IDS_SYNC_CREATE_ACCOUNT)); - localized_strings.SetString("cancel", - l10n_util::GetStringUTF16(IDS_CANCEL)); - localized_strings.SetString("settingup", - l10n_util::GetStringUTF16(IDS_SYNC_LOGIN_SETTING_UP)); - localized_strings.SetString("success", - l10n_util::GetStringUTF16(IDS_SYNC_SUCCESS)); - localized_strings.SetString("errorsigningin", - l10n_util::GetStringUTF16(IDS_SYNC_ERROR_SIGNING_IN)); - localized_strings.SetString("captchainstructions", - l10n_util::GetStringUTF16(IDS_SYNC_GAIA_CAPTCHA_INSTRUCTIONS)); - localized_strings.SetString("invalidaccesscode", - l10n_util::GetStringUTF16(IDS_SYNC_INVALID_ACCESS_CODE_LABEL)); - localized_strings.SetString("enteraccesscode", - l10n_util::GetStringUTF16(IDS_SYNC_ENTER_ACCESS_CODE_LABEL)); - localized_strings.SetString("getaccesscodehelp", - l10n_util::GetStringUTF16(IDS_SYNC_ACCESS_CODE_HELP_LABEL)); - localized_strings.SetString("getaccesscodeurl", - l10n_util::GetStringUTF16(IDS_SYNC_GET_ACCESS_CODE_URL)); - - static const base::StringPiece html(ResourceBundle::GetSharedInstance() - .GetRawDataResource(IDR_GAIA_LOGIN_HTML)); - SetFontAndTextDirection(&localized_strings); - response = jstemplate_builder::GetI18nTemplateHtml( - html, &localized_strings); - } else if (path_raw == kRemotingSettingUpPath) { - DictionaryValue localized_strings; - localized_strings.SetString("settingup", - l10n_util::GetStringUTF16(IDS_REMOTING_SETTING_UP_MESSAGE)); - localized_strings.SetString("cancel", - l10n_util::GetStringUTF16(IDS_CANCEL)); - static const base::StringPiece html(ResourceBundle::GetSharedInstance() - .GetRawDataResource(IDR_REMOTING_SETTING_UP_HTML)); - SetFontAndTextDirection(&localized_strings); - response = jstemplate_builder::GetI18nTemplateHtml( - html, &localized_strings); - } else if (path_raw == kRemotingSetupDonePath) { - DictionaryValue localized_strings; - localized_strings.SetString("success", - l10n_util::GetStringUTF16(IDS_REMOTING_SUCCESS_TITLE)); - localized_strings.SetString("okay", - l10n_util::GetStringUTF16(IDS_OK)); - static const base::StringPiece html(ResourceBundle::GetSharedInstance() - .GetRawDataResource(IDR_REMOTING_SETUP_DONE_HTML)); - SetFontAndTextDirection(&localized_strings); - response = jstemplate_builder::GetI18nTemplateHtml( - html, &localized_strings); - } else if (path_raw == kRemotingSetupErrorPath) { - DictionaryValue localized_strings; - localized_strings.SetString("close", - l10n_util::GetStringUTF16(IDS_CLOSE)); - localized_strings.SetString("retry", - l10n_util::GetStringUTF16(IDS_REMOTING_RETRY_BUTTON_TEXT)); - static const base::StringPiece html(ResourceBundle::GetSharedInstance() - .GetRawDataResource(IDR_REMOTING_SETUP_ERROR_HTML)); - SetFontAndTextDirection(&localized_strings); - response = jstemplate_builder::GetI18nTemplateHtml( - html, &localized_strings); - } else if (path_raw == kRemotingSetupFlowPath) { - static const base::StringPiece html(ResourceBundle::GetSharedInstance() - .GetRawDataResource(IDR_REMOTING_SETUP_FLOW_HTML)); - response = html.as_string(); - } - // Send the response. - scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); - html_bytes->data.resize(response.size()); - std::copy(response.begin(), response.end(), html_bytes->data.begin()); - SendResponse(request_id, html_bytes); -} - -std::string RemotingResourcesSource::GetMimeType( - const std::string& path) const { - return "text/html"; -} - -std::string RemotingResourcesSource::GetLocalizedUrl( - const std::string& url) const { - GURL original_url(url); - DCHECK(original_url.is_valid()); - GURL localized_url = google_util::AppendGoogleLocaleParam(original_url); - return localized_url.spec(); -} diff --git a/chrome/browser/remoting/remoting_resources_source.h b/chrome/browser/remoting/remoting_resources_source.h deleted file mode 100644 index 0a42bce..0000000 --- a/chrome/browser/remoting/remoting_resources_source.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2011 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_REMOTING_REMOTING_RESOURCES_SOURCE_H_ -#define CHROME_BROWSER_REMOTING_REMOTING_RESOURCES_SOURCE_H_ - -#include "base/message_loop.h" -#include "chrome/browser/ui/webui/chrome_url_data_manager.h" -#include "chrome/common/url_constants.h" - -class RemotingResourcesSource : public ChromeURLDataManager::DataSource { - public: - RemotingResourcesSource(); - virtual void StartDataRequest(const std::string& path, - bool is_incognito, - int request_id); - - virtual std::string GetMimeType(const std::string& path) const; - - static const char kInvalidPasswordHelpUrl[]; - static const char kCanNotAccessAccountUrl[]; - static const char kCreateNewAccountUrl[]; - - private: - virtual ~RemotingResourcesSource() {} - - // Takes a string containing an URL and returns an URL containing a CGI - // parameter of the form "&hl=xy" where 'xy' is the language code of the - // current locale. - std::string GetLocalizedUrl(const std::string& url) const; - - DISALLOW_COPY_AND_ASSIGN(RemotingResourcesSource); -}; - -#endif // CHROME_BROWSER_REMOTING_REMOTING_RESOURCES_SOURCE_H_ diff --git a/chrome/browser/remoting/resources/remoting_setting_up.html b/chrome/browser/remoting/resources/remoting_setting_up.html deleted file mode 100644 index df6debf..0000000 --- a/chrome/browser/remoting/resources/remoting_setting_up.html +++ /dev/null @@ -1,34 +0,0 @@ -<html i18n-values="dir:textdirection;"> -<head> -<title></title> -<link rel="stylesheet" type="text/css" href="remoting_setup_flow.css" /> -<style type="text/css"> -#throbber { - margin: -3px 10px; -} -#setting_up { - margin: 60px; - text-align: center; -} -#setting_up_label { - margin: 15px; - font-weight: bold; - font-size: 125%; -} -</style> -<link rel="stylesheet" href="chrome://resources/css/throbber.css"> -<script src="chrome://resources/js/cr.js"></script> -</head> -<body i18n-values=".style.fontFamily:fontfamily"> -<form id="settingUpForm" onSubmit="return false;"> - <div id="setting_up"> - <div id="throbber" class="throbber"></div> - <div id="setting_up_label" i18n-content="settingup"></div> - </div> - <div class="remoting-footer"> - <input id="cancelButton" type="button" i18n-values="value:cancel" - onclick='chrome.send("DialogClose", [""])' /> - </div> -</form> -</body> -</html> diff --git a/chrome/browser/remoting/resources/remoting_setup_done.html b/chrome/browser/remoting/resources/remoting_setup_done.html deleted file mode 100644 index 494dab0..0000000 --- a/chrome/browser/remoting/resources/remoting_setup_done.html +++ /dev/null @@ -1,29 +0,0 @@ -<html i18n-values="dir:textdirection;"> -<head> -<title></title> -<link rel="stylesheet" type="text/css" href="remoting_setup_flow.css" /> -<script> - function setShowFirstTimeSetupSummary() { - document.getElementById("summary").innerHTML = - templateData['firsttimesetupsummary']; - } - function setMessage(msg) { - document.getElementById('msgContent').innerHTML = msg; - } - function onPageShown() { - document.getElementById("close").focus(); - } -</script> -</head> -<body i18n-values=".style.fontFamily:fontfamily"> - <div class="remoting-header" i18n-content="success"></div> - <div class="remoting-success-image"> - <img src="../../resources/options/success-large.png" /> - </div> - <div id="msgContent"></div> - <div class="remoting-footer"> - <input id="close" type="submit" i18n-values="value:okay" - onclick='chrome.send("DialogClose", [""])' /> - </div> -</body> -</html> diff --git a/chrome/browser/remoting/resources/remoting_setup_error.html b/chrome/browser/remoting/resources/remoting_setup_error.html deleted file mode 100644 index 807b264..0000000 --- a/chrome/browser/remoting/resources/remoting_setup_error.html +++ /dev/null @@ -1,23 +0,0 @@ -<html i18n-values="dir:textdirection;"> -<head> -<title></title> -<link rel="stylesheet" type="text/css" href="remoting_setup_flow.css" /> -<script> - function setMessage(msg) { - document.getElementById('msgContent').innerHTML = msg; - } - function onPageShown() { - document.getElementById("close").focus(); - } -</script> -</head> -<body i18n-values=".style.fontFamily:fontfamily"> - <div id="msgContent"></div> - <div class="remoting-footer"> - <input id="retry" type="submit" i18n-values="value:retry" - onclick='chrome.send("RemotingSetup", ["Retry"])' /> - <input id="close" type="submit" i18n-values="value:close" - onclick='chrome.send("DialogClose", [""])' /> - </div> -</body> -</html> diff --git a/chrome/browser/remoting/resources/remoting_setup_flow.css b/chrome/browser/remoting/resources/remoting_setup_flow.css deleted file mode 100644 index 467322e..0000000 --- a/chrome/browser/remoting/resources/remoting_setup_flow.css +++ /dev/null @@ -1,40 +0,0 @@ -body { - background: #FFFFFF; - font-size: 11pt; - line-height: 1.5em; - margin: 10px 15px; - -webkit-user-select: none; -} -.remoting-header { - font-size: 1.2em; - font-weight: bold; -} -.remoting-success-image { - text-align: center; - margin: 20px; -} -#message { - font-weight: bold; -} -.remoting-footer { - position: fixed; - right: 0px; - bottom: 0px; - margin-right: 10px; - margin-bottom: 10px; -} -html[dir='rtl'] .remoting-footer { - text-align: left; - left: 0px; - bottom: 0px; - margin-left: 20px; -} -input[type='button'], -input[type='submit'] { - min-width: 87px; - min-height: 26px; -} -html[os='mac'] input[type='button'], -html[os='mac'] input[type='submit'] { - font-size: 12pt; -} diff --git a/chrome/browser/remoting/resources/remoting_setup_flow.html b/chrome/browser/remoting/resources/remoting_setup_flow.html deleted file mode 100644 index 97544b9..0000000 --- a/chrome/browser/remoting/resources/remoting_setup_flow.html +++ /dev/null @@ -1,70 +0,0 @@ -<html id='t'> -<head> -<title></title> -<style type="text/css"> -body { - margin:0; - border:0; -} -.setup-flow-page { - display: none; - width: 100%; - height: 100%; - overflow: hidden; - border: 0; -} -</style> -<script type="text/javascript"> - // Called once, when this html/js is loaded. - function showTheRightIframe() { - hideAllPages(); - var args = JSON.parse(chrome.dialogArguments); - document.getElementById(args.iframeToShow).style.display = 'block'; - document.getElementById(args.iframeToShow).tabIndex = 0; - } - - function hideAllPages() { - document.getElementById('login').style.display = 'none'; - document.getElementById('login').tabIndex = -1; - document.getElementById('settingup').style.display = 'none'; - document.getElementById('settingup').tabIndex = -1; - document.getElementById('done').style.display = 'none'; - document.getElementById('done').tabIndex = -1; - document.getElementById('error').style.display = 'none'; - document.getElementById('error').tabIndex = -1; - } - - function showPage(page) { - hideAllPages(); - document.getElementById(page).style.display = 'block'; - document.getElementById(page).tabIndex = 0; - } - - function showLogin() { - showPage('login') - } - - function showSettingUp() { - showPage('settingup') - } - - function showSetupDone() { - showPage('done') - } - - function showError() { - showPage('error') - } -</script> -</head> -<body onload="showTheRightIframe();"> - <iframe id="login" class="setup-flow-page" tabindex="-1" - src="chrome://remotingresources/gaialogin"></iframe> - <iframe id="settingup" class="setup-flow-page" tabindex="-1" - src="chrome://remotingresources/settingup"></iframe> - <iframe id="done" class="setup-flow-page" tabindex="-1" - src="chrome://remotingresources/setupdone"></iframe> - <iframe id="error" class="setup-flow-page" tabindex="-1" - src="chrome://remotingresources/setuperror"></iframe> -</body> -</html> diff --git a/chrome/browser/remoting/setup_flow.cc b/chrome/browser/remoting/setup_flow.cc deleted file mode 100644 index 0309d07..0000000 --- a/chrome/browser/remoting/setup_flow.cc +++ /dev/null @@ -1,269 +0,0 @@ -// Copyright (c) 2011 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/remoting/setup_flow.h" - -#include "base/json/json_reader.h" -#include "base/json/json_writer.h" -#include "base/utf_string_conversions.h" -#include "base/values.h" -#include "chrome/browser/prefs/pref_service.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/remoting/remoting_resources_source.h" -#include "chrome/browser/remoting/setup_flow_login_step.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_list.h" -#include "chrome/common/pref_names.h" -#include "content/browser/browser_thread.h" -#include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/tab_contents/tab_contents.h" -#include "grit/generated_resources.h" -#include "grit/locale_settings.h" -#include "ui/base/l10n/l10n_font_util.h" -#include "ui/base/l10n/l10n_util.h" -#include "ui/gfx/font.h" - -namespace remoting { - -static const wchar_t kDoneIframeXPath[] = L"//iframe[@id='done']"; -static const wchar_t kErrorIframeXPath[] = L"//iframe[@id='error']"; - -SetupFlowStep::SetupFlowStep() { } -SetupFlowStep::~SetupFlowStep() { } - -SetupFlowStepBase::SetupFlowStepBase() - : flow_(NULL), - done_(false), - next_step_(NULL) { -} - -SetupFlowStepBase::~SetupFlowStepBase() { } - -void SetupFlowStepBase::Start(SetupFlow* flow, DoneCallback* done_callback) { - done_callback_.reset(done_callback); - flow_ = flow; - DoStart(); -} - -SetupFlowStep* SetupFlowStepBase::GetNextStep() { - DCHECK(done_); - return next_step_; -} - -void SetupFlowStepBase::ExecuteJavascriptInIFrame( - const std::wstring& iframe_xpath, const std::wstring& js) { - WebUI* web_ui = flow()->web_ui(); - DCHECK(web_ui); - - RenderViewHost* rvh = web_ui->tab_contents()->render_view_host(); - rvh->ExecuteJavascriptInWebFrame(WideToUTF16Hack(iframe_xpath), - WideToUTF16Hack(js)); -} - -void SetupFlowStepBase::FinishStep(SetupFlowStep* next_step) { - next_step_ = next_step; - done_ = true; - done_callback_->Run(); -} - -SetupFlowErrorStepBase::SetupFlowErrorStepBase() { } -SetupFlowErrorStepBase::~SetupFlowErrorStepBase() { } - -void SetupFlowErrorStepBase::HandleMessage(const std::string& message, - const Value* arg) { - if (message == "Retry") { - Retry(); - } -} - -void SetupFlowErrorStepBase::Cancel() { } - -void SetupFlowErrorStepBase::DoStart() { - std::wstring javascript = - L"setMessage('" + UTF16ToWide(GetErrorMessage()) + L"');"; - ExecuteJavascriptInIFrame(kErrorIframeXPath, javascript); - - flow()->web_ui()->CallJavascriptFunction("showError"); - - ExecuteJavascriptInIFrame(kErrorIframeXPath, L"onPageShown();"); -} - -SetupFlowDoneStep::SetupFlowDoneStep() { - message_ = l10n_util::GetStringUTF16(IDS_REMOTING_SUCCESS_MESSAGE); -} - -SetupFlowDoneStep::SetupFlowDoneStep(const string16& message) - : message_(message) { -} - -SetupFlowDoneStep::~SetupFlowDoneStep() { } - -void SetupFlowDoneStep::HandleMessage(const std::string& message, - const Value* arg) { -} - -void SetupFlowDoneStep::Cancel() { } - -void SetupFlowDoneStep::DoStart() { - std::wstring javascript = - L"setMessage('" + UTF16ToWide(message_) + L"');"; - ExecuteJavascriptInIFrame(kDoneIframeXPath, javascript); - - flow()->web_ui()->CallJavascriptFunction("showSetupDone"); - - ExecuteJavascriptInIFrame(kDoneIframeXPath, L"onPageShown();"); -} - -SetupFlowContext::SetupFlowContext() { } -SetupFlowContext::~SetupFlowContext() { } - -SetupFlow::SetupFlow(const std::string& args, - Profile* profile, - SetupFlowStep* first_step) - : web_ui_(NULL), - dialog_start_args_(args), - profile_(profile), - current_step_(first_step) { - // TODO(hclam): The data source should be added once. - profile->GetChromeURLDataManager()->AddDataSource( - new RemotingResourcesSource()); -} - -SetupFlow::~SetupFlow() { } - -// static -SetupFlow* SetupFlow::OpenSetupDialog(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); - - std::string json_args; - base::JSONWriter::Write(&args, false, &json_args); - - Browser* b = BrowserList::GetLastActive(); - if (!b) - return NULL; - - SetupFlow *flow = new SetupFlow(json_args, profile, new SetupFlowLoginStep()); - b->BrowserShowHtmlDialog(flow, NULL); - return flow; -} - -GURL SetupFlow::GetDialogContentURL() const { - return GURL("chrome://remotingresources/setup"); -} - -void SetupFlow::GetWebUIMessageHandlers( - std::vector<WebUIMessageHandler*>* handlers) const { - // The called will be responsible for deleting this object. - handlers->push_back(const_cast<SetupFlow*>(this)); -} - -void SetupFlow::GetDialogSize(gfx::Size* size) const { - PrefService* prefs = profile_->GetPrefs(); - gfx::Font approximate_web_font( - UTF8ToUTF16(prefs->GetString(prefs::kWebKitSansSerifFontFamily)), - prefs->GetInteger(prefs::kWebKitDefaultFontSize)); - - // TODO(pranavk) Replace the following SYNC resources with REMOTING Resources. - *size = ui::GetLocalizedContentsSizeForFont( - IDS_REMOTING_SETUP_WIZARD_WIDTH_CHARS, - IDS_REMOTING_SETUP_WIZARD_HEIGHT_LINES, - approximate_web_font); -} - -// A callback to notify the delegate that the dialog closed. -void SetupFlow::OnDialogClosed(const std::string& json_retval) { - if (current_step_ != NULL) - current_step_->Cancel(); -} - -std::string SetupFlow::GetDialogArgs() const { - return dialog_start_args_; -} - -void SetupFlow::OnCloseContents(TabContents* source, - bool* out_close_dialog) { -} - -std::wstring SetupFlow::GetDialogTitle() const { - return UTF16ToWideHack( - l10n_util::GetStringUTF16(IDS_REMOTING_SETUP_DIALOG_TITLE)); -} - -bool SetupFlow::IsDialogModal() const { - return false; -} - -bool SetupFlow::ShouldShowDialogTitle() const { - return true; -} - -WebUIMessageHandler* SetupFlow::Attach(WebUI* web_ui) { - web_ui_ = web_ui; - StartCurrentStep(); - return WebUIMessageHandler::Attach(web_ui); -} - -void SetupFlow::RegisterMessages() { - web_ui_->RegisterMessageCallback( - "SubmitAuth", NewCallback(this, &SetupFlow::HandleSubmitAuth)); - web_ui_->RegisterMessageCallback( - "RemotingSetup", NewCallback(this, &SetupFlow::HandleUIMessage)); -} - -void SetupFlow::HandleSubmitAuth(const ListValue* args) { - Value* first_arg = NULL; - if (!args->Get(0, &first_arg)) { - NOTREACHED(); - return; - } - - current_step_->HandleMessage("SubmitAuth", first_arg); -} - -void SetupFlow::HandleUIMessage(const ListValue* args) { - std::string message; - Value* message_value; - if (!args->Get(0, &message_value) || - !message_value->GetAsString(&message)) { - NOTREACHED(); - return; - } - - // Message argument is optional and set to NULL if it is not - // provided by the sending page. - Value* arg_value = NULL; - if (args->GetSize() >= 2) { - if (!args->Get(1, &arg_value)) { - NOTREACHED(); - return; - } - } - - current_step_->HandleMessage(message, arg_value); -} - -void SetupFlow::StartCurrentStep() { - current_step_->Start(this, NewCallback(this, &SetupFlow::OnStepDone)); -} - -void SetupFlow::OnStepDone() { - SetupFlowStep* next_step = current_step_->GetNextStep(); - - if (current_step_.get()) { - // Can't destroy current step here. Schedule it to be destroyed later. - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - new DeleteTask<SetupFlowStep>(current_step_.release())); - } - - current_step_.reset(next_step); - StartCurrentStep(); -} - -} // namespace remoting diff --git a/chrome/browser/remoting/setup_flow.h b/chrome/browser/remoting/setup_flow.h deleted file mode 100644 index c952bd6..0000000 --- a/chrome/browser/remoting/setup_flow.h +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright (c) 2011 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_REMOTING_SETUP_FLOW_H_ -#define CHROME_BROWSER_REMOTING_SETUP_FLOW_H_ - -#include "base/callback.h" -#include "base/memory/scoped_ptr.h" -#include "chrome/browser/ui/webui/html_dialog_ui.h" -#include "chrome/common/remoting/chromoting_host_info.h" -#include "content/browser/webui/web_ui.h" - -class ListValue; -class ServiceProcessControl; - -namespace remoting { - -class SetupFlow; - -// SetupFlowStep represents a single step for SetupFlow, e.g. login or -// host registration. When a step is finished, GetNextStep() is called -// to get the step that must follow. -class SetupFlowStep { - public: - typedef Callback0::Type DoneCallback; - - SetupFlowStep(); - virtual ~SetupFlowStep(); - - // Start the step. Ownership of |done_callback| is given to the - // function. |done_callback| is called when the step is finished, - // The callback must be called on the same thread as Start(). - virtual void Start(SetupFlow* flow, DoneCallback* done_callback) = 0; - - // Called to handle |message| received from UI. |args| may be set to - // NULL. - virtual void HandleMessage(const std::string& message, const Value* arg) = 0; - - // Called if user closes the dialog. - virtual void Cancel() = 0; - - // Returns SetupFlowStep object that corresponds to the next - // step. Must never return NULL. - virtual SetupFlowStep* GetNextStep() = 0; - - private: - DISALLOW_COPY_AND_ASSIGN(SetupFlowStep); -}; - -// SetupFlowStepBase implements base functions common for all -// SetupFlowStep implementations. -class SetupFlowStepBase : public SetupFlowStep { - public: - SetupFlowStepBase(); - ~SetupFlowStepBase(); - - // SetupFlowStep implementation. - virtual void Start(SetupFlow* flow, DoneCallback* done_callback); - virtual SetupFlowStep* GetNextStep(); - - protected: - SetupFlow* flow() { return flow_; } - - void ExecuteJavascriptInIFrame(const std::wstring& iframe_xpath, - const std::wstring& js); - - // Finish current step. Calls |done_callback| specified in Start(). - // GetNextStep() will return the specified |next_step|. - void FinishStep(SetupFlowStep* next_step); - - // Called from Start(). Child classes must override this method - // instead of Start(). - virtual void DoStart() = 0; - - private: - SetupFlow* flow_; - scoped_ptr<DoneCallback> done_callback_; - bool done_; - - // Next step stored between Done() and GetNextStep(); - SetupFlowStep* next_step_; - - DISALLOW_COPY_AND_ASSIGN(SetupFlowStepBase); -}; - -// Base class for error steps. It shows the error message returned by -// GetErrorMessage() and Retry button. -class SetupFlowErrorStepBase : public SetupFlowStepBase { - public: - SetupFlowErrorStepBase(); - virtual ~SetupFlowErrorStepBase(); - - // SetupFlowStep implementation. - virtual void HandleMessage(const std::string& message, const Value* arg); - virtual void Cancel(); - - protected: - virtual void DoStart(); - - // Returns error message that is shown to the user. - virtual string16 GetErrorMessage() = 0; - - // Called when user clicks Retry button. Normally this methoud just - // calls FinishStep() with an appropriate next step. - virtual void Retry() = 0; - - private: - DISALLOW_COPY_AND_ASSIGN(SetupFlowErrorStepBase); -}; - -// The last step in the setup flow. This step never finishes, user is -// expected to close dialog after that. -class SetupFlowDoneStep : public SetupFlowStepBase { - public: - SetupFlowDoneStep(); - explicit SetupFlowDoneStep(const string16& message); - virtual ~SetupFlowDoneStep(); - - // SetupFlowStep implementation. - virtual void HandleMessage(const std::string& message, const Value* arg); - virtual void Cancel(); - - protected: - virtual void DoStart(); - - private: - string16 message_; - - DISALLOW_COPY_AND_ASSIGN(SetupFlowDoneStep); -}; - -// SetupFlowContext stores data that needs to be passed between -// different setup flow steps. -struct SetupFlowContext { - SetupFlowContext(); - ~SetupFlowContext(); - - std::string login; - std::string remoting_token; - std::string talk_token; - - ChromotingHostInfo host_info; -}; - -// This class is responsible for showing a remoting setup dialog and -// perform operations to fill the content of the dialog and handle -// user actions in the dialog. -// -// Each page in the setup flow may send message to the current -// step. In order to do that it must use send a RemotingSetup message -// and specify message name as the first value in the argument -// list. For example the following code sends Retry message to the -// current step: -// -// chrome.send("RemotingSetup", ["Retry"]) -// -// Assitional message parameters may be provided via send value in the -// arguments list, e.g.: -// -// chrome.send("RemotingSetup", ["SubmitAuth", auth_data]) -// -// In this case auth_data would be passed in -// SetupFlowStep::HandleMessage(). -class SetupFlow : public WebUIMessageHandler, - public HtmlDialogUIDelegate { - public: - virtual ~SetupFlow(); - - static SetupFlow* OpenSetupDialog(Profile* profile); - - WebUI* web_ui() { return web_ui_; } - Profile* profile() { return profile_; } - SetupFlowContext* context() { return &context_; } - - private: - explicit SetupFlow(const std::string& args, Profile* profile, - SetupFlowStep* first_step); - - // HtmlDialogUIDelegate implementation. - virtual GURL GetDialogContentURL() const; - virtual void GetWebUIMessageHandlers( - std::vector<WebUIMessageHandler*>* 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; - virtual bool ShouldShowDialogTitle() const; - - // WebUIMessageHandler implementation. - virtual WebUIMessageHandler* Attach(WebUI* web_ui); - virtual void RegisterMessages(); - - // Message handlers for the messages we receive from UI. - void HandleSubmitAuth(const ListValue* args); - void HandleUIMessage(const ListValue* args); - - void StartCurrentStep(); - void OnStepDone(); - - // Pointer to the Web UI. This is provided by RemotingSetupMessageHandler - // when attached. - WebUI* web_ui_; - - // The args to pass to the initial page. - std::string dialog_start_args_; - Profile* profile_; - - SetupFlowContext context_; - - scoped_ptr<SetupFlowStep> current_step_; - - DISALLOW_COPY_AND_ASSIGN(SetupFlow); -}; - -} // namespace remoting - -#endif // CHROME_BROWSER_REMOTING_SETUP_FLOW_H_ diff --git a/chrome/browser/remoting/setup_flow_get_status_step.cc b/chrome/browser/remoting/setup_flow_get_status_step.cc deleted file mode 100644 index e21965c..0000000 --- a/chrome/browser/remoting/setup_flow_get_status_step.cc +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) 2011 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/remoting/setup_flow_get_status_step.h" - -#include "chrome/browser/remoting/setup_flow_register_step.h" -#include "chrome/browser/service/service_process_control.h" -#include "chrome/browser/service/service_process_control_manager.h" -#include "grit/generated_resources.h" -#include "ui/base/l10n/l10n_util.h" - -namespace remoting { - -SetupFlowGetStatusStep::SetupFlowGetStatusStep() - : ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), - status_requested_(false) { -} - -SetupFlowGetStatusStep::~SetupFlowGetStatusStep() { - if (process_control_) - process_control_->RemoveMessageHandler(this); -} - -void SetupFlowGetStatusStep::HandleMessage(const std::string& message, - const Value* arg) { -} - -void SetupFlowGetStatusStep::Cancel() { - if (process_control_) - process_control_->RemoveMessageHandler(this); -} - -void SetupFlowGetStatusStep::OnRemotingHostInfo( - const remoting::ChromotingHostInfo& host_info) { - if (status_requested_) { - flow()->context()->host_info = host_info; - status_requested_ = false; - FinishStep(new SetupFlowRegisterStep()); - } -} - -void SetupFlowGetStatusStep::DoStart() { - flow()->web_ui()->CallJavascriptFunction("showSettingUp"); - - process_control_ = - ServiceProcessControlManager::GetInstance()->GetProcessControl( - flow()->profile()); - if (!process_control_->is_connected()) { - LaunchServiceProcess(); - } else { - RequestStatus(); - } -} - -void SetupFlowGetStatusStep::LaunchServiceProcess() { - Task* done_task = task_factory_.NewRunnableMethod( - &SetupFlowGetStatusStep::OnServiceProcessLaunched); - process_control_->Launch(done_task, done_task); -} - -void SetupFlowGetStatusStep::OnServiceProcessLaunched() { - if (!process_control_->is_connected()) { - // Failed to start service process. - FinishStep(new SetupFlowGetStatusErrorStep()); - } else { - RequestStatus(); - } -} - -void SetupFlowGetStatusStep::RequestStatus() { - DCHECK(!status_requested_); - - if (!process_control_->RequestRemotingHostStatus()) { - FinishStep(new SetupFlowGetStatusErrorStep()); - return; - } - - status_requested_ = true; - process_control_->AddMessageHandler(this); -} - -SetupFlowGetStatusErrorStep::SetupFlowGetStatusErrorStep() { } -SetupFlowGetStatusErrorStep::~SetupFlowGetStatusErrorStep() { } - -string16 SetupFlowGetStatusErrorStep::GetErrorMessage() { - return l10n_util::GetStringUTF16(IDS_REMOTING_SERVICE_PROCESS_FAILED_MESSAGE); -} - -void SetupFlowGetStatusErrorStep::Retry() { - FinishStep(new SetupFlowGetStatusStep()); -} - -} // namespace remoting diff --git a/chrome/browser/remoting/setup_flow_get_status_step.h b/chrome/browser/remoting/setup_flow_get_status_step.h deleted file mode 100644 index 7968d78e1..0000000 --- a/chrome/browser/remoting/setup_flow_get_status_step.h +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2011 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_REMOTING_SETUP_FLOW_GET_STATUS_STEP_H_ -#define CHROME_BROWSER_REMOTING_SETUP_FLOW_GET_STATUS_STEP_H_ - -#include "chrome/browser/remoting/setup_flow.h" -#include "chrome/browser/service/service_process_control.h" -#include "chrome/common/net/gaia/gaia_auth_consumer.h" -#include "chrome/common/net/gaia/gaia_auth_fetcher.h" - -namespace remoting { - -// SetupFlowGetStatusStep requests current host information from the service -// process. It also starts service process if necessary. -class SetupFlowGetStatusStep : public SetupFlowStepBase, - public ServiceProcessControl::MessageHandler { - public: - SetupFlowGetStatusStep(); - virtual ~SetupFlowGetStatusStep(); - - // SetupFlowStep implementation. - virtual void HandleMessage(const std::string& message, const Value* arg); - virtual void Cancel(); - - // ServiceProcessControl::MessageHandler interface - virtual void OnRemotingHostInfo( - const remoting::ChromotingHostInfo& host_info); - - protected: - virtual void DoStart(); - - private: - void LaunchServiceProcess(); - void OnServiceProcessLaunched(); - void RequestStatus(); - - ScopedRunnableMethodFactory<SetupFlowGetStatusStep> task_factory_; - ServiceProcessControl* process_control_; - bool status_requested_; - - DISALLOW_COPY_AND_ASSIGN(SetupFlowGetStatusStep); -}; - -class SetupFlowGetStatusErrorStep : public SetupFlowErrorStepBase { - public: - SetupFlowGetStatusErrorStep(); - virtual ~SetupFlowGetStatusErrorStep(); - - protected: - virtual string16 GetErrorMessage(); - virtual void Retry(); - - private: - DISALLOW_COPY_AND_ASSIGN(SetupFlowGetStatusErrorStep); -}; - -} // namespace remoting - -#endif // CHROME_BROWSER_REMOTING_SETUP_FLOW_GET_STATUS_STEP_H_ diff --git a/chrome/browser/remoting/setup_flow_login_step.cc b/chrome/browser/remoting/setup_flow_login_step.cc deleted file mode 100644 index d69afe2..0000000 --- a/chrome/browser/remoting/setup_flow_login_step.cc +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) 2011 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/remoting/setup_flow_login_step.h" - -#include "base/json/json_reader.h" -#include "base/json/json_writer.h" -#include "base/string_util.h" -#include "base/utf_string_conversions.h" -#include "base/values.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/remoting/setup_flow_get_status_step.h" -#include "chrome/common/net/gaia/gaia_constants.h" -#include "chrome/common/net/gaia/google_service_auth_error.h" - -namespace remoting { - -static const wchar_t kLoginIFrameXPath[] = L"//iframe[@id='login']"; - -SetupFlowLoginStep::SetupFlowLoginStep() { } - -SetupFlowLoginStep::SetupFlowLoginStep(const string16& error_message) - : error_message_(error_message) { -} - -SetupFlowLoginStep::~SetupFlowLoginStep() { } - -void SetupFlowLoginStep::HandleMessage(const std::string& message, - const Value* arg) { - if (message == "SubmitAuth") { - DCHECK(arg); - - std::string json; - if (!arg->GetAsString(&json) || json.empty()) { - NOTREACHED(); - 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; - } - - CHECK(parsed_value->IsType(Value::TYPE_DICTIONARY)); - - std::string username, password, captcha, access_code; - const DictionaryValue* result = - static_cast<const DictionaryValue*>(parsed_value.get()); - if (!result->GetString("user", &username) || - !result->GetString("pass", &password) || - !result->GetString("captcha", &captcha) || - !result->GetString("access_code", &access_code)) { - NOTREACHED() << "Unable to parse auth data"; - return; - } - - OnUserSubmittedAuth(username, password, captcha, access_code); - } -} - -void SetupFlowLoginStep::Cancel() { - if (authenticator_.get()) - authenticator_->CancelRequest(); -} - -void SetupFlowLoginStep::OnUserSubmittedAuth(const std::string& user, - const std::string& password, - const std::string& captcha, - const std::string& access_code) { - flow()->context()->login = user; - - // Start the authenticator. - authenticator_.reset( - new GaiaAuthFetcher(this, GaiaConstants::kChromeSource, - flow()->profile()->GetRequestContext())); - - std::string remoting_password; - if (!access_code.empty()) - remoting_password = access_code; - else - remoting_password = password; - - authenticator_->StartClientLogin(user, remoting_password, - GaiaConstants::kRemotingService, - "", captcha, - GaiaAuthFetcher::HostedAccountsAllowed); -} - -void SetupFlowLoginStep::OnClientLoginSuccess( - const GaiaAuthConsumer::ClientLoginResult& credentials) { - // Save the token for remoting. - flow()->context()->remoting_token = credentials.token; - - // After login has succeeded try to fetch the token for sync. - // We need the token for sync to connect to the talk network. - authenticator_->StartIssueAuthToken(credentials.sid, credentials.lsid, - GaiaConstants::kSyncService); -} - -void SetupFlowLoginStep::OnClientLoginFailure( - const GoogleServiceAuthError& error) { - ShowGaiaFailed(error); - authenticator_.reset(); -} - -void SetupFlowLoginStep::OnIssueAuthTokenSuccess( - const std::string& service, const std::string& auth_token) { - // Save the sync token. - flow()->context()->talk_token = auth_token; - authenticator_.reset(); - - FinishStep(new SetupFlowGetStatusStep()); -} - -void SetupFlowLoginStep::OnIssueAuthTokenFailure(const std::string& service, - const GoogleServiceAuthError& error) { - ShowGaiaFailed(error); - authenticator_.reset(); -} - -void SetupFlowLoginStep::DoStart() { - DictionaryValue args; - // TODO(sergeyu): Supply current login name if the service was started before. - args.SetString("user", ""); - args.SetBoolean("editable_user", true); - if (!error_message_.empty()) - args.SetString("error_message", error_message_); - ShowGaiaLogin(args); -} - -void SetupFlowLoginStep::ShowGaiaLogin(const DictionaryValue& args) { - WebUI* web_ui = flow()->web_ui(); - DCHECK(web_ui); - - web_ui->CallJavascriptFunction("showLogin"); - - std::string json; - base::JSONWriter::Write(&args, false, &json); - std::wstring javascript = std::wstring(L"showGaiaLogin(") + - UTF8ToWide(json) + L");"; - ExecuteJavascriptInIFrame(kLoginIFrameXPath, javascript); -} - -void SetupFlowLoginStep::ShowGaiaFailed(const GoogleServiceAuthError& error) { - DictionaryValue args; - args.SetInteger("error", error.state()); - args.SetBoolean("editable_user", true); - args.SetString("captchaUrl", error.captcha().image_url.spec()); - ShowGaiaLogin(args); -} - -} // namespace remoting diff --git a/chrome/browser/remoting/setup_flow_login_step.h b/chrome/browser/remoting/setup_flow_login_step.h deleted file mode 100644 index 6a41d99..0000000 --- a/chrome/browser/remoting/setup_flow_login_step.h +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2011 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_REMOTING_SETUP_FLOW_LOGIN_STEP_H_ -#define CHROME_BROWSER_REMOTING_SETUP_FLOW_LOGIN_STEP_H_ - -#include "chrome/browser/remoting/setup_flow.h" -#include "chrome/common/net/gaia/gaia_auth_consumer.h" -#include "chrome/common/net/gaia/gaia_auth_fetcher.h" - -namespace remoting { - -// Implementation of login step for remoting setup flow. -class SetupFlowLoginStep : public SetupFlowStepBase, public GaiaAuthConsumer { - public: - SetupFlowLoginStep(); - SetupFlowLoginStep(const string16& error_message); - virtual ~SetupFlowLoginStep(); - - // SetupFlowStep implementation. - virtual void HandleMessage(const std::string& message, const Value* arg); - virtual void Cancel(); - - // GaiaAuthConsumer implementation. - virtual void OnClientLoginSuccess( - const GaiaAuthConsumer::ClientLoginResult& credentials); - virtual void OnClientLoginFailure(const GoogleServiceAuthError& error); - virtual void OnIssueAuthTokenSuccess(const std::string& service, - const std::string& auth_token); - virtual void OnIssueAuthTokenFailure(const std::string& service, - const GoogleServiceAuthError& error); - - protected: - virtual void DoStart(); - - private: - void OnUserSubmittedAuth(const std::string& user, - const std::string& password, - const std::string& captcha, - const std::string& access_code); - - void ShowGaiaLogin(const DictionaryValue& args); - void ShowGaiaSuccessAndSettingUp(); - void ShowGaiaFailed(const GoogleServiceAuthError& error); - - string16 error_message_; - - // Fetcher to obtain the Chromoting Directory token. - scoped_ptr<GaiaAuthFetcher> authenticator_; - - DISALLOW_COPY_AND_ASSIGN(SetupFlowLoginStep); -}; - -} // namespace remoting - -#endif // CHROME_BROWSER_REMOTING_SETUP_FLOW_LOGIN_STEP_H_ diff --git a/chrome/browser/remoting/setup_flow_register_step.cc b/chrome/browser/remoting/setup_flow_register_step.cc deleted file mode 100644 index 1811fa2..0000000 --- a/chrome/browser/remoting/setup_flow_register_step.cc +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2011 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/remoting/setup_flow_register_step.h" - -#include "base/callback_old.h" -#include "chrome/browser/prefs/pref_service.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/remoting/setup_flow_login_step.h" -#include "chrome/browser/remoting/setup_flow_start_host_step.h" -#include "chrome/common/pref_names.h" -#include "grit/generated_resources.h" -#include "ui/base/l10n/l10n_util.h" - -namespace remoting { - -SetupFlowRegisterStep::SetupFlowRegisterStep() { } -SetupFlowRegisterStep::~SetupFlowRegisterStep() { } - -void SetupFlowRegisterStep::HandleMessage(const std::string& message, - const Value* arg) { -} - -void SetupFlowRegisterStep::Cancel() { - // Don't need to do anything here. The request will be canceled when - // |request_| is destroyed. -} - -void SetupFlowRegisterStep::DoStart() { - flow()->web_ui()->CallJavascriptFunction("showSettingUp"); - - request_.reset(new DirectoryAddRequest( - flow()->profile()->GetRequestContext())); - request_->AddHost(flow()->context()->host_info, - flow()->context()->remoting_token, - NewCallback(this, &SetupFlowRegisterStep::OnRequestDone)); -} - -void SetupFlowRegisterStep::SetRemotingEnabled() { - flow()->profile()->GetPrefs()->SetBoolean( - prefs::kRemotingHasSetupCompleted, true); -} - -void SetupFlowRegisterStep::OnRequestDone(DirectoryAddRequest::Result result, - const std::string& error_message) { - switch (result) { - case DirectoryAddRequest::SUCCESS: - SetRemotingEnabled(); - FinishStep(new SetupFlowStartHostStep()); - break; - case DirectoryAddRequest::ERROR_EXISTS: - SetRemotingEnabled(); - LOG(INFO) << "Chromoting host is already registered."; - FinishStep(new SetupFlowStartHostStep()); - break; - case DirectoryAddRequest::ERROR_AUTH: - LOG(ERROR) << "Access denied by Chromoting Directory."; - FinishStep(new SetupFlowLoginStep(l10n_util::GetStringUTF16( - IDS_REMOTING_REGISTRATION_ACCESS_DENIED))); - break; - default: - LOG(ERROR) << "Chromoting Host registration failed: " - << error_message << " (" << result << ")"; - FinishStep(new SetupFlowRegisterErrorStep()); - break; - } -} - -SetupFlowRegisterErrorStep::SetupFlowRegisterErrorStep() { } -SetupFlowRegisterErrorStep::~SetupFlowRegisterErrorStep() { } - -string16 SetupFlowRegisterErrorStep::GetErrorMessage() { - return l10n_util::GetStringUTF16(IDS_REMOTING_REGISTRATION_FAILED_MESSAGE); -} - -void SetupFlowRegisterErrorStep::Retry() { - // When retrying we retry from the GetStatus step because it may be - // necessary to start service process. - FinishStep(new SetupFlowRegisterStep()); -} - -} // namespace remoting diff --git a/chrome/browser/remoting/setup_flow_register_step.h b/chrome/browser/remoting/setup_flow_register_step.h deleted file mode 100644 index 69a6e39..0000000 --- a/chrome/browser/remoting/setup_flow_register_step.h +++ /dev/null @@ -1,55 +0,0 @@ -// 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_REMOTING_SETUP_FLOW_REGISTER_STEP_H_ -#define CHROME_BROWSER_REMOTING_SETUP_FLOW_REGISTER_STEP_H_ - -#include "chrome/browser/remoting/directory_add_request.h" -#include "chrome/browser/remoting/setup_flow.h" -#include "chrome/common/net/gaia/gaia_auth_consumer.h" -#include "chrome/common/net/gaia/gaia_auth_fetcher.h" - -namespace remoting { - -// Implementation of host registration step for remoting setup flow. -class SetupFlowRegisterStep : public SetupFlowStepBase { - public: - SetupFlowRegisterStep(); - virtual ~SetupFlowRegisterStep(); - - // SetupFlowStep implementation. - virtual void HandleMessage(const std::string& message, - const Value* arg); - virtual void Cancel(); - - protected: - virtual void DoStart(); - - // This methods is called when are sure remoting is enabled. - void SetRemotingEnabled(); - void OnRequestDone(DirectoryAddRequest::Result result, - const std::string& error_message); - - private: - scoped_ptr<DirectoryAddRequest> request_; - - DISALLOW_COPY_AND_ASSIGN(SetupFlowRegisterStep); -}; - -class SetupFlowRegisterErrorStep : public SetupFlowErrorStepBase { - public: - SetupFlowRegisterErrorStep(); - virtual ~SetupFlowRegisterErrorStep(); - - protected: - virtual string16 GetErrorMessage(); - virtual void Retry(); - - private: - DISALLOW_COPY_AND_ASSIGN(SetupFlowRegisterErrorStep); -}; - -} // namespace remoting - -#endif // CHROME_BROWSER_REMOTING_SETUP_FLOW_REGISTER_STEP_H_ diff --git a/chrome/browser/remoting/setup_flow_start_host_step.cc b/chrome/browser/remoting/setup_flow_start_host_step.cc deleted file mode 100644 index 0152138..0000000 --- a/chrome/browser/remoting/setup_flow_start_host_step.cc +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 2011 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/remoting/setup_flow_start_host_step.h" - -#include "chrome/browser/remoting/setup_flow_get_status_step.h" -#include "chrome/browser/service/service_process_control.h" -#include "chrome/browser/service/service_process_control_manager.h" -#include "grit/generated_resources.h" -#include "ui/base/l10n/l10n_util.h" - -namespace remoting { - -SetupFlowStartHostStep::SetupFlowStartHostStep() - : ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), - status_requested_(false) { -} - -SetupFlowStartHostStep::~SetupFlowStartHostStep() { - if (process_control_) - process_control_->RemoveMessageHandler(this); -} - -void SetupFlowStartHostStep::HandleMessage(const std::string& message, - const Value* arg) { -} - -void SetupFlowStartHostStep::Cancel() { - if (process_control_) - process_control_->RemoveMessageHandler(this); -} - -void SetupFlowStartHostStep::OnRemotingHostInfo( - const remoting::ChromotingHostInfo& host_info) { - if (status_requested_) { - status_requested_ = false; - if (host_info.enabled) { - FinishStep(new SetupFlowDoneStep()); - } else { - FinishStep(new SetupFlowStartHostErrorStep()); - } - } -} - -void SetupFlowStartHostStep::DoStart() { - flow()->web_ui()->CallJavascriptFunction("showSettingUp"); - - process_control_ = - ServiceProcessControlManager::GetInstance()->GetProcessControl( - flow()->profile()); - if (!process_control_ || !process_control_->is_connected()) { - FinishStep(new SetupFlowStartHostErrorStep()); - } - - process_control_->SetRemotingHostCredentials(flow()->context()->login, - flow()->context()->talk_token); - process_control_->EnableRemotingHost(); - RequestStatus(); -} - -void SetupFlowStartHostStep::RequestStatus() { - DCHECK(!status_requested_); - - if (!process_control_->RequestRemotingHostStatus()) { - FinishStep(new SetupFlowStartHostErrorStep()); - return; - } - - status_requested_ = true; - process_control_->AddMessageHandler(this); -} - -SetupFlowStartHostErrorStep::SetupFlowStartHostErrorStep() { } -SetupFlowStartHostErrorStep::~SetupFlowStartHostErrorStep() { } - -string16 SetupFlowStartHostErrorStep::GetErrorMessage() { - return l10n_util::GetStringUTF16(IDS_REMOTING_SERVICE_PROCESS_FAILED_MESSAGE); -} - -void SetupFlowStartHostErrorStep::Retry() { - // When retrying we retry from the GetStatus step because it may be - // necessary to start service process. - FinishStep(new SetupFlowGetStatusStep()); -} - -} // namespace remoting diff --git a/chrome/browser/remoting/setup_flow_start_host_step.h b/chrome/browser/remoting/setup_flow_start_host_step.h deleted file mode 100644 index 2780ad7..0000000 --- a/chrome/browser/remoting/setup_flow_start_host_step.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2011 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_REMOTING_SETUP_FLOW_START_HOST_STEP_H_ -#define CHROME_BROWSER_REMOTING_SETUP_FLOW_START_HOST_STEP_H_ - -#include "chrome/browser/remoting/setup_flow.h" -#include "chrome/browser/service/service_process_control.h" -#include "chrome/common/net/gaia/gaia_auth_consumer.h" -#include "chrome/common/net/gaia/gaia_auth_fetcher.h" - -namespace remoting { - -// SetupFlowStartHostStep is the final step in the remoting setup -// flow. It starts the chromoting hosts and then requests current -// state to verify that it was started successfully. -class SetupFlowStartHostStep : public SetupFlowStepBase, - public ServiceProcessControl::MessageHandler { - public: - SetupFlowStartHostStep(); - virtual ~SetupFlowStartHostStep(); - - // SetupFlowStep implementation. - virtual void HandleMessage(const std::string& message, const Value* arg); - virtual void Cancel(); - - // ServiceProcessControl::MessageHandler interface - virtual void OnRemotingHostInfo( - const remoting::ChromotingHostInfo& host_info); - - protected: - virtual void DoStart(); - - private: - void RequestStatus(); - - ScopedRunnableMethodFactory<SetupFlowStartHostStep> task_factory_; - ServiceProcessControl* process_control_; - bool status_requested_; - - DISALLOW_COPY_AND_ASSIGN(SetupFlowStartHostStep); -}; - -class SetupFlowStartHostErrorStep : public SetupFlowErrorStepBase { - public: - SetupFlowStartHostErrorStep(); - virtual ~SetupFlowStartHostErrorStep(); - - protected: - virtual string16 GetErrorMessage(); - virtual void Retry(); - - private: - DISALLOW_COPY_AND_ASSIGN(SetupFlowStartHostErrorStep); -}; - -} // namespace remoting - -#endif // CHROME_BROWSER_REMOTING_SETUP_FLOW_START_HOST_STEP_H_ diff --git a/chrome/browser/resources/options/advanced_options.html b/chrome/browser/resources/options/advanced_options.html index 3b8525c..184b66a 100644 --- a/chrome/browser/resources/options/advanced_options.html +++ b/chrome/browser/resources/options/advanced_options.html @@ -210,20 +210,4 @@ </div> </section> </if> -<if expr="pp_ifdef('remoting') and not pp_ifdef('chromeos')"> - <section id="remoting-section"> - <h3 i18n-content="advancedSectionTitleRemoting"></h3> - <div> - <div id="remotingStatus" class="section-text"></div> - <div class="section-group"> - <button id="remotingSetupButton" - i18n-content="remotingSetupButton" - style="display:none;"></button> - <button id="remotingStopButton" - i18n-content="remotingStopButton" - style="display:none;"></button> - </div> - </div> - </section> -</if> </div> diff --git a/chrome/browser/resources/options/advanced_options.js b/chrome/browser/resources/options/advanced_options.js index 394ce65..fa845a8 100644 --- a/chrome/browser/resources/options/advanced_options.js +++ b/chrome/browser/resources/options/advanced_options.js @@ -133,14 +133,6 @@ var OptionsPage = options.OptionsPage; }; } - if ($('remotingSetupButton')) { - $('remotingSetupButton').onclick = function(event) { - chrome.send('showRemotingSetupDialog'); - } - $('remotingStopButton').onclick = function(event) { - chrome.send('disableRemoting'); - } - } } }; @@ -270,31 +262,6 @@ var OptionsPage = options.OptionsPage; } }; - AdvancedOptions.SetRemotingStatus = function(enabled, configured, status) { - if (configured) { - $('remotingSetupButton').style.display = 'none'; - $('remotingStopButton').style.display = 'inline'; - } else { - $('remotingSetupButton').style.display = 'inline'; - $('remotingStopButton').style.display = 'none'; - } - - $('remotingSetupButton').disabled = !enabled; - $('remotingStopButton').disabled = !enabled; - if (!enabled) { - $('remotingSetupButton').style.display = 'none'; - $('remotingStopButton').style.display = 'none'; - } - - $('remotingStatus').textContent = status; - }; - - AdvancedOptions.RemoveRemotingSection = function() { - var proxySectionElm = $('remoting-section'); - if (proxySectionElm) - proxySectionElm.parentNode.removeChild(proxySectionElm); - }; - // Export return { AdvancedOptions: AdvancedOptions diff --git a/chrome/browser/service/service_process_control.cc b/chrome/browser/service/service_process_control.cc index 135d832..0d71241 100644 --- a/chrome/browser/service/service_process_control.cc +++ b/chrome/browser/service/service_process_control.cc @@ -187,8 +187,6 @@ bool ServiceProcessControl::OnMessageReceived(const IPC::Message& message) { IPC_BEGIN_MESSAGE_MAP(ServiceProcessControl, message) IPC_MESSAGE_HANDLER(ServiceHostMsg_CloudPrintProxy_IsEnabled, OnCloudPrintProxyIsEnabled) - IPC_MESSAGE_HANDLER(ServiceHostMsg_RemotingHost_HostInfo, - OnRemotingHostInfo) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -241,15 +239,6 @@ void ServiceProcessControl::OnCloudPrintProxyIsEnabled(bool enabled, } } -void ServiceProcessControl::OnRemotingHostInfo( - const remoting::ChromotingHostInfo& host_info) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - for (std::set<MessageHandler*>::iterator it = message_handlers_.begin(); - it != message_handlers_.end(); ++it) { - (*it)->OnRemotingHostInfo(host_info); - } -} - bool ServiceProcessControl::GetCloudPrintProxyStatus( Callback2<bool, std::string>::Type* cloud_print_status_callback) { DCHECK(cloud_print_status_callback); @@ -263,46 +252,6 @@ bool ServiceProcessControl::Shutdown() { return ret; } -bool ServiceProcessControl::SetRemotingHostCredentials( - const std::string& user, - const std::string& talk_token) { - return Send( - new ServiceMsg_SetRemotingHostCredentials(user, talk_token)); -} - -bool ServiceProcessControl::EnableRemotingHost() { - return Send(new ServiceMsg_EnableRemotingHost()); -} - -bool ServiceProcessControl::DisableRemotingHost() { - return Send(new ServiceMsg_DisableRemotingHost()); -} - -bool ServiceProcessControl::RequestRemotingHostStatus() { - if (CheckServiceProcessReady()) { - remoting::ChromotingHostInfo failure_host_info; - failure_host_info.enabled = false; - - Launch(NewRunnableMethod(this, &ServiceProcessControl::Send, - new ServiceMsg_GetRemotingHostInfo), - NewRunnableMethod(this, - &ServiceProcessControl::OnRemotingHostInfo, - failure_host_info)); - return true; - } - return false; -} - -void ServiceProcessControl::AddMessageHandler( - MessageHandler* message_handler) { - message_handlers_.insert(message_handler); -} - -void ServiceProcessControl::RemoveMessageHandler( - MessageHandler* message_handler) { - message_handlers_.erase(message_handler); -} - DISABLE_RUNNABLE_METHOD_REFCOUNT(ServiceProcessControl); ServiceProcessControl::Launcher::Launcher(ServiceProcessControl* process, diff --git a/chrome/browser/service/service_process_control.h b/chrome/browser/service/service_process_control.h index 05914d0..7a9456b 100644 --- a/chrome/browser/service/service_process_control.h +++ b/chrome/browser/service/service_process_control.h @@ -23,10 +23,6 @@ class Profile; class CommandLine; -namespace remoting { -struct ChromotingHostInfo; -} // namespace remoting - // A ServiceProcessControl works as a portal between the service process and // the browser process. // @@ -43,18 +39,6 @@ class ServiceProcessControl : public IPC::Channel::Sender, public: typedef IDMap<ServiceProcessControl>::iterator iterator; typedef std::queue<IPC::Message> MessageQueue; - typedef Callback1<const remoting::ChromotingHostInfo&>::Type - RemotingHostStatusHandler; - - // An interface for handling messages received from the service process. - class MessageHandler { - public: - virtual ~MessageHandler() {} - - // Called when we receive reply to remoting host status request. - virtual void OnRemotingHostInfo( - const remoting::ChromotingHostInfo& host_info) = 0; - }; // Construct a ServiceProcessControl with |profile|.. explicit ServiceProcessControl(Profile* profile); @@ -95,7 +79,6 @@ class ServiceProcessControl : public IPC::Channel::Sender, // Message handlers void OnCloudPrintProxyIsEnabled(bool enabled, std::string email); - void OnRemotingHostInfo(const remoting::ChromotingHostInfo& host_info); // Send a shutdown message to the service process. IPC channel will be // destroyed after calling this method. @@ -107,28 +90,6 @@ class ServiceProcessControl : public IPC::Channel::Sender, bool GetCloudPrintProxyStatus( Callback2<bool, std::string>::Type* cloud_print_status_callback); - // Send a message to enable the remoting service in the service process. - // Return true if the message was sent. - bool SetRemotingHostCredentials(const std::string& user, - const std::string& auth_token); - - bool EnableRemotingHost(); - bool DisableRemotingHost(); - - // Send request for current status of the remoting service. - // MessageHandler::OnRemotingHostInfo() will be called when remoting host - // status is available. - bool RequestRemotingHostStatus(); - - // Add a message handler for receiving messages from the service - // process. - void AddMessageHandler(MessageHandler* message_handler); - - // Remove a message handler from the list of message handlers. Must - // not be called from a message handler (i.e. while a message is - // being processed). - void RemoveMessageHandler(MessageHandler* message_handler); - private: // This class is responsible for launching the service process on the // PROCESS_LAUNCHER thread. @@ -193,9 +154,6 @@ class ServiceProcessControl : public IPC::Channel::Sender, // the cloud print proxy. scoped_ptr<Callback2<bool, std::string>::Type> cloud_print_status_callback_; - // Handler for messages from service process. - std::set<MessageHandler*> message_handlers_; - NotificationRegistrar registrar_; }; diff --git a/chrome/browser/service/service_process_control_browsertest.cc b/chrome/browser/service/service_process_control_browsertest.cc index 673bd4c..b7b0c58 100644 --- a/chrome/browser/service/service_process_control_browsertest.cc +++ b/chrome/browser/service/service_process_control_browsertest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -52,7 +52,7 @@ class ServiceProcessControlBrowserTest ui_test_utils::RunMessageLoop(); } - // Send a remoting host status request and wait reply from the service. + // Send a Cloud Print status request and wait for a reply from the service. void SendRequestAndWait() { process()->GetCloudPrintProxyStatus(NewCallback( this, &ServiceProcessControlBrowserTest::CloudPrintStatusCallback)); @@ -119,8 +119,8 @@ IN_PROC_BROWSER_TEST_F(ServiceProcessControlBrowserTest, EXPECT_TRUE(process()->Shutdown()); } -// This tests the case when a service process is launched when browser -// starts but we try to launch it again in the remoting setup dialog. +// This tests the case when a service process is launched when the browser +// starts but we try to launch it again while setting up Cloud Print. // Crashes on mac. http://crbug.com/75518 #if defined(OS_MACOSX) #define MAYBE_LaunchTwice DISABLED_LaunchTwice diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index c6600dc..905851bc 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -176,8 +176,7 @@ bool RenderViewContextMenu::IsDevToolsURL(const GURL& url) { bool RenderViewContextMenu::IsInternalResourcesURL(const GURL& url) { if (!url.SchemeIs(chrome::kChromeUIScheme)) return false; - return url.host() == chrome::kChromeUISyncResourcesHost || - url.host() == chrome::kChromeUIRemotingResourcesHost; + return url.host() == chrome::kChromeUISyncResourcesHost; } static const int kSpellcheckRadioGroup = 1; diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 5c1f673..74acb11 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -2156,18 +2156,6 @@ void Browser::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(prefs::kEnableBookmarkBar, true, PrefService::UNSYNCABLE_PREF); - prefs->RegisterBooleanPref(prefs::kRemotingHasSetupCompleted, - false, - PrefService::UNSYNCABLE_PREF); - prefs->RegisterBooleanPref(prefs::kChromotingEnabled, - false, - PrefService::UNSYNCABLE_PREF); - prefs->RegisterBooleanPref(prefs::kChromotingHostEnabled, - false, - PrefService::UNSYNCABLE_PREF); - prefs->RegisterBooleanPref(prefs::kChromotingHostFirewallTraversal, - false, - PrefService::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kCloudPrintEmail, std::string(), PrefService::UNSYNCABLE_PREF); diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index 873f6a8..a112030 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -559,9 +559,6 @@ class Browser : public TabHandlerDelegate, void OpenOptionsDialog(); void OpenPasswordManager(); void OpenSyncMyBookmarksDialog(); -#if defined(ENABLE_REMOTING) - void OpenRemotingSetupDialog(); -#endif void OpenImportSettingsDialog(); void OpenInstantConfirmDialog(); void OpenAboutChromeDialog(); diff --git a/chrome/browser/ui/webui/chrome_web_ui_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_factory.cc index 1d48f8c..71931fa 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_factory.cc @@ -26,7 +26,6 @@ #include "chrome/browser/ui/webui/options/options_ui.h" #include "chrome/browser/ui/webui/plugins_ui.h" #include "chrome/browser/ui/webui/print_preview_ui.h" -#include "chrome/browser/ui/webui/remoting_ui.h" #include "chrome/browser/ui/webui/sync_internals_ui.h" #include "chrome/browser/ui/webui/textfields_ui.h" #include "chrome/common/chrome_switches.h" @@ -115,7 +114,6 @@ static WebUIFactoryFunction GetWebUIFactoryFunction(Profile* profile, return NULL; if (url.host() == chrome::kChromeUISyncResourcesHost || - url.host() == chrome::kChromeUIRemotingResourcesHost || url.host() == chrome::kCloudPrintSetupHost) return &NewWebUI<HtmlDialogUI>; @@ -169,14 +167,6 @@ static WebUIFactoryFunction GetWebUIFactoryFunction(Profile* profile, return &NewWebUI<PluginsUI>; if (url.host() == chrome::kChromeUISyncInternalsHost) return &NewWebUI<SyncInternalsUI>; -#if defined(ENABLE_REMOTING) - if (url.host() == chrome::kChromeUIRemotingHost) { - if (CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableRemoting)) { - return &NewWebUI<RemotingUI>; - } - } -#endif #if defined(OS_CHROMEOS) if (url.host() == chrome::kChromeUIChooseMobileNetworkHost) @@ -350,10 +340,5 @@ RefCountedMemory* ChromeWebUIFactory::GetFaviconResourceBytes( if (page_url.host() == chrome::kChromeUIPluginsHost) return PluginsUI::GetFaviconResourceBytes(); -#if defined(ENABLE_REMOTING) - if (page_url.host() == chrome::kChromeUIRemotingHost) - return RemotingUI::GetFaviconResourceBytes(); -#endif - return NULL; } diff --git a/chrome/browser/ui/webui/options/advanced_options_handler.cc b/chrome/browser/ui/webui/options/advanced_options_handler.cc index 071ff37..2abb4d2 100644 --- a/chrome/browser/ui/webui/options/advanced_options_handler.cc +++ b/chrome/browser/ui/webui/options/advanced_options_handler.cc @@ -20,7 +20,6 @@ #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" #include "chrome/browser/printing/cloud_print/cloud_print_url.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/remoting/setup_flow.h" #include "chrome/browser/service/service_process_control.h" #include "chrome/browser/service/service_process_control_manager.h" #include "chrome/browser/ui/options/options_util.h" @@ -163,14 +162,6 @@ void AdvancedOptionsHandler::GetLocalizedValues( { "cloudPrintProxyEnablingButton", IDS_OPTIONS_CLOUD_PRINT_PROXY_ENABLING_BUTTON }, #endif -#if defined(ENABLE_REMOTING) - { "advancedSectionTitleRemoting", - IDS_OPTIONS_ADVANCED_SECTION_TITLE_REMOTING }, - { "remotingSetupButton", - IDS_OPTIONS_REMOTING_SETUP_BUTTON }, - { "remotingStopButton", - IDS_OPTIONS_REMOTING_STOP_BUTTON }, -#endif }; RegisterStrings(localized_strings, resources, arraysize(resources)); @@ -200,13 +191,6 @@ void AdvancedOptionsHandler::Initialize() { RemoveCloudPrintProxySection(); } #endif -#if defined(ENABLE_REMOTING) && !defined(OS_CHROMEOS) - if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableRemoting)) { - RemoveRemotingSection(); - } else { - remoting_options_handler_.Init(web_ui_); - } -#endif banner_handler_.reset( new OptionsManagedBannerHandler(web_ui_, @@ -290,14 +274,6 @@ void AdvancedOptionsHandler::RegisterMessages() { NewCallback(this, &AdvancedOptionsHandler::ShowNetworkProxySettings)); #endif -#if defined(ENABLE_REMOTING) && !defined(OS_CHROMEOS) - web_ui_->RegisterMessageCallback("showRemotingSetupDialog", - NewCallback(this, - &AdvancedOptionsHandler::ShowRemotingSetupDialog)); - web_ui_->RegisterMessageCallback("disableRemoting", - NewCallback(this, - &AdvancedOptionsHandler::DisableRemoting)); -#endif web_ui_->RegisterMessageCallback("checkRevocationCheckboxAction", NewCallback(this, &AdvancedOptionsHandler::HandleCheckRevocationCheckbox)); @@ -514,26 +490,6 @@ void AdvancedOptionsHandler::RemoveCloudPrintProxySection() { #endif -#if defined(ENABLE_REMOTING) && !defined(OS_CHROMEOS) -void AdvancedOptionsHandler::RemoveRemotingSection() { - web_ui_->CallJavascriptFunction( - "options.AdvancedOptions.RemoveRemotingSection"); -} - -void AdvancedOptionsHandler::ShowRemotingSetupDialog(const ListValue* args) { - remoting::SetupFlow::OpenSetupDialog(web_ui_->GetProfile()); -} - -void AdvancedOptionsHandler::DisableRemoting(const ListValue* args) { - ServiceProcessControl* process_control = - ServiceProcessControlManager::GetInstance()->GetProcessControl( - web_ui_->GetProfile()); - if (!process_control || !process_control->is_connected()) - return; - process_control->DisableRemotingHost(); -} -#endif - void AdvancedOptionsHandler::SetupMetricsReportingCheckbox() { #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS) FundamentalValue checked(enable_metrics_recording_.GetValue()); diff --git a/chrome/browser/ui/webui/options/advanced_options_handler.h b/chrome/browser/ui/webui/options/advanced_options_handler.h index 4f0889e..5b9c2f3 100644 --- a/chrome/browser/ui/webui/options/advanced_options_handler.h +++ b/chrome/browser/ui/webui/options/advanced_options_handler.h @@ -9,7 +9,6 @@ #include "chrome/browser/prefs/pref_member.h" #include "chrome/browser/prefs/pref_set_observer.h" #include "chrome/browser/printing/cloud_print/cloud_print_setup_handler.h" -#include "chrome/browser/remoting/remoting_options_handler.h" #include "chrome/browser/ui/shell_dialogs.h" #include "chrome/browser/ui/webui/options/options_ui.h" @@ -117,17 +116,6 @@ class AdvancedOptionsHandler #endif -#if defined(ENABLE_REMOTING) && !defined(OS_CHROMEOS) - // Removes remoting section. Called if remoting is not enabled. - void RemoveRemotingSection(); - - // Callback for Setup Remoting button. - void ShowRemotingSetupDialog(const ListValue* args); - - // Disable Remoting. - void DisableRemoting(const ListValue* args); -#endif - // Setup the checked state for the metrics reporting checkbox. void SetupMetricsReportingCheckbox(); @@ -166,10 +154,6 @@ class AdvancedOptionsHandler BooleanPrefMember ssl3_enabled_; BooleanPrefMember tls1_enabled_; -#if defined(ENABLE_REMOTING) && !defined(OS_CHROMEOS) - remoting::RemotingOptionsHandler remoting_options_handler_; -#endif - FilePathPrefMember default_download_location_; BooleanPrefMember ask_for_save_location_; BooleanPrefMember allow_file_selection_dialogs_; diff --git a/chrome/browser/ui/webui/remoting_ui.cc b/chrome/browser/ui/webui/remoting_ui.cc deleted file mode 100644 index 87fb56c..0000000 --- a/chrome/browser/ui/webui/remoting_ui.cc +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2011 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/ui/webui/remoting_ui.h" - -#include "base/memory/singleton.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/webui/chrome_url_data_manager.h" -#include "chrome/common/url_constants.h" -#include "content/browser/browser_thread.h" -#include "content/browser/tab_contents/tab_contents.h" -#include "grit/theme_resources.h" -#include "ui/base/resource/resource_bundle.h" - -namespace { - -/////////////////////////////////////////////////////////////////////////////// -// -// RemotingHTMLSource -// -/////////////////////////////////////////////////////////////////////////////// - -class RemotingUIHTMLSource : public ChromeURLDataManager::DataSource { - public: - RemotingUIHTMLSource() - : DataSource(chrome::kChromeUIRemotingHost, MessageLoop::current()) {} - - // Called when the network layer has requested a resource underneath - // the path we registered. - virtual void StartDataRequest(const std::string& path, - bool is_incognito, - int request_id); - virtual std::string GetMimeType(const std::string&) const { - return "pepper-application/x-chromoting"; - } - - private: - ~RemotingUIHTMLSource() {} - - DISALLOW_COPY_AND_ASSIGN(RemotingUIHTMLSource); -}; - -void RemotingUIHTMLSource::StartDataRequest(const std::string& path, - bool is_incognito, - int request_id) { - // Dummy data. Not used, but we need to send something back in the response. - std::string full_html = "remoting"; - - scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes()); - html_bytes->data.resize(full_html.size()); - std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin()); - - SendResponse(request_id, html_bytes); -} - -} // namespace - -/////////////////////////////////////////////////////////////////////////////// -// -// RemotingUI -// -/////////////////////////////////////////////////////////////////////////////// - -RemotingUI::RemotingUI(TabContents* contents) : WebUI(contents) { - RemotingUIHTMLSource* html_source = new RemotingUIHTMLSource(); - - // Set up the chrome://remoting source. - contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); -} - - -// static -RefCountedMemory* RemotingUI::GetFaviconResourceBytes() { - return ResourceBundle::GetSharedInstance(). - // TODO(garykac): Have custom remoting icon created. - LoadDataResourceBytes(IDR_PLUGIN); -} - -// static -void RemotingUI::RegisterUserPrefs(PrefService* prefs) { - // TODO(garykac): Add remoting prefs (if needed). -} diff --git a/chrome/browser/ui/webui/remoting_ui.h b/chrome/browser/ui/webui/remoting_ui.h deleted file mode 100644 index d5c43d9..0000000 --- a/chrome/browser/ui/webui/remoting_ui.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2011 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_UI_WEBUI_REMOTING_UI_H_ -#define CHROME_BROWSER_UI_WEBUI_REMOTING_UI_H_ -#pragma once - -#include "content/browser/webui/web_ui.h" - -class PrefService; -class RefCountedMemory; - -class RemotingUI : public WebUI { - public: - explicit RemotingUI(TabContents* contents); - - static RefCountedMemory* GetFaviconResourceBytes(); - static void RegisterUserPrefs(PrefService* prefs); - - private: - DISALLOW_COPY_AND_ASSIGN(RemotingUI); -}; - -#endif // CHROME_BROWSER_UI_WEBUI_REMOTING_UI_H_ diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 34ec4b0..087e0fb 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -814,8 +814,6 @@ 'service/gaia/service_gaia_authenticator.h', 'service/net/service_url_request_context.cc', 'service/net/service_url_request_context.h', - 'service/remoting/chromoting_host_manager.cc', - 'service/remoting/chromoting_host_manager.h', ], 'include_dirs': [ '..', @@ -849,17 +847,6 @@ 'service/cloud_print/print_system_cups.cc', ], }], - ['remoting==1', { - 'dependencies': [ - '../remoting/remoting.gyp:chromoting_host', - ], - }], - ['remoting==0', { - 'sources!': [ - 'service/remoting/chromoting_host_manager.cc', - 'service/remoting/chromoting_host_manager.h', - ], - }], ], }, { diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 42eb6c7..dec0729 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1696,22 +1696,6 @@ 'browser/profiles/profile_keyed_service_factory.h', 'browser/profiles/profile_manager.cc', 'browser/profiles/profile_manager.h', - 'browser/remoting/directory_add_request.cc', - 'browser/remoting/directory_add_request.h', - 'browser/remoting/remoting_options_handler.cc', - 'browser/remoting/remoting_options_handler.h', - 'browser/remoting/remoting_resources_source.cc', - 'browser/remoting/remoting_resources_source.h', - 'browser/remoting/setup_flow.cc', - 'browser/remoting/setup_flow.h', - 'browser/remoting/setup_flow_get_status_step.cc', - 'browser/remoting/setup_flow_get_status_step.h', - 'browser/remoting/setup_flow_login_step.cc', - 'browser/remoting/setup_flow_login_step.h', - 'browser/remoting/setup_flow_register_step.cc', - 'browser/remoting/setup_flow_register_step.h', - 'browser/remoting/setup_flow_start_host_step.cc', - 'browser/remoting/setup_flow_start_host_step.h', 'browser/remove_rows_table_model.h', 'browser/renderer_host/accelerated_plugin_view_mac.h', 'browser/renderer_host/accelerated_plugin_view_mac.mm', @@ -3404,8 +3388,6 @@ 'browser/ui/webui/print_preview_ui.h', 'browser/ui/webui/print_preview_ui_html_source.cc', 'browser/ui/webui/print_preview_ui_html_source.h', - 'browser/ui/webui/remoting_ui.cc', - 'browser/ui/webui/remoting_ui.h', 'browser/ui/webui/screenshot_source.cc', 'browser/ui/webui/screenshot_source.h', 'browser/ui/webui/shared_resources_data_source.cc', diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index 8d52f1e..9c10b32 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -213,8 +213,6 @@ 'common/print_messages.h', 'common/random.cc', 'common/random.h', - 'common/remoting/chromoting_host_info.cc', - 'common/remoting/chromoting_host_info.h', 'common/render_messages.cc', 'common/render_messages.h', '<(protoc_out_dir)/chrome/common/safe_browsing/csd.pb.cc', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 9936850..05efaf9 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1479,7 +1479,6 @@ 'browser/process_singleton_mac_unittest.cc', 'browser/profiles/profile_dependency_manager_unittest.cc', 'browser/profiles/profile_manager_unittest.cc', - 'browser/remoting/directory_add_request_unittest.cc', 'browser/renderer_host/accelerated_plugin_view_mac_unittest.mm', 'browser/renderer_host/gtk_key_bindings_handler_unittest.cc', 'browser/renderer_host/render_widget_host_view_mac_unittest.mm', diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 94204c5..baf048d 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -929,17 +929,6 @@ const char kSelectFileLastDirectory[] = "selectfile.last_directory"; // Boolean that specifies if file selection dialogs are shown. const char kAllowFileSelectionDialogs[] = "select_file_dialogs.allowed"; -// Boolean that specifies if remote access features are allowed. -const char kChromotingEnabled[] = "chromoting.enabled"; - -// Boolean that specifies if machine is allowed to be shared for remote access. -const char kChromotingHostEnabled[] = "chromoting.host_enabled"; - -// Boolean that specifies if a machine that is shared for remote access is -// is allowed to accept connections from across a firewall. -const char kChromotingHostFirewallTraversal[] = - "chromoting.host_firewall_traversal"; - // Extensions which should be opened upon completion. const char kDownloadExtensionsToOpen[] = "download.extensions_to_open"; @@ -1254,8 +1243,6 @@ const char kCloudPrintServiceURL[] = "cloud_print.service_url"; const char kCloudPrintDialogWidth[] = "cloud_print.dialog_size.width"; const char kCloudPrintDialogHeight[] = "cloud_print.dialog_size.height"; -const char kRemotingHasSetupCompleted[] = "remoting.has_setup_completed"; - // The list of BackgroundContents that should be loaded when the browser // launches. const char kRegisteredBackgroundContents[] = "background_contents.registered"; @@ -1315,9 +1302,6 @@ const char kCloudPrintEnableJobPoll[] = "cloud_print.enable_job_poll"; const char kCloudPrintRobotRefreshToken[] = "cloud_print.robot_refresh_token"; const char kCloudPrintRobotEmail[] = "cloud_print.robot_email"; -// Used by the service process to determine if the remoting host is enabled. -const char kRemotingHostEnabled[] = "remoting.host_enabled"; - // Preference to story proxy settings. const char kProxy[] = "proxy"; diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index dc3dfed..bae339b 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -322,10 +322,6 @@ extern const char kSaveFileType[]; extern const char kAllowFileSelectionDialogs[]; -extern const char kChromotingEnabled[]; -extern const char kChromotingHostEnabled[]; -extern const char kChromotingHostFirewallTraversal[]; - extern const char kSelectFileLastDirectory[]; extern const char kHungPluginDetectFrequency[]; @@ -462,9 +458,6 @@ extern const char kCloudPrintEnableJobPoll[]; extern const char kCloudPrintRobotRefreshToken[]; extern const char kCloudPrintRobotEmail[]; -extern const char kRemotingHasSetupCompleted[]; -extern const char kRemotingHostEnabled[]; - extern const char kProxy[]; extern const char kManagedDefaultCookiesSetting[]; diff --git a/chrome/common/remoting/chromoting_host_info.cc b/chrome/common/remoting/chromoting_host_info.cc deleted file mode 100644 index acb0ce5..0000000 --- a/chrome/common/remoting/chromoting_host_info.cc +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2011 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/common/remoting/chromoting_host_info.h" - -namespace remoting { - -ChromotingHostInfo::ChromotingHostInfo() - : enabled(false) { -} - -ChromotingHostInfo::~ChromotingHostInfo() {} - -} // namespace remoting diff --git a/chrome/common/remoting/chromoting_host_info.h b/chrome/common/remoting/chromoting_host_info.h deleted file mode 100644 index f1816da..0000000 --- a/chrome/common/remoting/chromoting_host_info.h +++ /dev/null @@ -1,26 +0,0 @@ -// 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_COMMON_REMOTING_CHROMOTING_HOST_INFO_H_ -#define CHROME_COMMON_REMOTING_CHROMOTING_HOST_INFO_H_ - -#include <string> - -namespace remoting { - -// This struct is used for ServiceHostMsg_ChromotingHost_Info IPC message. -struct ChromotingHostInfo { - ChromotingHostInfo(); - ~ChromotingHostInfo(); - - std::string host_id; - std::string hostname; - std::string public_key; - std::string login; - bool enabled; -}; - -} // namespace remoting - -#endif // CHROME_COMMON_REMOTING_CHROMOTING_HOST_INFO_H_ diff --git a/chrome/common/service_messages.h b/chrome/common/service_messages.h index 9d15df4..faf5b1a 100644 --- a/chrome/common/service_messages.h +++ b/chrome/common/service_messages.h @@ -1,24 +1,15 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. // Multiply-included message file, no traditional include guard. #include <string> -#include "chrome/common/remoting/chromoting_host_info.h" #include "ipc/ipc_channel_handle.h" #include "ipc/ipc_message_macros.h" #define IPC_MESSAGE_START ServiceMsgStart -IPC_STRUCT_TRAITS_BEGIN(remoting::ChromotingHostInfo) - IPC_STRUCT_TRAITS_MEMBER(host_id) - IPC_STRUCT_TRAITS_MEMBER(hostname) - IPC_STRUCT_TRAITS_MEMBER(public_key) - IPC_STRUCT_TRAITS_MEMBER(enabled) - IPC_STRUCT_TRAITS_MEMBER(login) -IPC_STRUCT_TRAITS_END() - //----------------------------------------------------------------------------- // Service process messages: // These are messages from the browser to the service process. @@ -38,20 +29,6 @@ IPC_MESSAGE_CONTROL0(ServiceMsg_DisableCloudPrintProxy) // enabled. IPC_MESSAGE_CONTROL0(ServiceMsg_IsCloudPrintProxyEnabled) -// Set credentials used by the RemotingHost. -IPC_MESSAGE_CONTROL2(ServiceMsg_SetRemotingHostCredentials, - std::string, /* username */ - std::string /* token for XMPP */) - -// Enabled remoting host. -IPC_MESSAGE_CONTROL0(ServiceMsg_EnableRemotingHost) - -// Disable remoting host. -IPC_MESSAGE_CONTROL0(ServiceMsg_DisableRemotingHost) - -// Get remoting host status information. -IPC_MESSAGE_CONTROL0(ServiceMsg_GetRemotingHostInfo) - // Tell the service process to shutdown. IPC_MESSAGE_CONTROL0(ServiceMsg_Shutdown) @@ -68,7 +45,3 @@ IPC_MESSAGE_CONTROL0(ServiceHostMsg_CloudPrintProxy_AuthError) IPC_MESSAGE_CONTROL2(ServiceHostMsg_CloudPrintProxy_IsEnabled, bool, /* Is the proxy enabled? */ std::string /* Email address of account */) - -IPC_MESSAGE_CONTROL1(ServiceHostMsg_RemotingHost_HostInfo, - remoting::ChromotingHostInfo /* host_info */) - diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc index 60ed6ce..33fcb99 100644 --- a/chrome/common/url_constants.cc +++ b/chrome/common/url_constants.cc @@ -120,8 +120,6 @@ const char kChromeUINetInternalsHost[] = "net-internals"; const char kChromeUINewTabHost[] = "newtab"; const char kChromeUIPluginsHost[] = "plugins"; const char kChromeUIPrintHost[] = "print"; -const char kChromeUIRemotingHost[] = "remoting"; -const char kChromeUIRemotingResourcesHost[] = "remotingresources"; const char kChromeUIResourcesHost[] = "resources"; const char kChromeUIScreenshotPath[] = "screenshots"; const char kChromeUISettingsHost[] = "settings"; diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h index 3b4e50a0..8d030d2 100644 --- a/chrome/common/url_constants.h +++ b/chrome/common/url_constants.h @@ -109,8 +109,6 @@ extern const char kChromeUINetInternalsHost[]; extern const char kChromeUINewTabHost[]; extern const char kChromeUIPluginsHost[]; extern const char kChromeUIPrintHost[]; -extern const char kChromeUIRemotingHost[]; -extern const char kChromeUIRemotingResourcesHost[]; extern const char kChromeUIResourcesHost[]; extern const char kChromeUIScreenshotPath[]; extern const char kChromeUISettingsHost[]; diff --git a/chrome/service/DEPS b/chrome/service/DEPS index 1a5238b..be16d49 100644 --- a/chrome/service/DEPS +++ b/chrome/service/DEPS @@ -1,9 +1,4 @@ include_rules = [ # For generated headers. "+grit", - # For Media initialization definition. - "+media/base", - # For Chromoting Host Process. - "+remoting/base", - "+remoting/host", ] diff --git a/chrome/service/remoting/chromoting_host_manager.cc b/chrome/service/remoting/chromoting_host_manager.cc deleted file mode 100644 index 39fdd70..0000000 --- a/chrome/service/remoting/chromoting_host_manager.cc +++ /dev/null @@ -1,216 +0,0 @@ -// 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/service/remoting/chromoting_host_manager.h" - -#include "base/path_service.h" -#include "chrome/common/chrome_paths.h" -#include "chrome/common/guid.h" -#include "chrome/common/remoting/chromoting_host_info.h" -#include "net/base/net_util.h" -#include "remoting/base/constants.h" -#include "remoting/host/chromoting_host_context.h" -#include "remoting/host/heartbeat_sender.h" -#include "remoting/host/host_key_pair.h" -#include "remoting/host/json_host_config.h" - -namespace remoting { - -ChromotingHostManager::ChromotingHostManager(Observer* observer) - : observer_(observer), - main_message_loop_(NULL) { -} - -void ChromotingHostManager::Initialize( - MessageLoopForUI* main_message_loop, - base::MessageLoopProxy* file_message_loop) { - 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")); - remoting::JsonHostConfig* config = new remoting::JsonHostConfig( - chromoting_config_path, file_message_loop); - if (!config->Read()) { - VLOG(1) << "Failed to read chromoting config file."; - } - - main_message_loop_ = main_message_loop; - chromoting_config_ = config; - - if (!IsConfigInitialized()) { - InitializeConfig(); - } - - if (IsEnabled()) { - // TODO(wez): Need to callback the Observer so that ServiceProcess - // knows to stay alive to service Chromoting requests. - // This will go away once we have a more consistent model for the - // service process internals. - observer_->OnChromotingHostEnabled(); - Start(); - } -} - -void ChromotingHostManager::Teardown(Task* done_task) { - Stop(done_task); -} - -ChromotingHostManager::~ChromotingHostManager() { - DCHECK(!chromoting_host_); - DCHECK(!chromoting_context_.get()); -} - -bool ChromotingHostManager::IsConfigInitialized() { - std::string host_id; - if (!chromoting_config_->GetString(remoting::kHostIdConfigPath, &host_id)) - return false; - - return guid::IsValidGUID(host_id); -} - -void ChromotingHostManager::InitializeConfig() { - VLOG(1) << "Initializing static chromoting host parameters."; - - // TODO(hclam): This is a time consuming operation so we should run it on - // a separate thread. - remoting::HostKeyPair host_key_pair; - host_key_pair.Generate(); - std::string host_id(guid::GenerateGUID()); - std::string hostname(net::GetHostName()); - - chromoting_config_->SetBoolean(remoting::kHostEnabledConfigPath, false); - chromoting_config_->SetString(remoting::kHostIdConfigPath, host_id); - chromoting_config_->SetString(remoting::kHostNameConfigPath, hostname); - host_key_pair.Save(chromoting_config_); - - // Save updated values on the disk. - chromoting_config_->Save(); -} - -void ChromotingHostManager::SetCredentials(const std::string& login, - const std::string& token) { - chromoting_config_->SetString(remoting::kXmppLoginConfigPath, login); - chromoting_config_->SetString(remoting::kXmppAuthTokenConfigPath, token); - - // Save updated values on the disk. - chromoting_config_->Save(); -} - -void ChromotingHostManager::Enable() { - // We have already started. - if (IsEnabled()) - return; - - SetEnabled(true); - observer_->OnChromotingHostEnabled(); - - Start(); -} - -void ChromotingHostManager::Disable() { - if (!IsEnabled()) - return; - - SetEnabled(false); - - // TODO(hclam): Immediately reporting will cause threading problems - // ServiceProcess thinks we can shutdown safely. - observer_->OnChromotingHostDisabled(); - - Stop(NULL); -} - -void ChromotingHostManager::GetHostInfo(ChromotingHostInfo* host_info) { - chromoting_config_->GetString(remoting::kHostIdConfigPath, - &host_info->host_id); - chromoting_config_->GetString(remoting::kHostNameConfigPath, - &host_info->hostname); - HostKeyPair key_pair; - if (key_pair.Load(chromoting_config_)) { - host_info->public_key = key_pair.GetPublicKey(); - } - - host_info->enabled = IsEnabled(); - - chromoting_config_->GetString(remoting::kXmppLoginConfigPath, - &host_info->login); -} - -void ChromotingHostManager::Stop(Task* done_task) { - // Stop the host if it is started. - if (chromoting_host_) { - // Save the shutdown task, it will be executed when chromoting host - // is stopped. - shutdown_task_.reset(done_task); - - // Shutdown the chromoting host asynchronously. - chromoting_host_->Shutdown(); - } else if (done_task) { - done_task->Run(); - delete done_task; - } -} - -bool ChromotingHostManager::IsEnabled() { - bool enabled; - if (!chromoting_config_->GetBoolean(remoting::kHostEnabledConfigPath, - &enabled)) { - enabled = false; - } - return enabled; -} - -void ChromotingHostManager::SetEnabled(bool enabled) { - chromoting_config_->SetBoolean(remoting::kHostEnabledConfigPath, - enabled); - chromoting_config_->Save(); -} - -void ChromotingHostManager::Start() { - // Don't do anything if we already started. - if (chromoting_host_.get()) - return; - - // Start the chromoting context first. - chromoting_context_.reset( - new remoting::ChromotingHostContext(main_message_loop_)); - chromoting_context_->Start(); - - // Create a chromoting host object. - chromoting_host_ = remoting::ChromotingHost::Create(chromoting_context_.get(), - chromoting_config_); - - // Initialize HeartbeatSender. - scoped_refptr<remoting::HeartbeatSender> heartbeat_sender = - new remoting::HeartbeatSender(chromoting_context_->network_message_loop(), - chromoting_config_); - if (!heartbeat_sender->Init()) - LOG(ERROR) << "Failed to initialize heartbeat sender."; - chromoting_host_->AddStatusObserver(heartbeat_sender); - - - // Then start the chromoting host. - // When ChromotingHost is shutdown because of failure or a request that - // we made OnChromotingShutdown() is calls. - chromoting_host_->Start( - NewRunnableMethod(this, &ChromotingHostManager::OnShutdown)); -} - -void ChromotingHostManager::OnShutdown() { - if (MessageLoop::current() != main_message_loop_) { - main_message_loop_->PostTask(FROM_HERE, - NewRunnableMethod(this, &ChromotingHostManager::OnShutdown)); - return; - } - chromoting_context_->Stop(); - chromoting_context_.reset(); - chromoting_host_ = NULL; - - if (shutdown_task_.get()) { - shutdown_task_->Run(); - shutdown_task_.reset(); - } -} - -} // namespace remoting diff --git a/chrome/service/remoting/chromoting_host_manager.h b/chrome/service/remoting/chromoting_host_manager.h deleted file mode 100644 index 8355126..0000000 --- a/chrome/service/remoting/chromoting_host_manager.h +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2011 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_SERVICE_REMOTING_CHROMOTING_HOST_MANAGER_H_ -#define CHROME_SERVICE_REMOTING_CHROMOTING_HOST_MANAGER_H_ - -#include <string> - -#include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" -#include "base/message_loop.h" -#include "remoting/host/chromoting_host.h" -#include "remoting/host/chromoting_host_context.h" -#include "remoting/host/host_config.h" - -namespace base { -class MessageLoopProxy; -} // namespace base - -namespace remoting { - -struct ChromotingHostInfo; - -// ChromotingHostManager manages chromoting host. It loads config and updates -// config when necessary, and starts and stops the chromoting host. -class ChromotingHostManager - : public base::RefCountedThreadSafe<ChromotingHostManager> { - public: - - // Interface for observer that is notified about the host being - // enabled/disabled. Observer is specified in the constructor. - class Observer { - public: - virtual ~Observer() {} - virtual void OnChromotingHostEnabled() = 0; - virtual void OnChromotingHostDisabled() = 0; - }; - - // Caller keeps ownership of |observer|. |observer| must not be - // destroyed while this object exists. - explicit ChromotingHostManager(Observer* observer); - - void Initialize(MessageLoopForUI* main_message_loop, - base::MessageLoopProxy* file_message_loop); - - // Shutdown ChromotingHostManager. |done_task| will be executed when done. - // This method must be called before ChromotingHostManager is destroyed. - void Teardown(Task* done_task); - - // Return the reference to the chromoting host only if it has started. - remoting::ChromotingHost* GetChromotingHost() { return chromoting_host_; } - - // Updates credentials used for XMPP connection. - void SetCredentials(const std::string& login, const std::string& token); - - bool IsEnabled(); - - // Start running the chromoting host asynchronously. - void Enable(); - - // Stop chromoting host. The shutdown process will happen asynchronously. - void Disable(); - - void GetHostInfo(ChromotingHostInfo* host_info); - - private: - friend class base::RefCountedThreadSafe<ChromotingHostManager>; - virtual ~ChromotingHostManager(); - - bool IsConfigInitialized(); - void InitializeConfig(); - - void SetEnabled(bool enabled); - void Start(); - void Stop(Task* done_task); - - void OnShutdown(); - - Observer* observer_; - - scoped_refptr<remoting::MutableHostConfig> chromoting_config_; - scoped_ptr<remoting::ChromotingHostContext> chromoting_context_; - scoped_refptr<remoting::ChromotingHost> chromoting_host_; - - MessageLoopForUI* main_message_loop_; - scoped_ptr<Task> shutdown_task_; -}; - -} // namespace remoting - -#endif // CHROME_SERVICE_REMOTING_CHROMOTING_HOST_MANAGER_H_ diff --git a/chrome/service/service_ipc_server.cc b/chrome/service/service_ipc_server.cc index ffab169..493831e 100644 --- a/chrome/service/service_ipc_server.cc +++ b/chrome/service/service_ipc_server.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -107,16 +107,6 @@ bool ServiceIPCServer::OnMessageReceived(const IPC::Message& msg) { OnDisableCloudPrintProxy) IPC_MESSAGE_HANDLER(ServiceMsg_IsCloudPrintProxyEnabled, OnIsCloudPrintProxyEnabled) -#if defined(ENABLE_REMOTING) - IPC_MESSAGE_HANDLER(ServiceMsg_SetRemotingHostCredentials, - OnSetRemotingHostCredentials) - IPC_MESSAGE_HANDLER(ServiceMsg_EnableRemotingHost, - OnEnableRemotingHost) - IPC_MESSAGE_HANDLER(ServiceMsg_DisableRemotingHost, - OnDisableRemotingHost) - IPC_MESSAGE_HANDLER(ServiceMsg_GetRemotingHostInfo, - OnGetRemotingHostInfo) -#endif // defined(ENABLE_REMOTING) IPC_MESSAGE_HANDLER(ServiceMsg_Shutdown, OnShutdown); IPC_MESSAGE_HANDLER(ServiceMsg_UpdateAvailable, OnUpdateAvailable); IPC_MESSAGE_UNHANDLED(handled = false) @@ -141,35 +131,6 @@ void ServiceIPCServer::OnIsCloudPrintProxyEnabled() { email)); } -#if defined(ENABLE_REMOTING) -void ServiceIPCServer::OnSetRemotingHostCredentials( - const std::string& login, - const std::string& auth_token) { - g_service_process->remoting_host_manager()->SetCredentials( - login, auth_token); -} - -void ServiceIPCServer::OnEnableRemotingHost() { - g_service_process->remoting_host_manager()->Enable(); - SendRemotingHostInfo(); -} - -void ServiceIPCServer::OnDisableRemotingHost() { - g_service_process->remoting_host_manager()->Disable(); - SendRemotingHostInfo(); -} - -void ServiceIPCServer::OnGetRemotingHostInfo() { - SendRemotingHostInfo(); -} - -void ServiceIPCServer::SendRemotingHostInfo() { - remoting::ChromotingHostInfo host_info; - g_service_process->remoting_host_manager()->GetHostInfo(&host_info); - channel_->Send(new ServiceHostMsg_RemotingHost_HostInfo(host_info)); -} -#endif // defined(ENABLE_REMOTING) - void ServiceIPCServer::OnDisableCloudPrintProxy() { g_service_process->GetCloudPrintProxy()->DisableForUser(); } diff --git a/chrome/service/service_ipc_server.h b/chrome/service/service_ipc_server.h index 35745bd..01f6f89 100644 --- a/chrome/service/service_ipc_server.h +++ b/chrome/service/service_ipc_server.h @@ -47,19 +47,6 @@ class ServiceIPCServer : public IPC::Channel::Listener, void OnIsCloudPrintProxyEnabled(); void OnDisableCloudPrintProxy(); -#if defined(ENABLE_REMOTING) - void OnSetRemotingHostCredentials(const std::string& login, - const std::string& talk_token); - void OnEnableRemotingHost(); - void OnDisableRemotingHost(); - void OnGetRemotingHostInfo(); - - // Sends HostInfo message to the browser. It must is called when we - // receive GetRemotingHostInfo message or when status of the host - // is changed. - void SendRemotingHostInfo(); -#endif // defined(ENABLE_REMOTING) - void OnShutdown(); void OnUpdateAvailable(); diff --git a/chrome/service/service_process.cc b/chrome/service/service_process.cc index 25072de..8715ecd 100644 --- a/chrome/service/service_process.cc +++ b/chrome/service/service_process.cc @@ -28,7 +28,6 @@ #include "chrome/service/service_process_prefs.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" -#include "media/base/media.h" #include "net/base/network_change_notifier.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" @@ -39,13 +38,6 @@ #include <gtk/gtk.h> #endif -#if defined(ENABLE_REMOTING) -#include "chrome/service/remoting/chromoting_host_manager.h" -#if defined(OS_MACOSX) -#include "base/mac/mac_util.h" -#endif // defined(OS_MACOSX) -#endif // defined(ENABLED_REMOTING) - ServiceProcess* g_service_process = NULL; namespace { @@ -188,18 +180,6 @@ bool ServiceProcess::Initialize(MessageLoopForUI* message_loop, PrepareRestartOnCrashEnviroment(command_line); -#if defined(ENABLE_REMOTING) - // Load media codecs, required by the Chromoting host - FilePath module_path; - if (PathService::Get(chrome::DIR_MEDIA_LIBS, &module_path) && - media::InitializeMediaLibrary(module_path)) { - // Initialize chromoting host manager. - remoting_host_manager_ = new remoting::ChromotingHostManager(this); - remoting_host_manager_->Initialize(message_loop, - file_thread_->message_loop_proxy()); - } -#endif // ENABLE_REMOTING - // Enable Cloud Print if needed. First check the command-line. bool cloud_print_proxy_enabled = command_line.HasSwitch(switches::kEnableCloudPrintProxy); @@ -248,26 +228,11 @@ bool ServiceProcess::Teardown() { return true; } -#if defined(ENABLE_REMOTING) -static void QuitMessageLoop(MessageLoop* message_loop) { - message_loop->PostTask(FROM_HERE, new MessageLoop::QuitTask()); -} -#endif - // This method is called when a shutdown command is received from IPC channel // or there was an error in the IPC channel. void ServiceProcess::Shutdown() { -#if defined(ENABLE_REMOTING) - // During shutdown of remoting host it has some left over operations on - // the UI thread. So we let the teardown to proceed asynchronously - if (remoting_host_manager_.get()) { - remoting_host_manager_->Teardown( - NewRunnableFunction(&QuitMessageLoop, main_message_loop_)); - } -#else // Quit the main message loop. main_message_loop_->PostTask(FROM_HERE, new MessageLoop::QuitTask()); -#endif } bool ServiceProcess::HandleClientDisconnect() { @@ -307,14 +272,6 @@ void ServiceProcess::OnCloudPrintProxyDisabled(bool persist_state) { OnServiceDisabled(); } -void ServiceProcess::OnChromotingHostEnabled() { - OnServiceEnabled(); -} - -void ServiceProcess::OnChromotingHostDisabled() { - OnServiceDisabled(); -} - ServiceURLRequestContextGetter* ServiceProcess::GetServiceURLRequestContextGetter() { DCHECK(request_context_getter_.get()); diff --git a/chrome/service/service_process.h b/chrome/service/service_process.h index f82cda5..8d316b1 100644 --- a/chrome/service/service_process.h +++ b/chrome/service/service_process.h @@ -14,7 +14,6 @@ #include "base/threading/thread.h" #include "base/synchronization/waitable_event.h" #include "chrome/service/cloud_print/cloud_print_proxy.h" -#include "chrome/service/remoting/chromoting_host_manager.h" class ServiceProcessPrefs; class ServiceIPCServer; @@ -30,8 +29,7 @@ class CommandLine; // The ServiceProcess does not inherit from ChildProcess because this // process can live independently of the browser process. -class ServiceProcess : public CloudPrintProxy::Client, - public remoting::ChromotingHostManager::Observer { +class ServiceProcess : public CloudPrintProxy::Client { public: ServiceProcess(); ~ServiceProcess(); @@ -91,17 +89,6 @@ class ServiceProcess : public CloudPrintProxy::Client, virtual void OnCloudPrintProxyEnabled(bool persist_state); virtual void OnCloudPrintProxyDisabled(bool persist_state); - // ChromotingHostManager::Observer interface. - virtual void OnChromotingHostEnabled(); - virtual void OnChromotingHostDisabled(); - -#if defined(ENABLE_REMOTING) - // Return the reference to the chromoting host only if it has started. - remoting::ChromotingHostManager* remoting_host_manager() { - return remoting_host_manager_; - } -#endif - ServiceURLRequestContextGetter* GetServiceURLRequestContextGetter(); private: @@ -139,10 +126,6 @@ class ServiceProcess : public CloudPrintProxy::Client, scoped_refptr<ServiceURLRequestContextGetter> request_context_getter_; -#if defined(ENABLE_REMOTING) - scoped_refptr<remoting::ChromotingHostManager> remoting_host_manager_; -#endif - DISALLOW_COPY_AND_ASSIGN(ServiceProcess); }; diff --git a/chrome/service/service_process_unittest.cc b/chrome/service/service_process_unittest.cc index d34d098..f034779 100644 --- a/chrome/service/service_process_unittest.cc +++ b/chrome/service/service_process_unittest.cc @@ -11,7 +11,6 @@ #include "base/message_loop.h" #include "base/synchronization/waitable_event.h" #include "chrome/common/service_process_util.h" -#include "remoting/host/host_key_pair.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -23,49 +22,3 @@ TEST(ServiceProcessTest, DISABLED_Run) { EXPECT_TRUE(process.Initialize(&main_message_loop, command_line, &state)); EXPECT_TRUE(process.Teardown()); } - -#if defined(ENABLE_REMOTING) -// This test seems to break randomly so disabling it. -TEST(ServiceProcessTest, DISABLED_RunChromoting) { - MessageLoopForUI main_message_loop; - ServiceProcess process; - ServiceProcessState state; - CommandLine command_line(CommandLine::NO_PROGRAM); - EXPECT_TRUE(process.Initialize(&main_message_loop, command_line, &state)); - - // Then config the chromoting host and start it. - process.remoting_host_manager()->SetCredentials("email", "token"); - process.remoting_host_manager()->Enable(); - process.remoting_host_manager()->Disable(); - EXPECT_TRUE(process.Teardown()); -} - -class MockServiceProcess : public ServiceProcess { - private: - FRIEND_TEST_ALL_PREFIXES(ServiceProcessTest, RunChromotingUntilShutdown); - MOCK_METHOD0(OnChromotingHostShutdown, void()); -}; - -ACTION_P(QuitMessageLoop, message_loop) { - message_loop->PostTask(FROM_HERE, new MessageLoop::QuitTask()); -} - -TEST(ServiceProcessTest, DISABLED_RunChromotingUntilShutdown) { - MessageLoopForUI main_message_loop; - MockServiceProcess process; - ServiceProcessState state; - CommandLine command_line(CommandLine::NO_PROGRAM); - EXPECT_TRUE(process.Initialize(&main_message_loop, command_line, &state)); - - // Expect chromoting shutdown be called because the login token is invalid. - EXPECT_CALL(process, OnChromotingHostShutdown()) - .WillOnce(QuitMessageLoop(&main_message_loop)); - - // Then config the chromoting host and start it. - process.remoting_host_manager()->SetCredentials("email", "token"); - process.remoting_host_manager()->Enable(); - MessageLoop::current()->Run(); - - EXPECT_TRUE(process.Teardown()); -} -#endif // defined(ENABLE_REMOTING) |