OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef COMPONENTS_NTP_SNIPPETS_SESSIONS_TAB_DELEGATE_SYNC_ADAPTER_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_SESSIONS_TAB_DELEGATE_SYNC_ADAPTER_H_ |
6 #define COMPONENTS_NTP_SNIPPETS_SESSIONS_TAB_DELEGATE_SYNC_ADAPTER_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_SESSIONS_TAB_DELEGATE_SYNC_ADAPTER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "components/ntp_snippets/sessions/foreign_sessions_suggestions_provider
.h" | 13 #include "components/ntp_snippets/sessions/foreign_sessions_suggestions_provider
.h" |
14 #include "components/sync/driver/sync_service_observer.h" | 14 #include "components/sync/driver/sync_service_observer.h" |
15 | 15 |
16 namespace sync_driver { | 16 namespace syncer { |
17 class SyncService; | 17 class SyncService; |
18 } // namespace sync_driver | 18 } // namespace syncer |
19 | 19 |
20 namespace ntp_snippets { | 20 namespace ntp_snippets { |
21 | 21 |
22 // Adapter that sits on top of SyncService and OpenTabsUIDelegate and provides | 22 // Adapter that sits on top of SyncService and OpenTabsUIDelegate and provides |
23 // simplified notifications and accessors for foreign tabs data. | 23 // simplified notifications and accessors for foreign tabs data. |
24 class TabDelegateSyncAdapter : public sync_driver::SyncServiceObserver, | 24 class TabDelegateSyncAdapter : public syncer::SyncServiceObserver, |
25 public ForeignSessionsProvider { | 25 public ForeignSessionsProvider { |
26 public: | 26 public: |
27 explicit TabDelegateSyncAdapter(sync_driver::SyncService* sync_service); | 27 explicit TabDelegateSyncAdapter(syncer::SyncService* sync_service); |
28 ~TabDelegateSyncAdapter() override; | 28 ~TabDelegateSyncAdapter() override; |
29 | 29 |
30 // ForeignSessionsProvider implementation. | 30 // ForeignSessionsProvider implementation. |
31 bool HasSessionsData() override; | 31 bool HasSessionsData() override; |
32 std::vector<const sync_sessions::SyncedSession*> GetAllForeignSessions() | 32 std::vector<const sync_sessions::SyncedSession*> GetAllForeignSessions() |
33 override; | 33 override; |
34 void SubscribeForForeignTabChange( | 34 void SubscribeForForeignTabChange( |
35 const base::Closure& change_callback) override; | 35 const base::Closure& change_callback) override; |
36 | 36 |
37 private: | 37 private: |
38 // sync_driver::SyncServiceObserver implementation. | 38 // syncer::SyncServiceObserver implementation. |
39 void OnStateChanged() override; | 39 void OnStateChanged() override; |
40 void OnSyncConfigurationCompleted() override; | 40 void OnSyncConfigurationCompleted() override; |
41 void OnForeignSessionUpdated() override; | 41 void OnForeignSessionUpdated() override; |
42 | 42 |
43 void InvokeCallback(); | 43 void InvokeCallback(); |
44 | 44 |
45 sync_driver::SyncService* sync_service_; | 45 syncer::SyncService* sync_service_; |
46 base::Closure change_callback_; | 46 base::Closure change_callback_; |
47 | 47 |
48 DISALLOW_COPY_AND_ASSIGN(TabDelegateSyncAdapter); | 48 DISALLOW_COPY_AND_ASSIGN(TabDelegateSyncAdapter); |
49 }; | 49 }; |
50 | 50 |
51 } // namespace ntp_snippets | 51 } // namespace ntp_snippets |
52 | 52 |
53 #endif // COMPONENTS_NTP_SNIPPETS_SESSIONS_TAB_DELEGATE_SYNC_ADAPTER_H_ | 53 #endif // COMPONENTS_NTP_SNIPPETS_SESSIONS_TAB_DELEGATE_SYNC_ADAPTER_H_ |
OLD | NEW |