OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/sync/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <map> | 8 #include <map> |
9 #include <ostream> | 9 #include <ostream> |
10 #include <set> | 10 #include <set> |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "chrome/browser/sync/glue/change_processor.h" | 31 #include "chrome/browser/sync/glue/change_processor.h" |
32 #include "chrome/browser/sync/glue/data_type_controller.h" | 32 #include "chrome/browser/sync/glue/data_type_controller.h" |
33 #include "chrome/browser/sync/glue/data_type_manager.h" | 33 #include "chrome/browser/sync/glue/data_type_manager.h" |
34 #include "chrome/browser/sync/glue/session_data_type_controller.h" | 34 #include "chrome/browser/sync/glue/session_data_type_controller.h" |
35 #include "chrome/browser/sync/js_arg_list.h" | 35 #include "chrome/browser/sync/js_arg_list.h" |
36 #include "chrome/browser/sync/js_event_details.h" | 36 #include "chrome/browser/sync/js_event_details.h" |
37 #include "chrome/browser/sync/profile_sync_factory.h" | 37 #include "chrome/browser/sync/profile_sync_factory.h" |
38 #include "chrome/browser/sync/signin_manager.h" | 38 #include "chrome/browser/sync/signin_manager.h" |
39 #include "chrome/browser/ui/browser.h" | 39 #include "chrome/browser/ui/browser.h" |
40 #include "chrome/browser/ui/browser_list.h" | 40 #include "chrome/browser/ui/browser_list.h" |
| 41 #include "chrome/browser/ui/browser_window.h" |
41 #include "chrome/common/chrome_notification_types.h" | 42 #include "chrome/common/chrome_notification_types.h" |
42 #include "chrome/common/chrome_switches.h" | 43 #include "chrome/common/chrome_switches.h" |
43 #include "chrome/common/chrome_version_info.h" | 44 #include "chrome/common/chrome_version_info.h" |
44 #include "chrome/common/net/gaia/gaia_constants.h" | 45 #include "chrome/common/net/gaia/gaia_constants.h" |
45 #include "chrome/common/pref_names.h" | 46 #include "chrome/common/pref_names.h" |
46 #include "chrome/common/time_format.h" | 47 #include "chrome/common/time_format.h" |
47 #include "chrome/common/url_constants.h" | 48 #include "chrome/common/url_constants.h" |
48 #include "content/common/notification_details.h" | 49 #include "content/common/notification_details.h" |
49 #include "content/common/notification_source.h" | 50 #include "content/common/notification_source.h" |
50 #include "grit/generated_resources.h" | 51 #include "grit/generated_resources.h" |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 } | 852 } |
852 | 853 |
853 if (sync_everything) | 854 if (sync_everything) |
854 ShowSyncSetup(SyncSetupWizard::SYNC_EVERYTHING); | 855 ShowSyncSetup(SyncSetupWizard::SYNC_EVERYTHING); |
855 else | 856 else |
856 ShowSyncSetup(SyncSetupWizard::CONFIGURE); | 857 ShowSyncSetup(SyncSetupWizard::CONFIGURE); |
857 } | 858 } |
858 | 859 |
859 void ProfileSyncService::ShowSyncSetup(SyncSetupWizard::State state) { | 860 void ProfileSyncService::ShowSyncSetup(SyncSetupWizard::State state) { |
860 wizard_.Step(state); | 861 wizard_.Step(state); |
861 BrowserList::GetLastActiveWithProfile(profile())->ShowOptionsTab( | 862 Browser* browser = BrowserList::GetLastActiveWithProfile(profile()); |
862 chrome::kSyncSetupSubPage); | 863 if (!browser) { |
| 864 browser = Browser::Create(profile()); |
| 865 browser->ShowOptionsTab(chrome::kSyncSetupSubPage); |
| 866 browser->window()->Show(); |
| 867 } else { |
| 868 browser->ShowOptionsTab(chrome::kSyncSetupSubPage); |
| 869 } |
863 } | 870 } |
864 | 871 |
865 SyncBackendHost::StatusSummary ProfileSyncService::QuerySyncStatusSummary() { | 872 SyncBackendHost::StatusSummary ProfileSyncService::QuerySyncStatusSummary() { |
866 if (backend_.get() && backend_initialized_) | 873 if (backend_.get() && backend_initialized_) |
867 return backend_->GetStatusSummary(); | 874 return backend_->GetStatusSummary(); |
868 else | 875 else |
869 return SyncBackendHost::Status::OFFLINE_UNUSABLE; | 876 return SyncBackendHost::Status::OFFLINE_UNUSABLE; |
870 } | 877 } |
871 | 878 |
872 SyncBackendHost::Status ProfileSyncService::QueryDetailedSyncStatus() { | 879 SyncBackendHost::Status ProfileSyncService::QueryDetailedSyncStatus() { |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 // is initialized, all enabled data types are consistent with one | 1426 // is initialized, all enabled data types are consistent with one |
1420 // another, and no unrecoverable error has transpired. | 1427 // another, and no unrecoverable error has transpired. |
1421 if (unrecoverable_error_detected_) | 1428 if (unrecoverable_error_detected_) |
1422 return false; | 1429 return false; |
1423 | 1430 |
1424 if (!data_type_manager_.get()) | 1431 if (!data_type_manager_.get()) |
1425 return false; | 1432 return false; |
1426 | 1433 |
1427 return data_type_manager_->state() == DataTypeManager::CONFIGURED; | 1434 return data_type_manager_->state() == DataTypeManager::CONFIGURED; |
1428 } | 1435 } |
OLD | NEW |