| 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 16 matching lines...) Expand all Loading... |
| 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" | 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/signin/login_ui_service.h" | 38 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 38 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 39 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 39 #include "chrome/common/chrome_switches.h" | 40 #include "chrome/common/chrome_switches.h" |
| 40 #include "chrome/common/pref_names.h" | 41 #include "chrome/common/pref_names.h" |
| 41 #include "chrome/common/url_constants.h" | 42 #include "chrome/common/url_constants.h" |
| 42 #include "components/google/core/browser/google_util.h" | 43 #include "components/google/core/browser/google_util.h" |
| 43 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 44 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 44 #include "components/signin/core/browser/signin_error_controller.h" | 45 #include "components/signin/core/browser/signin_error_controller.h" |
| 45 #include "components/signin/core/browser/signin_metrics.h" | 46 #include "components/signin/core/browser/signin_metrics.h" |
| 46 #include "components/signin/core/common/profile_management_switches.h" | 47 #include "components/signin/core/common/profile_management_switches.h" |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 } | 811 } |
| 811 | 812 |
| 812 void SyncSetupHandler::HandleStopSyncing(const base::ListValue* args) { | 813 void SyncSetupHandler::HandleStopSyncing(const base::ListValue* args) { |
| 813 if (GetSyncService()) | 814 if (GetSyncService()) |
| 814 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); | 815 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); |
| 815 SigninManagerFactory::GetForProfile(GetProfile())->SignOut( | 816 SigninManagerFactory::GetForProfile(GetProfile())->SignOut( |
| 816 signin_metrics::USER_CLICKED_SIGNOUT_SETTINGS); | 817 signin_metrics::USER_CLICKED_SIGNOUT_SETTINGS); |
| 817 | 818 |
| 818 bool delete_profile = false; | 819 bool delete_profile = false; |
| 819 if (args->GetBoolean(0, &delete_profile) && delete_profile) { | 820 if (args->GetBoolean(0, &delete_profile) && delete_profile) { |
| 820 web_ui()->CallJavascriptFunction( | 821 // Do as BrowserOptionsHandler::DeleteProfile(). |
| 821 "BrowserOptions.deleteCurrentProfile"); | 822 options::helper::DeleteProfileAtPath(GetProfile()->GetPath(), web_ui()); |
| 822 } | 823 } |
| 823 } | 824 } |
| 824 #endif | 825 #endif |
| 825 | 826 |
| 826 void SyncSetupHandler::HandleCloseTimeout(const base::ListValue* args) { | 827 void SyncSetupHandler::HandleCloseTimeout(const base::ListValue* args) { |
| 827 CloseSyncSetup(); | 828 CloseSyncSetup(); |
| 828 } | 829 } |
| 829 | 830 |
| 830 void SyncSetupHandler::CloseSyncSetup() { | 831 void SyncSetupHandler::CloseSyncSetup() { |
| 831 // Stop a timer to handle timeout in waiting for checking network connection. | 832 // Stop a timer to handle timeout in waiting for checking network connection. |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 | 956 |
| 956 LoginUIService* service = GetLoginUIService(); | 957 LoginUIService* service = GetLoginUIService(); |
| 957 DCHECK(service); | 958 DCHECK(service); |
| 958 service->current_login_ui()->FocusUI(); | 959 service->current_login_ui()->FocusUI(); |
| 959 return true; | 960 return true; |
| 960 } | 961 } |
| 961 | 962 |
| 962 LoginUIService* SyncSetupHandler::GetLoginUIService() const { | 963 LoginUIService* SyncSetupHandler::GetLoginUIService() const { |
| 963 return LoginUIServiceFactory::GetForProfile(GetProfile()); | 964 return LoginUIServiceFactory::GetForProfile(GetProfile()); |
| 964 } | 965 } |
| OLD | NEW |