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 #include "chrome/browser/sync/sessions/notification_service_sessions_router.h" | 5 #include "chrome/browser/sync/sessions/notification_service_sessions_router.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/history/history_service_factory.h" | 9 #include "chrome/browser/history/history_service_factory.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/sync/glue/sync_start_util.h" | 11 #include "chrome/browser/sync/glue/sync_start_util.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/sync/browser_synced_window_delegates_getter.h" | 13 #include "chrome/browser/ui/sync/browser_synced_window_delegates_getter.h" |
14 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" | 14 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" |
| 15 #include "chrome/common/features.h" |
15 #include "components/history/core/browser/history_service.h" | 16 #include "components/history/core/browser/history_service.h" |
16 #include "components/sync_sessions/sync_sessions_client.h" | 17 #include "components/sync_sessions/sync_sessions_client.h" |
17 #include "components/sync_sessions/synced_tab_delegate.h" | 18 #include "components/sync_sessions/synced_tab_delegate.h" |
18 #include "content/public/browser/navigation_controller.h" | 19 #include "content/public/browser/navigation_controller.h" |
19 #include "content/public/browser/navigation_entry.h" | 20 #include "content/public/browser/navigation_entry.h" |
20 #include "content/public/browser/notification_details.h" | 21 #include "content/public/browser/notification_details.h" |
21 #include "content/public/browser/notification_service.h" | 22 #include "content/public/browser/notification_service.h" |
22 #include "content/public/browser/notification_source.h" | 23 #include "content/public/browser/notification_source.h" |
23 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
24 | 25 |
25 #if defined(OS_ANDROID) | 26 #if BUILDFLAG(ANDROID_JAVA_UI) |
26 #include "chrome/browser/android/tab_android.h" | 27 #include "chrome/browser/android/tab_android.h" |
27 #endif | 28 #endif |
28 | 29 |
29 #if defined(ENABLE_SUPERVISED_USERS) | 30 #if defined(ENABLE_SUPERVISED_USERS) |
30 #include "chrome/browser/supervised_user/supervised_user_service.h" | 31 #include "chrome/browser/supervised_user/supervised_user_service.h" |
31 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 32 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
32 #endif | 33 #endif |
33 | 34 |
34 #if defined(ENABLE_EXTENSIONS) | 35 #if defined(ENABLE_EXTENSIONS) |
35 #include "chrome/browser/extensions/tab_helper.h" | 36 #include "chrome/browser/extensions/tab_helper.h" |
36 #endif | 37 #endif |
37 | 38 |
38 using content::NavigationController; | 39 using content::NavigationController; |
39 using content::WebContents; | 40 using content::WebContents; |
40 | 41 |
41 namespace browser_sync { | 42 namespace browser_sync { |
42 | 43 |
43 namespace { | 44 namespace { |
44 | 45 |
45 SyncedTabDelegate* GetSyncedTabDelegateFromWebContents( | 46 SyncedTabDelegate* GetSyncedTabDelegateFromWebContents( |
46 content::WebContents* web_contents) { | 47 content::WebContents* web_contents) { |
47 #if defined(OS_ANDROID) | 48 #if BUILDFLAG(ANDROID_JAVA_UI) |
48 TabAndroid* tab = TabAndroid::FromWebContents(web_contents); | 49 TabAndroid* tab = TabAndroid::FromWebContents(web_contents); |
49 return tab ? tab->GetSyncedTabDelegate() : nullptr; | 50 return tab ? tab->GetSyncedTabDelegate() : nullptr; |
50 #else // !OS_ANDROID | 51 #else |
51 SyncedTabDelegate* delegate = | 52 SyncedTabDelegate* delegate = |
52 TabContentsSyncedTabDelegate::FromWebContents(web_contents); | 53 TabContentsSyncedTabDelegate::FromWebContents(web_contents); |
53 return delegate; | 54 return delegate; |
54 #endif // OS_ANDROID | 55 #endif |
55 } | 56 } |
56 | 57 |
57 } // namespace | 58 } // namespace |
58 | 59 |
59 NotificationServiceSessionsRouter::NotificationServiceSessionsRouter( | 60 NotificationServiceSessionsRouter::NotificationServiceSessionsRouter( |
60 Profile* profile, | 61 Profile* profile, |
61 sync_sessions::SyncSessionsClient* sessions_client, | 62 sync_sessions::SyncSessionsClient* sessions_client, |
62 const syncer::SyncableService::StartSyncFlare& flare) | 63 const syncer::SyncableService::StartSyncFlare& flare) |
63 : handler_(NULL), | 64 : handler_(NULL), |
64 profile_(profile), | 65 profile_(profile), |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 DCHECK(!handler_); | 204 DCHECK(!handler_); |
204 handler_ = handler; | 205 handler_ = handler; |
205 } | 206 } |
206 | 207 |
207 void NotificationServiceSessionsRouter::Stop() { | 208 void NotificationServiceSessionsRouter::Stop() { |
208 weak_ptr_factory_.InvalidateWeakPtrs(); | 209 weak_ptr_factory_.InvalidateWeakPtrs(); |
209 handler_ = NULL; | 210 handler_ = NULL; |
210 } | 211 } |
211 | 212 |
212 } // namespace browser_sync | 213 } // namespace browser_sync |
OLD | NEW |