OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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 CHROME_BROWSER_SYNC_SESSIONS_SYNC_SESSIONS_WEB_CONTENTS_ROUTER_H_ | |
6 #define CHROME_BROWSER_SYNC_SESSIONS_SYNC_SESSIONS_WEB_CONTENTS_ROUTER_H_ | |
7 | |
8 #include "base/callback_list.h" | |
9 | |
10 // Android has no BrowserList or TabStripModel, so we exclude code that refers | |
11 // to those two things. For non-android platforms, this code is used to | |
12 // ensure we are notified of tabs being added and moved between tab strips. | |
13 | |
14 #include "components/keyed_service/core/keyed_service.h" | |
15 #include "components/sync/model/syncable_service.h" | |
16 #include "components/sync_sessions/local_session_event_router.h" | |
17 | |
18 namespace content { | |
19 class WebContents; | |
20 } // namespace content | |
21 | |
22 class Profile; | |
23 | |
24 namespace sync_sessions { | |
25 | |
26 // WebContentsObserver-based implementation of LocalSessionEventRouter. This | |
27 // class is responsible for notifying Sessions Sync when local tabs are | |
28 // modified. It does this by forwarding the events pushed to it by individual | |
29 // WebContentsObservers, which are scoped to a single WebContents/tab. | |
30 class SyncSessionsWebContentsRouter : public LocalSessionEventRouter, | |
31 public KeyedService { | |
32 public: | |
33 explicit SyncSessionsWebContentsRouter(Profile* profile); | |
34 | |
35 // Notify the router that the tab corresponding to |web_contents| has been | |
36 // modified in some way. | |
37 void NotifyTabModified(content::WebContents* web_contents); | |
38 // Inject a flare that can be used to start sync. See the comment for | |
39 // StartSyncFlare in syncable_service.h for more. | |
40 void InjectStartSyncFlare(syncer::SyncableService::StartSyncFlare flare); | |
41 | |
42 // SessionsSyncManager::LocalEventRouter implementation. | |
43 void StartRoutingTo(LocalSessionEventHandler* handler) override; | |
44 void Stop() override; | |
45 | |
46 // KeyedService implementation. | |
47 void Shutdown() override; | |
48 | |
49 protected: | |
50 ~SyncSessionsWebContentsRouter() override; | |
51 LocalSessionEventHandler* handler_ = nullptr; | |
Nicolas Zea
2017/03/20 18:14:50
style: data members should be private https://goog
Patrick Noland
2017/03/21 22:54:31
Done. I changed the MultiWindowed router to Browse
| |
52 | |
53 private: | |
54 void OnFaviconsChanged(const std::set<GURL>& page_urls, const GURL& icon_url); | |
55 | |
56 std::unique_ptr<base::CallbackList<void(const std::set<GURL>&, | |
57 const GURL&)>::Subscription> | |
58 favicon_changed_subscription_; | |
59 syncer::SyncableService::StartSyncFlare flare_; | |
60 | |
61 DISALLOW_COPY_AND_ASSIGN(SyncSessionsWebContentsRouter); | |
62 }; | |
63 | |
64 } // namespace sync_sessions | |
65 | |
66 #endif // CHROME_BROWSER_SYNC_SESSIONS_SYNC_SESSIONS_WEB_CONTENTS_ROUTER_H_ | |
OLD | NEW |