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_NOTIFICATION_SERVICE_SESSIONS_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_SESSIONS_NOTIFICATION_SERVICE_SESSIONS_ROUTER_H_ |
6 #define CHROME_BROWSER_SYNC_SESSIONS_NOTIFICATION_SERVICE_SESSIONS_ROUTER_H_ | 6 #define CHROME_BROWSER_SYNC_SESSIONS_NOTIFICATION_SERVICE_SESSIONS_ROUTER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/callback_list.h" | 10 #include "base/callback_list.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "chrome/browser/sync/sessions/sessions_sync_manager.h" | 12 #include "chrome/browser/sync/sessions/sessions_sync_manager.h" |
13 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
14 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
15 | 15 |
16 class GURL; | 16 class GURL; |
17 class Profile; | 17 class Profile; |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 class WebContents; | 20 class WebContents; |
21 } | 21 } |
22 | 22 |
| 23 namespace sync_sessions { |
| 24 class SyncSessionsClient; |
| 25 } |
| 26 |
23 namespace browser_sync { | 27 namespace browser_sync { |
24 | 28 |
25 // A SessionsSyncManager::LocalEventRouter that drives session sync via | 29 // A SessionsSyncManager::LocalEventRouter that drives session sync via |
26 // the NotificationService. | 30 // the NotificationService. |
27 class NotificationServiceSessionsRouter | 31 class NotificationServiceSessionsRouter |
28 : public LocalSessionEventRouter, | 32 : public LocalSessionEventRouter, |
29 public content::NotificationObserver { | 33 public content::NotificationObserver { |
30 public: | 34 public: |
31 NotificationServiceSessionsRouter( | 35 NotificationServiceSessionsRouter( |
32 Profile* profile, | 36 Profile* profile, |
| 37 sync_sessions::SyncSessionsClient* sessions_client_, |
33 const syncer::SyncableService::StartSyncFlare& flare); | 38 const syncer::SyncableService::StartSyncFlare& flare); |
34 ~NotificationServiceSessionsRouter() override; | 39 ~NotificationServiceSessionsRouter() override; |
35 | 40 |
36 // content::NotificationObserver implementation. | 41 // content::NotificationObserver implementation. |
37 // BrowserSessionProvider -> sync API model change application. | 42 // BrowserSessionProvider -> sync API model change application. |
38 void Observe(int type, | 43 void Observe(int type, |
39 const content::NotificationSource& source, | 44 const content::NotificationSource& source, |
40 const content::NotificationDetails& details) override; | 45 const content::NotificationDetails& details) override; |
41 | 46 |
42 // SessionsSyncManager::LocalEventRouter implementation. | 47 // SessionsSyncManager::LocalEventRouter implementation. |
(...skipping 12 matching lines...) Expand all Loading... |
55 // (e.g. http://www.google.com) and the given icon URL (e.g. | 60 // (e.g. http://www.google.com) and the given icon URL (e.g. |
56 // http://www.google.com/favicon.ico) have changed. It is valid to call | 61 // http://www.google.com/favicon.ico) have changed. It is valid to call |
57 // OnFaviconsChanged() with non-empty |page_urls| and an empty |icon_url| | 62 // OnFaviconsChanged() with non-empty |page_urls| and an empty |icon_url| |
58 // and vice versa. | 63 // and vice versa. |
59 void OnFaviconsChanged(const std::set<GURL>& page_urls, | 64 void OnFaviconsChanged(const std::set<GURL>& page_urls, |
60 const GURL& icon_url); | 65 const GURL& icon_url); |
61 | 66 |
62 LocalSessionEventHandler* handler_; | 67 LocalSessionEventHandler* handler_; |
63 content::NotificationRegistrar registrar_; | 68 content::NotificationRegistrar registrar_; |
64 Profile* const profile_; | 69 Profile* const profile_; |
| 70 sync_sessions::SyncSessionsClient* const sessions_client_; |
65 syncer::SyncableService::StartSyncFlare flare_; | 71 syncer::SyncableService::StartSyncFlare flare_; |
66 | 72 |
67 scoped_ptr<base::CallbackList<void(const std::set<GURL>&, | 73 scoped_ptr<base::CallbackList<void(const std::set<GURL>&, |
68 const GURL&)>::Subscription> | 74 const GURL&)>::Subscription> |
69 favicon_changed_subscription_; | 75 favicon_changed_subscription_; |
70 | 76 |
71 base::WeakPtrFactory<NotificationServiceSessionsRouter> weak_ptr_factory_; | 77 base::WeakPtrFactory<NotificationServiceSessionsRouter> weak_ptr_factory_; |
72 | 78 |
73 DISALLOW_COPY_AND_ASSIGN(NotificationServiceSessionsRouter); | 79 DISALLOW_COPY_AND_ASSIGN(NotificationServiceSessionsRouter); |
74 }; | 80 }; |
75 | 81 |
76 } // namespace browser_sync | 82 } // namespace browser_sync |
77 | 83 |
78 #endif // CHROME_BROWSER_SYNC_SESSIONS_NOTIFICATION_SERVICE_SESSIONS_ROUTER_H_ | 84 #endif // CHROME_BROWSER_SYNC_SESSIONS_NOTIFICATION_SERVICE_SESSIONS_ROUTER_H_ |
OLD | NEW |