| 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/sync/one_click_signin_sync_starter.h" | 5 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 | 10 |
| 11 #if defined(ENABLE_CONFIGURATION_POLICY) | 11 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 12 #include "chrome/browser/policy/cloud/user_policy_signin_service.h" | 12 #include "chrome/browser/policy/cloud/user_policy_signin_service.h" |
| 13 #include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h" | 13 #include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h" |
| 14 #endif | 14 #endif |
| 15 | 15 |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/profiles/profile_info_cache.h" | 17 #include "chrome/browser/profiles/profile_info_cache.h" |
| 18 #include "chrome/browser/profiles/profile_io_data.h" | 18 #include "chrome/browser/profiles/profile_io_data.h" |
| 19 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| 20 #include "chrome/browser/signin/signin_manager.h" | 20 #include "chrome/browser/signin/signin_manager.h" |
| 21 #include "chrome/browser/signin/signin_manager_factory.h" | 21 #include "chrome/browser/signin/signin_manager_factory.h" |
| 22 #include "chrome/browser/sync/profile_sync_service.h" | 22 #include "chrome/browser/sync/profile_sync_service.h" |
| 23 #include "chrome/browser/sync/profile_sync_service_factory.h" | 23 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 24 #include "chrome/browser/sync/sync_prefs.h" | 24 #include "chrome/browser/sync/sync_prefs.h" |
| 25 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
| 26 #include "chrome/browser/ui/browser_dialogs.h" |
| 26 #include "chrome/browser/ui/browser_finder.h" | 27 #include "chrome/browser/ui/browser_finder.h" |
| 27 #include "chrome/browser/ui/browser_navigator.h" | 28 #include "chrome/browser/ui/browser_navigator.h" |
| 28 #include "chrome/browser/ui/browser_window.h" | 29 #include "chrome/browser/ui/browser_window.h" |
| 29 #include "chrome/browser/ui/chrome_pages.h" | 30 #include "chrome/browser/ui/chrome_pages.h" |
| 30 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 31 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 31 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 32 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 32 #include "chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.h" | 33 #include "chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.h" |
| 33 #include "chrome/common/url_constants.h" | 34 #include "chrome/common/url_constants.h" |
| 34 | 35 |
| 35 OneClickSigninSyncStarter::OneClickSigninSyncStarter( | 36 OneClickSigninSyncStarter::OneClickSigninSyncStarter( |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 130 } |
| 130 | 131 |
| 131 DCHECK(client->is_registered()); | 132 DCHECK(client->is_registered()); |
| 132 DVLOG(1) << "Policy registration succeeded: dm_token=" << client->dm_token(); | 133 DVLOG(1) << "Policy registration succeeded: dm_token=" << client->dm_token(); |
| 133 | 134 |
| 134 // Stash away a copy of our CloudPolicyClient (should not already have one). | 135 // Stash away a copy of our CloudPolicyClient (should not already have one). |
| 135 DCHECK(!policy_client_); | 136 DCHECK(!policy_client_); |
| 136 policy_client_.swap(client); | 137 policy_client_.swap(client); |
| 137 | 138 |
| 138 // Allow user to create a new profile before continuing with sign-in. | 139 // Allow user to create a new profile before continuing with sign-in. |
| 139 ProfileSigninConfirmationDialog::ShowDialog( | 140 chrome::ShowProfileSigninConfirmationDialog( |
| 140 profile_, | 141 profile_, |
| 141 signin->GetUsernameForAuthInProgress(), | 142 signin->GetUsernameForAuthInProgress(), |
| 142 base::Bind(&OneClickSigninSyncStarter::CancelSigninAndDelete, | 143 base::Bind(&OneClickSigninSyncStarter::CancelSigninAndDelete, |
| 143 weak_pointer_factory_.GetWeakPtr()), | 144 weak_pointer_factory_.GetWeakPtr()), |
| 144 base::Bind(&OneClickSigninSyncStarter::CreateNewSignedInProfile, | 145 base::Bind(&OneClickSigninSyncStarter::CreateNewSignedInProfile, |
| 145 weak_pointer_factory_.GetWeakPtr()), | 146 weak_pointer_factory_.GetWeakPtr()), |
| 146 base::Bind(&OneClickSigninSyncStarter::LoadPolicyWithCachedClient, | 147 base::Bind(&OneClickSigninSyncStarter::LoadPolicyWithCachedClient, |
| 147 weak_pointer_factory_.GetWeakPtr())); | 148 weak_pointer_factory_.GetWeakPtr())); |
| 148 } | 149 } |
| 149 | 150 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 | 342 |
| 342 void OneClickSigninSyncStarter::ShowSyncSettingsPageOnSameTab() { | 343 void OneClickSigninSyncStarter::ShowSyncSettingsPageOnSameTab() { |
| 343 std::string url = std::string(chrome::kChromeUISettingsURL) + | 344 std::string url = std::string(chrome::kChromeUISettingsURL) + |
| 344 chrome::kSyncSetupSubPage; | 345 chrome::kSyncSetupSubPage; |
| 345 chrome::NavigateParams params( | 346 chrome::NavigateParams params( |
| 346 browser_, GURL(url), content::PAGE_TRANSITION_AUTO_TOPLEVEL); | 347 browser_, GURL(url), content::PAGE_TRANSITION_AUTO_TOPLEVEL); |
| 347 params.disposition = CURRENT_TAB; | 348 params.disposition = CURRENT_TAB; |
| 348 params.window_action = chrome::NavigateParams::SHOW_WINDOW; | 349 params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
| 349 chrome::Navigate(¶ms); | 350 chrome::Navigate(¶ms); |
| 350 } | 351 } |
| OLD | NEW |