| 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" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 26 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 27 #include "chrome/browser/signin/signin_header_helper.h" | 27 #include "chrome/browser/signin/signin_header_helper.h" |
| 28 #include "chrome/browser/signin/signin_manager_factory.h" | 28 #include "chrome/browser/signin/signin_manager_factory.h" |
| 29 #include "chrome/browser/signin/signin_promo.h" | 29 #include "chrome/browser/signin/signin_promo.h" |
| 30 #include "chrome/browser/sync/profile_sync_service.h" | 30 #include "chrome/browser/sync/profile_sync_service.h" |
| 31 #include "chrome/browser/sync/profile_sync_service_factory.h" | 31 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 32 #include "chrome/browser/ui/browser_finder.h" | 32 #include "chrome/browser/ui/browser_finder.h" |
| 33 #include "chrome/browser/ui/browser_navigator.h" | 33 #include "chrome/browser/ui/browser_navigator.h" |
| 34 #include "chrome/browser/ui/browser_window.h" | 34 #include "chrome/browser/ui/browser_window.h" |
| 35 #include "chrome/browser/ui/singleton_tabs.h" | 35 #include "chrome/browser/ui/singleton_tabs.h" |
| 36 #include "chrome/browser/ui/sync/signin_histogram.h" | |
| 37 #include "chrome/browser/ui/webui/options/options_handlers_helper.h" | 36 #include "chrome/browser/ui/webui/options/options_handlers_helper.h" |
| 38 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 37 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 39 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 38 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 40 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
| 41 #include "chrome/common/url_constants.h" | 40 #include "chrome/common/url_constants.h" |
| 42 #include "chrome/grit/chromium_strings.h" | 41 #include "chrome/grit/chromium_strings.h" |
| 43 #include "chrome/grit/generated_resources.h" | 42 #include "chrome/grit/generated_resources.h" |
| 44 #include "chrome/grit/locale_settings.h" | 43 #include "chrome/grit/locale_settings.h" |
| 45 #include "components/google/core/browser/google_util.h" | 44 #include "components/google/core/browser/google_util.h" |
| 46 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 45 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 force_new_tab = true; | 358 force_new_tab = true; |
| 360 } | 359 } |
| 361 | 360 |
| 362 // If the signin manager already has an authenticated username, this is a | 361 // If the signin manager already has an authenticated username, this is a |
| 363 // re-auth scenario, and we need to ensure that the user signs in with the | 362 // re-auth scenario, and we need to ensure that the user signs in with the |
| 364 // same email address. | 363 // same email address. |
| 365 GURL url; | 364 GURL url; |
| 366 if (SigninManagerFactory::GetForProfile( | 365 if (SigninManagerFactory::GetForProfile( |
| 367 browser->profile())->IsAuthenticated()) { | 366 browser->profile())->IsAuthenticated()) { |
| 368 UMA_HISTOGRAM_ENUMERATION("Signin.Reauth", | 367 UMA_HISTOGRAM_ENUMERATION("Signin.Reauth", |
| 369 signin::HISTOGRAM_SHOWN, | 368 signin_metrics::HISTOGRAM_REAUTH_SHOWN, |
| 370 signin::HISTOGRAM_MAX); | 369 signin_metrics::HISTOGRAM_REAUTH_MAX); |
| 371 | 370 |
| 372 SigninErrorController* error_controller = | 371 SigninErrorController* error_controller = |
| 373 ProfileOAuth2TokenServiceFactory::GetForProfile(browser->profile())-> | 372 ProfileOAuth2TokenServiceFactory::GetForProfile(browser->profile())-> |
| 374 signin_error_controller(); | 373 signin_error_controller(); |
| 375 DCHECK(error_controller->HasError()); | 374 DCHECK(error_controller->HasError()); |
| 376 if (switches::IsNewAvatarMenu() && !force_new_tab) { | 375 if (switches::IsNewAvatarMenu() && !force_new_tab) { |
| 377 browser->window()->ShowAvatarBubbleFromAvatarButton( | 376 browser->window()->ShowAvatarBubbleFromAvatarButton( |
| 378 BrowserWindow::AVATAR_BUBBLE_MODE_REAUTH, | 377 BrowserWindow::AVATAR_BUBBLE_MODE_REAUTH, |
| 379 signin::ManageAccountsParams()); | 378 signin::ManageAccountsParams()); |
| 380 } else { | 379 } else { |
| 381 url = signin::GetReauthURL(browser->profile(), | 380 url = signin::GetReauthURL(browser->profile(), |
| 382 error_controller->error_account_id()); | 381 error_controller->error_account_id()); |
| 383 } | 382 } |
| 384 } else { | 383 } else { |
| 384 signin_metrics::LogSigninSource(signin_metrics::SOURCE_SETTINGS); |
| 385 if (switches::IsNewAvatarMenu() && !force_new_tab) { | 385 if (switches::IsNewAvatarMenu() && !force_new_tab) { |
| 386 browser->window()->ShowAvatarBubbleFromAvatarButton( | 386 browser->window()->ShowAvatarBubbleFromAvatarButton( |
| 387 BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, | 387 BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, |
| 388 signin::ManageAccountsParams()); | 388 signin::ManageAccountsParams()); |
| 389 } else { | 389 } else { |
| 390 url = signin::GetPromoURL(signin::SOURCE_SETTINGS, true); | 390 url = signin::GetPromoURL(signin_metrics::SOURCE_SETTINGS, true); |
| 391 } | 391 } |
| 392 } | 392 } |
| 393 | 393 |
| 394 if (url.is_valid()) | 394 if (url.is_valid()) |
| 395 chrome::ShowSingletonTab(browser, url); | 395 chrome::ShowSingletonTab(browser, url); |
| 396 } | 396 } |
| 397 #endif | 397 #endif |
| 398 | 398 |
| 399 bool SyncSetupHandler::PrepareSyncSetup() { | 399 bool SyncSetupHandler::PrepareSyncSetup() { |
| 400 // If the wizard is already visible, just focus that one. | 400 // If the wizard is already visible, just focus that one. |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 "SyncSetupOverlay.showSyncSetupPage", page, args); | 923 "SyncSetupOverlay.showSyncSetupPage", page, args); |
| 924 | 924 |
| 925 // Make sure the tab used for the Gaia sign in does not cover the settings | 925 // Make sure the tab used for the Gaia sign in does not cover the settings |
| 926 // tab. | 926 // tab. |
| 927 FocusUI(); | 927 FocusUI(); |
| 928 } | 928 } |
| 929 | 929 |
| 930 LoginUIService* SyncSetupHandler::GetLoginUIService() const { | 930 LoginUIService* SyncSetupHandler::GetLoginUIService() const { |
| 931 return LoginUIServiceFactory::GetForProfile(GetProfile()); | 931 return LoginUIServiceFactory::GetForProfile(GetProfile()); |
| 932 } | 932 } |
| OLD | NEW |