| 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" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 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" | 36 #include "chrome/browser/ui/sync/signin_histogram.h" |
| 37 #include "chrome/browser/ui/webui/options/options_handlers_helper.h" | 37 #include "chrome/browser/ui/webui/options/options_handlers_helper.h" |
| 38 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 38 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 39 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 39 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 40 #include "chrome/common/chrome_switches.h" | 40 #include "chrome/common/chrome_switches.h" |
| 41 #include "chrome/common/pref_names.h" | 41 #include "chrome/common/pref_names.h" |
| 42 #include "chrome/common/url_constants.h" | 42 #include "chrome/common/url_constants.h" |
| 43 #include "chrome/grit/chromium_strings.h" |
| 44 #include "chrome/grit/generated_resources.h" |
| 43 #include "components/google/core/browser/google_util.h" | 45 #include "components/google/core/browser/google_util.h" |
| 44 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 46 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 45 #include "components/signin/core/browser/signin_error_controller.h" | 47 #include "components/signin/core/browser/signin_error_controller.h" |
| 46 #include "components/signin/core/browser/signin_metrics.h" | 48 #include "components/signin/core/browser/signin_metrics.h" |
| 47 #include "components/signin/core/common/profile_management_switches.h" | 49 #include "components/signin/core/common/profile_management_switches.h" |
| 48 #include "components/sync_driver/sync_prefs.h" | 50 #include "components/sync_driver/sync_prefs.h" |
| 49 #include "content/public/browser/render_view_host.h" | 51 #include "content/public/browser/render_view_host.h" |
| 50 #include "content/public/browser/web_contents.h" | 52 #include "content/public/browser/web_contents.h" |
| 51 #include "content/public/browser/web_contents_delegate.h" | 53 #include "content/public/browser/web_contents_delegate.h" |
| 52 #include "google_apis/gaia/gaia_auth_util.h" | 54 #include "google_apis/gaia/gaia_auth_util.h" |
| 53 #include "google_apis/gaia/gaia_constants.h" | 55 #include "google_apis/gaia/gaia_constants.h" |
| 54 #include "grit/chromium_strings.h" | |
| 55 #include "grit/generated_resources.h" | |
| 56 #include "grit/locale_settings.h" | 56 #include "grit/locale_settings.h" |
| 57 #include "net/base/url_util.h" | 57 #include "net/base/url_util.h" |
| 58 #include "ui/base/l10n/l10n_util.h" | 58 #include "ui/base/l10n/l10n_util.h" |
| 59 | 59 |
| 60 #if defined(OS_CHROMEOS) | 60 #if defined(OS_CHROMEOS) |
| 61 #include "components/signin/core/browser/signin_manager_base.h" | 61 #include "components/signin/core/browser/signin_manager_base.h" |
| 62 #else | 62 #else |
| 63 #include "components/signin/core/browser/signin_manager.h" | 63 #include "components/signin/core/browser/signin_manager.h" |
| 64 #endif | 64 #endif |
| 65 | 65 |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 url = signin::GetPromoURL(signin::SOURCE_SETTINGS, true); | 548 url = signin::GetPromoURL(signin::SOURCE_SETTINGS, true); |
| 549 } | 549 } |
| 550 } | 550 } |
| 551 | 551 |
| 552 if (url.is_valid()) | 552 if (url.is_valid()) |
| 553 chrome::ShowSingletonTab(browser, url); | 553 chrome::ShowSingletonTab(browser, url); |
| 554 } | 554 } |
| 555 #endif | 555 #endif |
| 556 | 556 |
| 557 bool SyncSetupHandler::PrepareSyncSetup() { | 557 bool SyncSetupHandler::PrepareSyncSetup() { |
| 558 | |
| 559 // If the wizard is already visible, just focus that one. | 558 // If the wizard is already visible, just focus that one. |
| 560 if (FocusExistingWizardIfPresent()) { | 559 if (FocusExistingWizardIfPresent()) { |
| 561 if (!IsActiveLogin()) | 560 if (!IsActiveLogin()) |
| 562 CloseSyncSetup(); | 561 CloseSyncSetup(); |
| 563 return false; | 562 return false; |
| 564 } | 563 } |
| 565 | 564 |
| 566 // Notify services that login UI is now active. | 565 // Notify services that login UI is now active. |
| 567 GetLoginUIService()->SetLoginUI(this); | 566 GetLoginUIService()->SetLoginUI(this); |
| 568 | 567 |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 | 957 |
| 959 LoginUIService* service = GetLoginUIService(); | 958 LoginUIService* service = GetLoginUIService(); |
| 960 DCHECK(service); | 959 DCHECK(service); |
| 961 service->current_login_ui()->FocusUI(); | 960 service->current_login_ui()->FocusUI(); |
| 962 return true; | 961 return true; |
| 963 } | 962 } |
| 964 | 963 |
| 965 LoginUIService* SyncSetupHandler::GetLoginUIService() const { | 964 LoginUIService* SyncSetupHandler::GetLoginUIService() const { |
| 966 return LoginUIServiceFactory::GetForProfile(GetProfile()); | 965 return LoginUIServiceFactory::GetForProfile(GetProfile()); |
| 967 } | 966 } |
| OLD | NEW |