| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/options/sync_setup_handler.h" | 5 #include "chrome/browser/ui/webui/options/sync_setup_handler.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/i18n/time_formatting.h" | 12 #include "base/i18n/time_formatting.h" |
| 13 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
| 14 #include "base/json/json_writer.h" | 14 #include "base/json/json_writer.h" |
| 15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 16 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "base/values.h" | 18 #include "base/values.h" |
| 19 #include "chrome/app/chrome_command_ids.h" | 19 #include "chrome/app/chrome_command_ids.h" |
| 20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
| 21 #include "chrome/browser/lifetime/application_lifetime.h" | 21 #include "chrome/browser/lifetime/application_lifetime.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/profiles/profile_info_cache.h" | 23 #include "chrome/browser/profiles/profile_info_cache.h" |
| 24 #include "chrome/browser/profiles/profile_manager.h" | |
| 25 #include "chrome/browser/profiles/profile_metrics.h" | 24 #include "chrome/browser/profiles/profile_metrics.h" |
| 26 #include "chrome/browser/signin/signin_error_controller_factory.h" | 25 #include "chrome/browser/signin/signin_error_controller_factory.h" |
| 27 #include "chrome/browser/signin/signin_header_helper.h" | 26 #include "chrome/browser/signin/signin_header_helper.h" |
| 28 #include "chrome/browser/signin/signin_manager_factory.h" | 27 #include "chrome/browser/signin/signin_manager_factory.h" |
| 29 #include "chrome/browser/signin/signin_promo.h" | 28 #include "chrome/browser/signin/signin_promo.h" |
| 30 #include "chrome/browser/sync/profile_sync_service.h" | 29 #include "chrome/browser/sync/profile_sync_service.h" |
| 31 #include "chrome/browser/sync/profile_sync_service_factory.h" | 30 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 32 #include "chrome/browser/ui/browser_finder.h" | 31 #include "chrome/browser/ui/browser_finder.h" |
| 33 #include "chrome/browser/ui/browser_navigator.h" | 32 #include "chrome/browser/ui/browser_navigator.h" |
| 34 #include "chrome/browser/ui/browser_window.h" | 33 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 if (!result->GetString("passphrase", &config->passphrase)) { | 145 if (!result->GetString("passphrase", &config->passphrase)) { |
| 147 DLOG(ERROR) << "GetConfiguration() not passed a passphrase value"; | 146 DLOG(ERROR) << "GetConfiguration() not passed a passphrase value"; |
| 148 return false; | 147 return false; |
| 149 } | 148 } |
| 150 } | 149 } |
| 151 return true; | 150 return true; |
| 152 } | 151 } |
| 153 | 152 |
| 154 } // namespace | 153 } // namespace |
| 155 | 154 |
| 156 SyncSetupHandler::SyncSetupHandler(ProfileManager* profile_manager) | 155 SyncSetupHandler::SyncSetupHandler() |
| 157 : configuring_sync_(false), | 156 : configuring_sync_(false) { |
| 158 profile_manager_(profile_manager) { | |
| 159 } | 157 } |
| 160 | 158 |
| 161 SyncSetupHandler::~SyncSetupHandler() { | 159 SyncSetupHandler::~SyncSetupHandler() { |
| 162 // Just exit if running unit tests (no actual WebUI is attached). | 160 // Just exit if running unit tests (no actual WebUI is attached). |
| 163 if (!web_ui()) | 161 if (!web_ui()) |
| 164 return; | 162 return; |
| 165 | 163 |
| 166 // This case is hit when the user performs a back navigation. | 164 // This case is hit when the user performs a back navigation. |
| 167 CloseSyncSetup(); | 165 CloseSyncSetup(); |
| 168 } | 166 } |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 "SyncSetupOverlay.showSyncSetupPage", page, args); | 918 "SyncSetupOverlay.showSyncSetupPage", page, args); |
| 921 | 919 |
| 922 // Make sure the tab used for the Gaia sign in does not cover the settings | 920 // Make sure the tab used for the Gaia sign in does not cover the settings |
| 923 // tab. | 921 // tab. |
| 924 FocusUI(); | 922 FocusUI(); |
| 925 } | 923 } |
| 926 | 924 |
| 927 LoginUIService* SyncSetupHandler::GetLoginUIService() const { | 925 LoginUIService* SyncSetupHandler::GetLoginUIService() const { |
| 928 return LoginUIServiceFactory::GetForProfile(GetProfile()); | 926 return LoginUIServiceFactory::GetForProfile(GetProfile()); |
| 929 } | 927 } |
| OLD | NEW |