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

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: Remove tracking android in separate UMA bucket 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.
283 signin_metrics::LogSignout(signin_metrics::TRANSFER_CREDENTIALS);
282 old_signin_manager->SignOut(); 284 old_signin_manager->SignOut();
283 285
284 // Load policy for the just-created profile - once policy has finished 286 // Load policy for the just-created profile - once policy has finished
285 // loading the signin process will complete. 287 // loading the signin process will complete.
286 LoadPolicyWithCachedCredentials(); 288 LoadPolicyWithCachedCredentials();
287 289
288 // Open the profile's first window, after all initialization. 290 // Open the profile's first window, after all initialization.
289 profiles::FindOrCreateNewWindowForProfile( 291 profiles::FindOrCreateNewWindowForProfile(
290 new_profile, 292 new_profile,
291 chrome::startup::IS_PROCESS_STARTUP, 293 chrome::startup::IS_PROCESS_STARTUP,
292 chrome::startup::IS_FIRST_RUN, 294 chrome::startup::IS_FIRST_RUN,
293 desktop_type, 295 desktop_type,
294 false); 296 false);
295 break; 297 break;
296 } 298 }
297 case Profile::CREATE_STATUS_REMOTE_FAIL: 299 case Profile::CREATE_STATUS_REMOTE_FAIL:
298 case Profile::CREATE_STATUS_CANCELED: 300 case Profile::CREATE_STATUS_CANCELED:
299 case Profile::MAX_CREATE_STATUS: { 301 case Profile::MAX_CREATE_STATUS: {
300 NOTREACHED() << "Invalid profile creation status"; 302 NOTREACHED() << "Invalid profile creation status";
301 CancelSigninAndDelete(); 303 CancelSigninAndDelete();
302 return; 304 return;
303 } 305 }
304 } 306 }
305 } 307 }
306 #endif 308 #endif
307 309
308 void OneClickSigninSyncStarter::CancelSigninAndDelete() { 310 void OneClickSigninSyncStarter::CancelSigninAndDelete() {
311 signin_metrics::LogSignout(signin_metrics::ABORT_SIGNIN);
309 SigninManagerFactory::GetForProfile(profile_)->SignOut(); 312 SigninManagerFactory::GetForProfile(profile_)->SignOut();
310 // The statement above results in a call to SigninFailed() which will free 313 // The statement above results in a call to SigninFailed() which will free
311 // this object, so do not refer to the OneClickSigninSyncStarter object 314 // this object, so do not refer to the OneClickSigninSyncStarter object
312 // after this point. 315 // after this point.
313 } 316 }
314 317
315 void OneClickSigninSyncStarter::ConfirmAndSignin() { 318 void OneClickSigninSyncStarter::ConfirmAndSignin() {
316 SigninManager* signin = SigninManagerFactory::GetForProfile(profile_); 319 SigninManager* signin = SigninManagerFactory::GetForProfile(profile_);
317 if (confirmation_required_ == CONFIRM_UNTRUSTED_SIGNIN) { 320 if (confirmation_required_ == CONFIRM_UNTRUSTED_SIGNIN) {
318 browser_ = EnsureBrowser(browser_, profile_, desktop_type_); 321 browser_ = EnsureBrowser(browser_, profile_, desktop_type_);
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 false /* user_gesture */); 550 false /* user_gesture */);
548 } 551 }
549 552
550 void OneClickSigninSyncStarter::LoadContinueUrl() { 553 void OneClickSigninSyncStarter::LoadContinueUrl() {
551 web_contents()->GetController().LoadURL( 554 web_contents()->GetController().LoadURL(
552 continue_url_, 555 continue_url_,
553 content::Referrer(), 556 content::Referrer(),
554 content::PAGE_TRANSITION_AUTO_TOPLEVEL, 557 content::PAGE_TRANSITION_AUTO_TOPLEVEL,
555 std::string()); 558 std::string());
556 } 559 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698