| OLD | NEW |
| 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 "ios/chrome/browser/sync/ios_chrome_sync_client.h" | 5 #include "ios/chrome/browser/sync/ios_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" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 namespace { | 72 namespace { |
| 73 | 73 |
| 74 // iOS implementation of SyncSessionsClient. Needs to be in a separate class | 74 // iOS implementation of SyncSessionsClient. Needs to be in a separate class |
| 75 // due to possible multiple inheritance issues, wherein IOSChromeSyncClient | 75 // due to possible multiple inheritance issues, wherein IOSChromeSyncClient |
| 76 // might inherit from other interfaces with same methods. | 76 // might inherit from other interfaces with same methods. |
| 77 class SyncSessionsClientImpl : public sync_sessions::SyncSessionsClient { | 77 class SyncSessionsClientImpl : public sync_sessions::SyncSessionsClient { |
| 78 public: | 78 public: |
| 79 explicit SyncSessionsClientImpl(ios::ChromeBrowserState* browser_state) | 79 explicit SyncSessionsClientImpl(ios::ChromeBrowserState* browser_state) |
| 80 : browser_state_(browser_state), | 80 : browser_state_(browser_state), |
| 81 window_delegates_getter_( | 81 window_delegates_getter_( |
| 82 base::MakeUnique<TabModelSyncedWindowDelegatesGetter>( | 82 base::MakeUnique<TabModelSyncedWindowDelegatesGetter>()) {} |
| 83 browser_state)) {} | |
| 84 | 83 |
| 85 ~SyncSessionsClientImpl() override {} | 84 ~SyncSessionsClientImpl() override {} |
| 86 | 85 |
| 87 // SyncSessionsClient implementation. | 86 // SyncSessionsClient implementation. |
| 88 bookmarks::BookmarkModel* GetBookmarkModel() override { | 87 bookmarks::BookmarkModel* GetBookmarkModel() override { |
| 89 DCHECK_CURRENTLY_ON(web::WebThread::UI); | 88 DCHECK_CURRENTLY_ON(web::WebThread::UI); |
| 90 return ios::BookmarkModelFactory::GetForBrowserState(browser_state_); | 89 return ios::BookmarkModelFactory::GetForBrowserState(browser_state_); |
| 91 } | 90 } |
| 92 | 91 |
| 93 favicon::FaviconService* GetFaviconService() override { | 92 favicon::FaviconService* GetFaviconService() override { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 const std::unique_ptr<sync_sessions::SyncedWindowDelegatesGetter> | 130 const std::unique_ptr<sync_sessions::SyncedWindowDelegatesGetter> |
| 132 window_delegates_getter_; | 131 window_delegates_getter_; |
| 133 | 132 |
| 134 DISALLOW_COPY_AND_ASSIGN(SyncSessionsClientImpl); | 133 DISALLOW_COPY_AND_ASSIGN(SyncSessionsClientImpl); |
| 135 }; | 134 }; |
| 136 | 135 |
| 137 } // namespace | 136 } // namespace |
| 138 | 137 |
| 139 IOSChromeSyncClient::IOSChromeSyncClient(ios::ChromeBrowserState* browser_state) | 138 IOSChromeSyncClient::IOSChromeSyncClient(ios::ChromeBrowserState* browser_state) |
| 140 : browser_state_(browser_state), | 139 : browser_state_(browser_state), |
| 141 sync_sessions_client_(new SyncSessionsClientImpl(browser_state)), | 140 sync_sessions_client_( |
| 141 base::MakeUnique<SyncSessionsClientImpl>(browser_state)), |
| 142 weak_ptr_factory_(this) {} | 142 weak_ptr_factory_(this) {} |
| 143 | 143 |
| 144 IOSChromeSyncClient::~IOSChromeSyncClient() {} | 144 IOSChromeSyncClient::~IOSChromeSyncClient() {} |
| 145 | 145 |
| 146 void IOSChromeSyncClient::Initialize() { | 146 void IOSChromeSyncClient::Initialize() { |
| 147 DCHECK_CURRENTLY_ON(web::WebThread::UI); | 147 DCHECK_CURRENTLY_ON(web::WebThread::UI); |
| 148 | 148 |
| 149 web_data_service_ = | 149 web_data_service_ = |
| 150 ios::WebDataServiceFactory::GetAutofillWebDataForBrowserState( | 150 ios::WebDataServiceFactory::GetAutofillWebDataForBrowserState( |
| 151 browser_state_, ServiceAccessType::EXPLICIT_ACCESS); | 151 browser_state_, ServiceAccessType::EXPLICIT_ACCESS); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 IOSChromeProfileSyncServiceFactory::GetForBrowserState(browser_state); | 417 IOSChromeProfileSyncServiceFactory::GetForBrowserState(browser_state); |
| 418 if (profile_sync_service != nullptr) { | 418 if (profile_sync_service != nullptr) { |
| 419 const syncer::DeviceInfoTracker* tracker = | 419 const syncer::DeviceInfoTracker* tracker = |
| 420 profile_sync_service->GetDeviceInfoTracker(); | 420 profile_sync_service->GetDeviceInfoTracker(); |
| 421 if (tracker != nullptr) { | 421 if (tracker != nullptr) { |
| 422 trackers->push_back(tracker); | 422 trackers->push_back(tracker); |
| 423 } | 423 } |
| 424 } | 424 } |
| 425 } | 425 } |
| 426 } | 426 } |
| OLD | NEW |