Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_NTP_SNIPPETS_SESSIONS_TAB_DELEGATE_SYNC_ADAPTER_H_ | |
| 6 #define COMPONENTS_NTP_SNIPPETS_SESSIONS_TAB_DELEGATE_SYNC_ADAPTER_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "components/ntp_snippets/sessions/foreign_sessions_suggestions_provider .h" | |
| 11 #include "components/sync/driver/sync_service_observer.h" | |
| 12 | |
| 13 namespace sync_driver { | |
| 14 class OpenTabsUIDelegate; | |
| 15 class SyncService; | |
| 16 } // namespace sync_driver | |
| 17 | |
| 18 namespace ntp_snippets { | |
| 19 | |
| 20 // Adapter that sits on top of SyncService and provides simplified notifications | |
| 21 // when foreign tab data may have changed. | |
| 22 class TabDelegateSyncAdapter | |
| 23 : public sync_driver::SyncServiceObserver, | |
| 24 public ForeignSessionsSuggestionsProvider::OpenTabsUIDelegateProvider { | |
| 25 public: | |
| 26 explicit TabDelegateSyncAdapter(sync_driver::SyncService* sync_service); | |
| 27 ~TabDelegateSyncAdapter() override; | |
| 28 | |
| 29 // OpenTabsUIDelegateProvider implementation. | |
| 30 sync_driver::OpenTabsUIDelegate* GetOpenTabsUIDelegate() override; | |
| 31 void SubscribeForForeignTabChange( | |
| 32 const OnChangeWithDelegate& change_callback) override; | |
| 33 | |
| 34 // sync_driver::SyncServiceObserver implementation. | |
|
Marc Treib
2016/09/16 12:26:49
These can (and IMO should) be private.
skym
2016/09/16 18:18:50
Can you explain why these should be private? Like
tschumann
2016/09/17 15:52:56
I guess you could argue that we use the adapter to
Marc Treib
2016/09/19 09:24:08
Pretty much what Tim says: To me, it's an implemen
skym
2016/09/19 18:54:47
Done.
skym
2016/09/19 18:54:47
Done.
| |
| 35 void OnStateChanged() override; | |
| 36 void OnSyncConfigurationCompleted() override; | |
| 37 void OnForeignSessionUpdated() override; | |
| 38 | |
| 39 private: | |
| 40 void InvokeCallback(); | |
| 41 | |
| 42 sync_driver::SyncService* sync_service_; | |
| 43 OnChangeWithDelegate change_callback_; | |
| 44 | |
| 45 DISALLOW_COPY_AND_ASSIGN(TabDelegateSyncAdapter); | |
| 46 }; | |
| 47 | |
| 48 } // namespace ntp_snippets | |
| 49 | |
| 50 #endif // COMPONENTS_NTP_SNIPPETS_SESSIONS_TAB_DELEGATE_SYNC_ADAPTER_H_ | |
| OLD | NEW |