Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(482)

Side by Side Diff: chrome/browser/sync/chrome_sync_client.cc

Issue 1882243004: Convert //chrome/browser/sync from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/chrome_sync_client.h" 5 #include "chrome/browser/sync/chrome_sync_client.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ptr_util.h"
12 #include "build/build_config.h" 13 #include "build/build_config.h"
13 #include "chrome/browser/autofill/personal_data_manager_factory.h" 14 #include "chrome/browser/autofill/personal_data_manager_factory.h"
14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 15 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
15 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" 17 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h"
17 #include "chrome/browser/favicon/favicon_service_factory.h" 18 #include "chrome/browser/favicon/favicon_service_factory.h"
18 #include "chrome/browser/history/history_service_factory.h" 19 #include "chrome/browser/history/history_service_factory.h"
19 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" 20 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h"
20 #include "chrome/browser/password_manager/password_store_factory.h" 21 #include "chrome/browser/password_manager/password_store_factory.h"
21 #include "chrome/browser/prefs/pref_service_syncable_util.h" 22 #include "chrome/browser/prefs/pref_service_syncable_util.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return true; 155 return true;
155 } 156 }
156 return url.is_valid() && !url.SchemeIs(content::kChromeUIScheme) && 157 return url.is_valid() && !url.SchemeIs(content::kChromeUIScheme) &&
157 !url.SchemeIs(chrome::kChromeNativeScheme) && !url.SchemeIsFile(); 158 !url.SchemeIs(chrome::kChromeNativeScheme) && !url.SchemeIsFile();
158 } 159 }
159 160
160 SyncedWindowDelegatesGetter* GetSyncedWindowDelegatesGetter() override { 161 SyncedWindowDelegatesGetter* GetSyncedWindowDelegatesGetter() override {
161 return window_delegates_getter_.get(); 162 return window_delegates_getter_.get();
162 } 163 }
163 164
164 scoped_ptr<browser_sync::LocalSessionEventRouter> GetLocalSessionEventRouter() 165 std::unique_ptr<browser_sync::LocalSessionEventRouter>
165 override { 166 GetLocalSessionEventRouter() override {
166 syncer::SyncableService::StartSyncFlare flare( 167 syncer::SyncableService::StartSyncFlare flare(
167 sync_start_util::GetFlareForSyncableService(profile_->GetPath())); 168 sync_start_util::GetFlareForSyncableService(profile_->GetPath()));
168 return make_scoped_ptr( 169 return base::WrapUnique(
169 new NotificationServiceSessionsRouter(profile_, this, flare)); 170 new NotificationServiceSessionsRouter(profile_, this, flare));
170 } 171 }
171 172
172 private: 173 private:
173 Profile* profile_; 174 Profile* profile_;
174 scoped_ptr<SyncedWindowDelegatesGetter> window_delegates_getter_; 175 std::unique_ptr<SyncedWindowDelegatesGetter> window_delegates_getter_;
175 176
176 DISALLOW_COPY_AND_ASSIGN(SyncSessionsClientImpl); 177 DISALLOW_COPY_AND_ASSIGN(SyncSessionsClientImpl);
177 }; 178 };
178 179
179 ChromeSyncClient::ChromeSyncClient(Profile* profile) 180 ChromeSyncClient::ChromeSyncClient(Profile* profile)
180 : profile_(profile), 181 : profile_(profile),
181 sync_sessions_client_(new SyncSessionsClientImpl(profile)), 182 sync_sessions_client_(new SyncSessionsClientImpl(profile)),
182 browsing_data_remover_observer_(NULL), 183 browsing_data_remover_observer_(NULL),
183 weak_ptr_factory_(this) {} 184 weak_ptr_factory_(this) {}
184 185
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 return nullptr; 472 return nullptr;
472 } 473 }
473 } 474 }
474 475
475 sync_driver::SyncApiComponentFactory* 476 sync_driver::SyncApiComponentFactory*
476 ChromeSyncClient::GetSyncApiComponentFactory() { 477 ChromeSyncClient::GetSyncApiComponentFactory() {
477 return component_factory_.get(); 478 return component_factory_.get();
478 } 479 }
479 480
480 void ChromeSyncClient::SetSyncApiComponentFactoryForTesting( 481 void ChromeSyncClient::SetSyncApiComponentFactoryForTesting(
481 scoped_ptr<sync_driver::SyncApiComponentFactory> component_factory) { 482 std::unique_ptr<sync_driver::SyncApiComponentFactory> component_factory) {
482 component_factory_ = std::move(component_factory); 483 component_factory_ = std::move(component_factory);
483 } 484 }
484 485
485 // static 486 // static
486 void ChromeSyncClient::GetDeviceInfoTrackers( 487 void ChromeSyncClient::GetDeviceInfoTrackers(
487 std::vector<const sync_driver::DeviceInfoTracker*>* trackers) { 488 std::vector<const sync_driver::DeviceInfoTracker*>* trackers) {
488 DCHECK(trackers); 489 DCHECK(trackers);
489 ProfileManager* profile_manager = g_browser_process->profile_manager(); 490 ProfileManager* profile_manager = g_browser_process->profile_manager();
490 std::vector<Profile*> profile_list = profile_manager->GetLoadedProfiles(); 491 std::vector<Profile*> profile_list = profile_manager->GetLoadedProfiles();
491 for (Profile* profile : profile_list) { 492 for (Profile* profile : profile_list) {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 sync_service->RegisterDataTypeController( 622 sync_service->RegisterDataTypeController(
622 new SupervisedUserSyncDataTypeController(syncer::SUPERVISED_USER_SETTINGS, 623 new SupervisedUserSyncDataTypeController(syncer::SUPERVISED_USER_SETTINGS,
623 error_callback, this, profile_)); 624 error_callback, this, profile_));
624 sync_service->RegisterDataTypeController( 625 sync_service->RegisterDataTypeController(
625 new SupervisedUserSyncDataTypeController( 626 new SupervisedUserSyncDataTypeController(
626 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_)); 627 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_));
627 #endif 628 #endif
628 } 629 }
629 630
630 } // namespace browser_sync 631 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/chrome_sync_client.h ('k') | chrome/browser/sync/chrome_sync_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698