OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_internals_message_handler.h" | 5 #include "chrome/browser/ui/webui/sync_internals_message_handler.h" |
6 | 6 |
| 7 #include <utility> |
7 #include <vector> | 8 #include <vector> |
8 | 9 |
9 #include "base/logging.h" | 10 #include "base/logging.h" |
10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/sync/profile_sync_service_factory.h" | 12 #include "chrome/browser/sync/profile_sync_service_factory.h" |
12 #include "chrome/common/channel_info.h" | 13 #include "chrome/common/channel_info.h" |
13 #include "components/browser_sync/browser/profile_sync_service.h" | 14 #include "components/browser_sync/browser/profile_sync_service.h" |
14 #include "components/signin/core/browser/signin_manager_base.h" | 15 #include "components/signin/core/browser/signin_manager_base.h" |
15 #include "components/sync_driver/about_sync_util.h" | 16 #include "components/sync_driver/about_sync_util.h" |
16 #include "components/sync_driver/sync_service.h" | 17 #include "components/sync_driver/sync_service.h" |
(...skipping 21 matching lines...) Expand all Loading... |
38 } | 39 } |
39 }; | 40 }; |
40 } // namespace | 41 } // namespace |
41 | 42 |
42 SyncInternalsMessageHandler::SyncInternalsMessageHandler() | 43 SyncInternalsMessageHandler::SyncInternalsMessageHandler() |
43 : SyncInternalsMessageHandler( | 44 : SyncInternalsMessageHandler( |
44 make_scoped_ptr(new UtilAboutSyncDataExtractor())) {} | 45 make_scoped_ptr(new UtilAboutSyncDataExtractor())) {} |
45 | 46 |
46 SyncInternalsMessageHandler::SyncInternalsMessageHandler( | 47 SyncInternalsMessageHandler::SyncInternalsMessageHandler( |
47 scoped_ptr<AboutSyncDataExtractor> about_sync_data_extractor) | 48 scoped_ptr<AboutSyncDataExtractor> about_sync_data_extractor) |
48 : about_sync_data_extractor_(about_sync_data_extractor.Pass()), | 49 : about_sync_data_extractor_(std::move(about_sync_data_extractor)), |
49 weak_ptr_factory_(this) {} | 50 weak_ptr_factory_(this) {} |
50 | 51 |
51 SyncInternalsMessageHandler::~SyncInternalsMessageHandler() { | 52 SyncInternalsMessageHandler::~SyncInternalsMessageHandler() { |
52 if (js_controller_) | 53 if (js_controller_) |
53 js_controller_->RemoveJsEventHandler(this); | 54 js_controller_->RemoveJsEventHandler(this); |
54 | 55 |
55 ProfileSyncService* service = GetProfileSyncService(); | 56 ProfileSyncService* service = GetProfileSyncService(); |
56 if (service && service->HasObserver(this)) { | 57 if (service && service->HasObserver(this)) { |
57 service->RemoveObserver(this); | 58 service->RemoveObserver(this); |
58 service->RemoveProtocolEventObserver(this); | 59 service->RemoveProtocolEventObserver(this); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 *value); | 242 *value); |
242 } | 243 } |
243 | 244 |
244 // Gets the ProfileSyncService of the underlying original profile. | 245 // Gets the ProfileSyncService of the underlying original profile. |
245 // May return NULL (e.g., if sync is disabled on the command line). | 246 // May return NULL (e.g., if sync is disabled on the command line). |
246 ProfileSyncService* SyncInternalsMessageHandler::GetProfileSyncService() { | 247 ProfileSyncService* SyncInternalsMessageHandler::GetProfileSyncService() { |
247 Profile* profile = Profile::FromWebUI(web_ui()); | 248 Profile* profile = Profile::FromWebUI(web_ui()); |
248 return ProfileSyncServiceFactory::GetForProfile( | 249 return ProfileSyncServiceFactory::GetForProfile( |
249 profile->GetOriginalProfile()); | 250 profile->GetOriginalProfile()); |
250 } | 251 } |
OLD | NEW |