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/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 | 10 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 chrome::ShowProfileSigninConfirmationDialog( | 194 chrome::ShowProfileSigninConfirmationDialog( |
195 browser_, | 195 browser_, |
196 web_contents, | 196 web_contents, |
197 profile_, | 197 profile_, |
198 signin->GetUsernameForAuthInProgress(), | 198 signin->GetUsernameForAuthInProgress(), |
199 new SigninDialogDelegate(weak_pointer_factory_.GetWeakPtr())); | 199 new SigninDialogDelegate(weak_pointer_factory_.GetWeakPtr())); |
200 } | 200 } |
201 | 201 |
202 void OneClickSigninSyncStarter::LoadPolicyWithCachedClient() { | 202 void OneClickSigninSyncStarter::LoadPolicyWithCachedClient() { |
203 DCHECK(policy_client_); | 203 DCHECK(policy_client_); |
| 204 SigninManager* signin = SigninManagerFactory::GetForProfile(profile_); |
204 policy::UserPolicySigninService* policy_service = | 205 policy::UserPolicySigninService* policy_service = |
205 policy::UserPolicySigninServiceFactory::GetForProfile(profile_); | 206 policy::UserPolicySigninServiceFactory::GetForProfile(profile_); |
206 policy_service->FetchPolicyForSignedInUser( | 207 policy_service->FetchPolicyForSignedInUser( |
| 208 signin->GetUsernameForAuthInProgress(), |
207 policy_client_.Pass(), | 209 policy_client_.Pass(), |
208 base::Bind(&OneClickSigninSyncStarter::OnPolicyFetchComplete, | 210 base::Bind(&OneClickSigninSyncStarter::OnPolicyFetchComplete, |
209 weak_pointer_factory_.GetWeakPtr())); | 211 weak_pointer_factory_.GetWeakPtr())); |
210 } | 212 } |
211 | 213 |
212 void OneClickSigninSyncStarter::OnPolicyFetchComplete(bool success) { | 214 void OneClickSigninSyncStarter::OnPolicyFetchComplete(bool success) { |
213 // For now, we allow signin to complete even if the policy fetch fails. If | 215 // For now, we allow signin to complete even if the policy fetch fails. If |
214 // we ever want to change this behavior, we could call | 216 // we ever want to change this behavior, we could call |
215 // SigninManager::SignOut() here instead. | 217 // SigninManager::SignOut() here instead. |
216 DLOG_IF(ERROR, !success) << "Error fetching policy for user"; | 218 DLOG_IF(ERROR, !success) << "Error fetching policy for user"; |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 false); | 495 false); |
494 contents->OpenURL(params); | 496 contents->OpenURL(params); |
495 | 497 |
496 // Activate the tab. | 498 // Activate the tab. |
497 Browser* browser = chrome::FindBrowserWithWebContents(contents); | 499 Browser* browser = chrome::FindBrowserWithWebContents(contents); |
498 int content_index = | 500 int content_index = |
499 browser->tab_strip_model()->GetIndexOfWebContents(contents); | 501 browser->tab_strip_model()->GetIndexOfWebContents(contents); |
500 browser->tab_strip_model()->ActivateTabAt(content_index, | 502 browser->tab_strip_model()->ActivateTabAt(content_index, |
501 false /* user_gesture */); | 503 false /* user_gesture */); |
502 } | 504 } |
OLD | NEW |