| 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 the icon URL |
| 67 // that we can filter (exclude) favicon updates for pages that aren't | 67 // |icon_url| (e.g. http://www.google.com/favicon.ico). This is routed through |
| 68 // currently part of the set of local open tabs, and pass relevant updates | 68 // Sessions Sync so that we can filter (exclude) favicon updates for pages |
| 69 // on to FaviconCache for out-of-band favicon syncing. | 69 // that aren't currently part of the set of local open tabs, and pass relevant |
| 70 virtual void OnFaviconPageUrlsUpdated( | 70 // updates on to FaviconCache for out-of-band favicon syncing. |
| 71 const std::set<GURL>& updated_page_urls) = 0; | 71 virtual void OnFaviconsChanged(const std::set<GURL>& page_urls, |
| 72 const GURL& icon_url) = 0; |
| 72 }; | 73 }; |
| 73 | 74 |
| 74 // The LocalSessionEventRouter is responsible for hooking itself up to various | 75 // The LocalSessionEventRouter is responsible for hooking itself up to various |
| 75 // notification sources in the browser process and forwarding relevant | 76 // notification sources in the browser process and forwarding relevant |
| 76 // events to a handler as defined in the LocalSessionEventHandler contract. | 77 // events to a handler as defined in the LocalSessionEventHandler contract. |
| 77 class LocalSessionEventRouter { | 78 class LocalSessionEventRouter { |
| 78 public: | 79 public: |
| 79 virtual ~LocalSessionEventRouter(); | 80 virtual ~LocalSessionEventRouter(); |
| 80 virtual void StartRoutingTo(LocalSessionEventHandler* handler) = 0; | 81 virtual void StartRoutingTo(LocalSessionEventHandler* handler) = 0; |
| 81 virtual void Stop() = 0; | 82 virtual void Stop() = 0; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 std::vector<const sessions::SessionWindow*>* windows) override; | 116 std::vector<const sessions::SessionWindow*>* windows) override; |
| 116 bool GetForeignTab(const std::string& tag, | 117 bool GetForeignTab(const std::string& tag, |
| 117 const SessionID::id_type tab_id, | 118 const SessionID::id_type tab_id, |
| 118 const sessions::SessionTab** tab) override; | 119 const sessions::SessionTab** tab) override; |
| 119 void DeleteForeignSession(const std::string& tag) override; | 120 void DeleteForeignSession(const std::string& tag) override; |
| 120 bool GetLocalSession( | 121 bool GetLocalSession( |
| 121 const sync_driver::SyncedSession** local_session) override; | 122 const sync_driver::SyncedSession** local_session) override; |
| 122 | 123 |
| 123 // LocalSessionEventHandler implementation. | 124 // LocalSessionEventHandler implementation. |
| 124 void OnLocalTabModified(SyncedTabDelegate* modified_tab) override; | 125 void OnLocalTabModified(SyncedTabDelegate* modified_tab) override; |
| 125 void OnFaviconPageUrlsUpdated( | 126 void OnFaviconsChanged(const std::set<GURL>& page_urls, |
| 126 const std::set<GURL>& updated_favicon_page_urls) override; | 127 const GURL& icon_url) override; |
| 127 | 128 |
| 128 // 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 |
| 129 // sync model. | 130 // sync model. |
| 130 const std::string& current_machine_tag() const { | 131 const std::string& current_machine_tag() const { |
| 131 DCHECK(!current_machine_tag_.empty()); | 132 DCHECK(!current_machine_tag_.empty()); |
| 132 return current_machine_tag_; | 133 return current_machine_tag_; |
| 133 } | 134 } |
| 134 | 135 |
| 135 // 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. |
| 136 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... |
| 381 | 382 |
| 382 scoped_ptr<LocalSessionEventRouter> local_event_router_; | 383 scoped_ptr<LocalSessionEventRouter> local_event_router_; |
| 383 scoped_ptr<SyncedWindowDelegatesGetter> synced_window_getter_; | 384 scoped_ptr<SyncedWindowDelegatesGetter> synced_window_getter_; |
| 384 | 385 |
| 385 DISALLOW_COPY_AND_ASSIGN(SessionsSyncManager); | 386 DISALLOW_COPY_AND_ASSIGN(SessionsSyncManager); |
| 386 }; | 387 }; |
| 387 | 388 |
| 388 } // namespace browser_sync | 389 } // namespace browser_sync |
| 389 | 390 |
| 390 #endif // CHROME_BROWSER_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ | 391 #endif // CHROME_BROWSER_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ |
| OLD | NEW |