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

Side by Side Diff: components/ntp_snippets/sessions/tab_delegate_sync_adapter.h

Issue 2279123002: [Sync] Initial implementation of foreign sessions suggestions provider. (Closed)
Patch Set: Updating for comments, again! Created 4 years, 3 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
(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 <vector>
9
10 #include "base/callback.h"
11 #include "base/callback_forward.h"
12 #include "base/macros.h"
13 #include "components/ntp_snippets/sessions/foreign_sessions_suggestions_provider .h"
14 #include "components/sync/driver/sync_service_observer.h"
15
16 namespace sync_driver {
17 class SyncService;
18 } // namespace sync_driver
19
20 namespace ntp_snippets {
21
22 // Adapter that sits on top of SyncService and OpenTabsUIDelegate and provides
23 // simplified notifications and accessors for foreign tabs data.
24 class TabDelegateSyncAdapter : public sync_driver::SyncServiceObserver,
25 public ForeignSessionsProvider {
26 public:
27 explicit TabDelegateSyncAdapter(sync_driver::SyncService* sync_service);
28 ~TabDelegateSyncAdapter() override;
29
30 // ForeignSessionsProvider implementation.
31 bool HasSessionsData() override;
32 std::vector<const sync_sessions::SyncedSession*> GetAllForeignSessions()
33 override;
34 void SubscribeForForeignTabChange(
35 const base::Closure& change_callback) override;
36
37 private:
38 // sync_driver::SyncServiceObserver implementation.
39 void OnStateChanged() override;
40 void OnSyncConfigurationCompleted() override;
41 void OnForeignSessionUpdated() override;
42
43 void InvokeCallback();
44
45 sync_driver::SyncService* sync_service_;
46 base::Closure change_callback_;
47
48 DISALLOW_COPY_AND_ASSIGN(TabDelegateSyncAdapter);
49 };
50
51 } // namespace ntp_snippets
52
53 #endif // COMPONENTS_NTP_SNIPPETS_SESSIONS_TAB_DELEGATE_SYNC_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698