OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ |
6 #define CHROME_BROWSER_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ | 6 #define CHROME_BROWSER_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // with session sync. All local tab events flow to sync via this interface. | 56 // with session sync. All local tab events flow to sync via this interface. |
57 // In that way it is analogous to sync changes flowing to the local model | 57 // In that way it is analogous to sync changes flowing to the local model |
58 // via ProcessSyncChanges, just with a more granular breakdown. | 58 // via ProcessSyncChanges, just with a more granular breakdown. |
59 class LocalSessionEventHandler { | 59 class LocalSessionEventHandler { |
60 public: | 60 public: |
61 // A local navigation event took place that affects the synced session | 61 // A local navigation event took place that affects the synced session |
62 // for this instance of Chrome. | 62 // for this instance of Chrome. |
63 virtual void OnLocalTabModified(SyncedTabDelegate* modified_tab) = 0; | 63 virtual void OnLocalTabModified(SyncedTabDelegate* modified_tab) = 0; |
64 | 64 |
65 // A local navigation occurred that triggered updates to favicon data for | 65 // A local navigation occurred that triggered updates to favicon data for |
66 // each URL in |updated_page_urls|. This is routed through Sessions Sync so | 66 // each page URL in |page_urls| (e.g. http://www.google.com) and each icon |
67 // that we can filter (exclude) favicon updates for pages that aren't | 67 // URL in |icon_urls| (e.g. http://www.google.com/favicon.ico). This is |
68 // currently part of the set of local open tabs, and pass relevant updates | 68 // routed through Sessions Sync so that we can filter (exclude) favicon |
69 // on to FaviconCache for out-of-band favicon syncing. | 69 // updates for pages that aren't currently part of the set of local open |
70 virtual void OnFaviconPageUrlsUpdated( | 70 // tabs, and pass relevant updates on to FaviconCache for out-of-band favicon |
71 const std::set<GURL>& updated_page_urls) = 0; | 71 // syncing. |
| 72 virtual void OnFaviconsChanged(const std::vector<GURL>& page_urls, |
| 73 const std::vector<GURL>& icon_urls) = 0; |
72 }; | 74 }; |
73 | 75 |
74 // The LocalSessionEventRouter is responsible for hooking itself up to various | 76 // The LocalSessionEventRouter is responsible for hooking itself up to various |
75 // notification sources in the browser process and forwarding relevant | 77 // notification sources in the browser process and forwarding relevant |
76 // events to a handler as defined in the LocalSessionEventHandler contract. | 78 // events to a handler as defined in the LocalSessionEventHandler contract. |
77 class LocalSessionEventRouter { | 79 class LocalSessionEventRouter { |
78 public: | 80 public: |
79 virtual ~LocalSessionEventRouter(); | 81 virtual ~LocalSessionEventRouter(); |
80 virtual void StartRoutingTo(LocalSessionEventHandler* handler) = 0; | 82 virtual void StartRoutingTo(LocalSessionEventHandler* handler) = 0; |
81 virtual void Stop() = 0; | 83 virtual void Stop() = 0; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 const std::string& tag, | 116 const std::string& tag, |
115 std::vector<const sessions::SessionWindow*>* windows) override; | 117 std::vector<const sessions::SessionWindow*>* windows) override; |
116 bool GetForeignTab(const std::string& tag, | 118 bool GetForeignTab(const std::string& tag, |
117 const SessionID::id_type tab_id, | 119 const SessionID::id_type tab_id, |
118 const sessions::SessionTab** tab) override; | 120 const sessions::SessionTab** tab) override; |
119 void DeleteForeignSession(const std::string& tag) override; | 121 void DeleteForeignSession(const std::string& tag) override; |
120 bool GetLocalSession(const SyncedSession** local_session) override; | 122 bool GetLocalSession(const SyncedSession** local_session) override; |
121 | 123 |
122 // LocalSessionEventHandler implementation. | 124 // LocalSessionEventHandler implementation. |
123 void OnLocalTabModified(SyncedTabDelegate* modified_tab) override; | 125 void OnLocalTabModified(SyncedTabDelegate* modified_tab) override; |
124 void OnFaviconPageUrlsUpdated( | 126 void OnFaviconsChanged(const std::vector<GURL>& page_urls, |
125 const std::set<GURL>& updated_favicon_page_urls) override; | 127 const std::vector<GURL>& icon_urls) override; |
126 | 128 |
127 // Returns the tag used to uniquely identify this machine's session in the | 129 // Returns the tag used to uniquely identify this machine's session in the |
128 // sync model. | 130 // sync model. |
129 const std::string& current_machine_tag() const { | 131 const std::string& current_machine_tag() const { |
130 DCHECK(!current_machine_tag_.empty()); | 132 DCHECK(!current_machine_tag_.empty()); |
131 return current_machine_tag_; | 133 return current_machine_tag_; |
132 } | 134 } |
133 | 135 |
134 // Return the virtual URL of the current tab, even if it's pending. | 136 // Return the virtual URL of the current tab, even if it's pending. |
135 static GURL GetCurrentVirtualURL(const SyncedTabDelegate& tab_delegate); | 137 static GURL GetCurrentVirtualURL(const SyncedTabDelegate& tab_delegate); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 | 382 |
381 scoped_ptr<LocalSessionEventRouter> local_event_router_; | 383 scoped_ptr<LocalSessionEventRouter> local_event_router_; |
382 scoped_ptr<SyncedWindowDelegatesGetter> synced_window_getter_; | 384 scoped_ptr<SyncedWindowDelegatesGetter> synced_window_getter_; |
383 | 385 |
384 DISALLOW_COPY_AND_ASSIGN(SessionsSyncManager); | 386 DISALLOW_COPY_AND_ASSIGN(SessionsSyncManager); |
385 }; | 387 }; |
386 | 388 |
387 } // namespace browser_sync | 389 } // namespace browser_sync |
388 | 390 |
389 #endif // CHROME_BROWSER_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ | 391 #endif // CHROME_BROWSER_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ |
OLD | NEW |