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/sync_setup_handler.h" | 5 #include "chrome/browser/ui/webui/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" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/i18n/time_formatting.h" | 12 #include "base/i18n/time_formatting.h" |
13 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
14 #include "base/json/json_writer.h" | 14 #include "base/json/json_writer.h" |
15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
16 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "base/values.h" | 18 #include "base/values.h" |
19 #include "chrome/app/chrome_command_ids.h" | 19 #include "chrome/app/chrome_command_ids.h" |
20 #include "chrome/browser/google/google_util.h" | 20 #include "chrome/browser/google/google_util.h" |
21 #include "chrome/browser/lifetime/application_lifetime.h" | 21 #include "chrome/browser/lifetime/application_lifetime.h" |
22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/profiles/profile_info_cache.h" | 23 #include "chrome/browser/profiles/profile_info_cache.h" |
24 #include "chrome/browser/profiles/profile_manager.h" | 24 #include "chrome/browser/profiles/profile_manager.h" |
25 #include "chrome/browser/profiles/profile_metrics.h" | 25 #include "chrome/browser/profiles/profile_metrics.h" |
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_manager_factory.h" | 28 #include "chrome/browser/signin/signin_manager_factory.h" |
28 #include "chrome/browser/signin/signin_promo.h" | 29 #include "chrome/browser/signin/signin_promo.h" |
29 #include "chrome/browser/sync/profile_sync_service.h" | 30 #include "chrome/browser/sync/profile_sync_service.h" |
30 #include "chrome/browser/sync/profile_sync_service_factory.h" | 31 #include "chrome/browser/sync/profile_sync_service_factory.h" |
31 #include "chrome/browser/ui/browser_finder.h" | 32 #include "chrome/browser/ui/browser_finder.h" |
32 #include "chrome/browser/ui/browser_navigator.h" | 33 #include "chrome/browser/ui/browser_navigator.h" |
33 #include "chrome/browser/ui/browser_window.h" | 34 #include "chrome/browser/ui/browser_window.h" |
34 #include "chrome/browser/ui/singleton_tabs.h" | 35 #include "chrome/browser/ui/singleton_tabs.h" |
35 #include "chrome/browser/ui/sync/signin_histogram.h" | 36 #include "chrome/browser/ui/sync/signin_histogram.h" |
36 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 37 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 UMA_HISTOGRAM_ENUMERATION("Signin.Reauth", | 515 UMA_HISTOGRAM_ENUMERATION("Signin.Reauth", |
515 signin::HISTOGRAM_SHOWN, | 516 signin::HISTOGRAM_SHOWN, |
516 signin::HISTOGRAM_MAX); | 517 signin::HISTOGRAM_MAX); |
517 | 518 |
518 SigninErrorController* error_controller = | 519 SigninErrorController* error_controller = |
519 ProfileOAuth2TokenServiceFactory::GetForProfile(browser->profile())-> | 520 ProfileOAuth2TokenServiceFactory::GetForProfile(browser->profile())-> |
520 signin_error_controller(); | 521 signin_error_controller(); |
521 DCHECK(error_controller->HasError()); | 522 DCHECK(error_controller->HasError()); |
522 if (switches::IsNewProfileManagement()) { | 523 if (switches::IsNewProfileManagement()) { |
523 browser->window()->ShowAvatarBubbleFromAvatarButton( | 524 browser->window()->ShowAvatarBubbleFromAvatarButton( |
524 BrowserWindow::AVATAR_BUBBLE_MODE_REAUTH); | 525 BrowserWindow::AVATAR_BUBBLE_MODE_REAUTH, |
| 526 signin::GAIA_SERVICE_TYPE_NONE); |
525 } else { | 527 } else { |
526 url = signin::GetReauthURL(browser->profile(), | 528 url = signin::GetReauthURL(browser->profile(), |
527 error_controller->error_account_id()); | 529 error_controller->error_account_id()); |
528 } | 530 } |
529 } else { | 531 } else { |
530 if (switches::IsNewProfileManagement()) { | 532 if (switches::IsNewProfileManagement()) { |
531 browser->window()->ShowAvatarBubbleFromAvatarButton( | 533 browser->window()->ShowAvatarBubbleFromAvatarButton( |
532 BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN); | 534 BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, |
| 535 signin::GAIA_SERVICE_TYPE_NONE); |
533 } else { | 536 } else { |
534 url = signin::GetPromoURL(signin::SOURCE_SETTINGS, true); | 537 url = signin::GetPromoURL(signin::SOURCE_SETTINGS, true); |
535 } | 538 } |
536 } | 539 } |
537 | 540 |
538 if (url.is_valid()) | 541 if (url.is_valid()) |
539 chrome::ShowSingletonTab(browser, url); | 542 chrome::ShowSingletonTab(browser, url); |
540 } | 543 } |
541 #endif | 544 #endif |
542 | 545 |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 | 938 |
936 LoginUIService* service = GetLoginUIService(); | 939 LoginUIService* service = GetLoginUIService(); |
937 DCHECK(service); | 940 DCHECK(service); |
938 service->current_login_ui()->FocusUI(); | 941 service->current_login_ui()->FocusUI(); |
939 return true; | 942 return true; |
940 } | 943 } |
941 | 944 |
942 LoginUIService* SyncSetupHandler::GetLoginUIService() const { | 945 LoginUIService* SyncSetupHandler::GetLoginUIService() const { |
943 return LoginUIServiceFactory::GetForProfile(GetProfile()); | 946 return LoginUIServiceFactory::GetForProfile(GetProfile()); |
944 } | 947 } |
OLD | NEW |