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

Side by Side Diff: ios/chrome/browser/sync/ios_chrome_sync_client.mm

Issue 2753753005: [sync] WebContentsObserver based sessions notifications (Closed)
Patch Set: use base:MakeUnique, alphabetize Created 3 years, 9 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 "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
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 local_session_event_router_(
84 base::MakeUnique<IOSChromeLocalSessionEventRouter>(
85 browser_state_,
86 this,
87 ios::sync_start_util::GetFlareForSyncableService(
88 browser_state_->GetStatePath()))) {}
83 89
84 ~SyncSessionsClientImpl() override {} 90 ~SyncSessionsClientImpl() override {}
85 91
86 // SyncSessionsClient implementation. 92 // SyncSessionsClient implementation.
87 bookmarks::BookmarkModel* GetBookmarkModel() override { 93 bookmarks::BookmarkModel* GetBookmarkModel() override {
88 DCHECK_CURRENTLY_ON(web::WebThread::UI); 94 DCHECK_CURRENTLY_ON(web::WebThread::UI);
89 return ios::BookmarkModelFactory::GetForBrowserState(browser_state_); 95 return ios::BookmarkModelFactory::GetForBrowserState(browser_state_);
90 } 96 }
91 97
92 favicon::FaviconService* GetFaviconService() override { 98 favicon::FaviconService* GetFaviconService() override {
(...skipping 16 matching lines...) Expand all
109 } 115 }
110 return url.is_valid() && !url.SchemeIs(kChromeUIScheme) && 116 return url.is_valid() && !url.SchemeIs(kChromeUIScheme) &&
111 !url.SchemeIsFile(); 117 !url.SchemeIsFile();
112 } 118 }
113 119
114 sync_sessions::SyncedWindowDelegatesGetter* GetSyncedWindowDelegatesGetter() 120 sync_sessions::SyncedWindowDelegatesGetter* GetSyncedWindowDelegatesGetter()
115 override { 121 override {
116 return window_delegates_getter_.get(); 122 return window_delegates_getter_.get();
117 } 123 }
118 124
119 std::unique_ptr<sync_sessions::LocalSessionEventRouter> 125 sync_sessions::LocalSessionEventRouter* GetLocalSessionEventRouter()
120 GetLocalSessionEventRouter() override { 126 override {
121 syncer::SyncableService::StartSyncFlare flare( 127 return local_session_event_router_.get();
122 ios::sync_start_util::GetFlareForSyncableService(
123 browser_state_->GetStatePath()));
124 return base::MakeUnique<IOSChromeLocalSessionEventRouter>(browser_state_,
125 this, flare);
126 } 128 }
127 129
128 private: 130 private:
129 ios::ChromeBrowserState* const browser_state_; 131 ios::ChromeBrowserState* const browser_state_;
130 const std::unique_ptr<sync_sessions::SyncedWindowDelegatesGetter> 132 const std::unique_ptr<sync_sessions::SyncedWindowDelegatesGetter>
131 window_delegates_getter_; 133 window_delegates_getter_;
134 const std::unique_ptr<IOSChromeLocalSessionEventRouter>
135 local_session_event_router_;
132 136
133 DISALLOW_COPY_AND_ASSIGN(SyncSessionsClientImpl); 137 DISALLOW_COPY_AND_ASSIGN(SyncSessionsClientImpl);
134 }; 138 };
135 139
136 } // namespace 140 } // namespace
137 141
138 IOSChromeSyncClient::IOSChromeSyncClient(ios::ChromeBrowserState* browser_state) 142 IOSChromeSyncClient::IOSChromeSyncClient(ios::ChromeBrowserState* browser_state)
139 : browser_state_(browser_state), 143 : browser_state_(browser_state),
140 sync_sessions_client_( 144 sync_sessions_client_(
141 base::MakeUnique<SyncSessionsClientImpl>(browser_state)), 145 base::MakeUnique<SyncSessionsClientImpl>(browser_state)),
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 IOSChromeProfileSyncServiceFactory::GetForBrowserState(browser_state); 427 IOSChromeProfileSyncServiceFactory::GetForBrowserState(browser_state);
424 if (profile_sync_service != nullptr) { 428 if (profile_sync_service != nullptr) {
425 const syncer::DeviceInfoTracker* tracker = 429 const syncer::DeviceInfoTracker* tracker =
426 profile_sync_service->GetDeviceInfoTracker(); 430 profile_sync_service->GetDeviceInfoTracker();
427 if (tracker != nullptr) { 431 if (tracker != nullptr) {
428 trackers->push_back(tracker); 432 trackers->push_back(tracker);
429 } 433 }
430 } 434 }
431 } 435 }
432 } 436 }
OLDNEW
« no previous file with comments | « components/sync_sessions/tab_node_pool.cc ('k') | ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698