Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: chrome/browser/ui/sync/one_click_signin_sync_starter.cc

Issue 338993007: Track when and how a profile is signed out via UMA. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: SignOut() param in Android tests Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 20 matching lines...) Expand all
31 #include "chrome/browser/ui/browser_tabstrip.h" 31 #include "chrome/browser/ui/browser_tabstrip.h"
32 #include "chrome/browser/ui/browser_window.h" 32 #include "chrome/browser/ui/browser_window.h"
33 #include "chrome/browser/ui/chrome_pages.h" 33 #include "chrome/browser/ui/chrome_pages.h"
34 #include "chrome/browser/ui/sync/one_click_signin_sync_observer.h" 34 #include "chrome/browser/ui/sync/one_click_signin_sync_observer.h"
35 #include "chrome/browser/ui/tabs/tab_strip_model.h" 35 #include "chrome/browser/ui/tabs/tab_strip_model.h"
36 #include "chrome/browser/ui/webui/signin/login_ui_service.h" 36 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
37 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 37 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
38 #include "chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.h" 38 #include "chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.h"
39 #include "chrome/common/url_constants.h" 39 #include "chrome/common/url_constants.h"
40 #include "components/signin/core/browser/signin_manager.h" 40 #include "components/signin/core/browser/signin_manager.h"
41 #include "components/signin/core/browser/signin_metrics.h"
41 #include "components/signin/core/common/profile_management_switches.h" 42 #include "components/signin/core/common/profile_management_switches.h"
42 #include "components/sync_driver/sync_prefs.h" 43 #include "components/sync_driver/sync_prefs.h"
43 #include "grit/chromium_strings.h" 44 #include "grit/chromium_strings.h"
44 #include "grit/generated_resources.h" 45 #include "grit/generated_resources.h"
45 #include "ui/base/l10n/l10n_util.h" 46 #include "ui/base/l10n/l10n_util.h"
46 #include "ui/base/resource/resource_bundle.h" 47 #include "ui/base/resource/resource_bundle.h"
47 48
48 OneClickSigninSyncStarter::OneClickSigninSyncStarter( 49 OneClickSigninSyncStarter::OneClickSigninSyncStarter(
49 Profile* profile, 50 Profile* profile,
50 Browser* browser, 51 Browser* browser,
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // and switch over to tracking that profile. 273 // and switch over to tracking that profile.
273 new_signin_manager->CopyCredentialsFrom(*old_signin_manager); 274 new_signin_manager->CopyCredentialsFrom(*old_signin_manager);
274 FinishProfileSyncServiceSetup(); 275 FinishProfileSyncServiceSetup();
275 Initialize(new_profile, NULL); 276 Initialize(new_profile, NULL);
276 DCHECK_EQ(profile_, new_profile); 277 DCHECK_EQ(profile_, new_profile);
277 278
278 // We've transferred our credentials to the new profile - notify that 279 // We've transferred our credentials to the new profile - notify that
279 // the signin for the original profile was cancelled (must do this after 280 // the signin for the original profile was cancelled (must do this after
280 // we have called Initialize() with the new profile, as otherwise this 281 // we have called Initialize() with the new profile, as otherwise this
281 // object will get freed when the signin on the old profile is cancelled. 282 // object will get freed when the signin on the old profile is cancelled.
282 old_signin_manager->SignOut(); 283 old_signin_manager->SignOut(signin_metrics::TRANSFER_CREDENTIALS);
283 284
284 // Load policy for the just-created profile - once policy has finished 285 // Load policy for the just-created profile - once policy has finished
285 // loading the signin process will complete. 286 // loading the signin process will complete.
286 LoadPolicyWithCachedCredentials(); 287 LoadPolicyWithCachedCredentials();
287 288
288 // Open the profile's first window, after all initialization. 289 // Open the profile's first window, after all initialization.
289 profiles::FindOrCreateNewWindowForProfile( 290 profiles::FindOrCreateNewWindowForProfile(
290 new_profile, 291 new_profile,
291 chrome::startup::IS_PROCESS_STARTUP, 292 chrome::startup::IS_PROCESS_STARTUP,
292 chrome::startup::IS_FIRST_RUN, 293 chrome::startup::IS_FIRST_RUN,
293 desktop_type, 294 desktop_type,
294 false); 295 false);
295 break; 296 break;
296 } 297 }
297 case Profile::CREATE_STATUS_REMOTE_FAIL: 298 case Profile::CREATE_STATUS_REMOTE_FAIL:
298 case Profile::CREATE_STATUS_CANCELED: 299 case Profile::CREATE_STATUS_CANCELED:
299 case Profile::MAX_CREATE_STATUS: { 300 case Profile::MAX_CREATE_STATUS: {
300 NOTREACHED() << "Invalid profile creation status"; 301 NOTREACHED() << "Invalid profile creation status";
301 CancelSigninAndDelete(); 302 CancelSigninAndDelete();
302 return; 303 return;
303 } 304 }
304 } 305 }
305 } 306 }
306 #endif 307 #endif
307 308
308 void OneClickSigninSyncStarter::CancelSigninAndDelete() { 309 void OneClickSigninSyncStarter::CancelSigninAndDelete() {
309 SigninManagerFactory::GetForProfile(profile_)->SignOut(); 310 SigninManagerFactory::GetForProfile(profile_)->SignOut(
311 signin_metrics::ABORT_SIGNIN);
310 // The statement above results in a call to SigninFailed() which will free 312 // The statement above results in a call to SigninFailed() which will free
311 // this object, so do not refer to the OneClickSigninSyncStarter object 313 // this object, so do not refer to the OneClickSigninSyncStarter object
312 // after this point. 314 // after this point.
313 } 315 }
314 316
315 void OneClickSigninSyncStarter::ConfirmAndSignin() { 317 void OneClickSigninSyncStarter::ConfirmAndSignin() {
316 SigninManager* signin = SigninManagerFactory::GetForProfile(profile_); 318 SigninManager* signin = SigninManagerFactory::GetForProfile(profile_);
317 if (confirmation_required_ == CONFIRM_UNTRUSTED_SIGNIN) { 319 if (confirmation_required_ == CONFIRM_UNTRUSTED_SIGNIN) {
318 browser_ = EnsureBrowser(browser_, profile_, desktop_type_); 320 browser_ = EnsureBrowser(browser_, profile_, desktop_type_);
319 // Display a confirmation dialog to the user. 321 // Display a confirmation dialog to the user.
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 false /* user_gesture */); 549 false /* user_gesture */);
548 } 550 }
549 551
550 void OneClickSigninSyncStarter::LoadContinueUrl() { 552 void OneClickSigninSyncStarter::LoadContinueUrl() {
551 web_contents()->GetController().LoadURL( 553 web_contents()->GetController().LoadURL(
552 continue_url_, 554 continue_url_,
553 content::Referrer(), 555 content::Referrer(),
554 content::PAGE_TRANSITION_AUTO_TOPLEVEL, 556 content::PAGE_TRANSITION_AUTO_TOPLEVEL,
555 std::string()); 557 std::string());
556 } 558 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_unittest.cc ('k') | chrome/browser/ui/webui/sync_setup_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698