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 "chrome/common/features.h" |
16 #include "components/history/core/browser/history_service.h" | 16 #include "components/history/core/browser/history_service.h" |
17 #include "components/sync_sessions/sync_sessions_client.h" | 17 #include "components/sync_sessions/sync_sessions_client.h" |
18 #include "components/sync_sessions/synced_tab_delegate.h" | 18 #include "components/sync_sessions/synced_tab_delegate.h" |
19 #include "content/public/browser/navigation_controller.h" | 19 #include "content/public/browser/navigation_controller.h" |
20 #include "content/public/browser/navigation_entry.h" | 20 #include "content/public/browser/navigation_entry.h" |
21 #include "content/public/browser/notification_details.h" | 21 #include "content/public/browser/notification_details.h" |
22 #include "content/public/browser/notification_service.h" | 22 #include "content/public/browser/notification_service.h" |
23 #include "content/public/browser/notification_source.h" | 23 #include "content/public/browser/notification_source.h" |
24 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
25 #include "extensions/features/features.h" | 25 #include "extensions/features/features.h" |
26 | 26 |
27 #if BUILDFLAG(ANDROID_JAVA_UI) | 27 #if defined(OS_ANDROID) |
28 #include "chrome/browser/android/tab_android.h" | 28 #include "chrome/browser/android/tab_android.h" |
29 #endif | 29 #endif |
30 | 30 |
31 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | 31 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
32 #include "chrome/browser/supervised_user/supervised_user_service.h" | 32 #include "chrome/browser/supervised_user/supervised_user_service.h" |
33 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 33 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
34 #endif | 34 #endif |
35 | 35 |
36 #if BUILDFLAG(ENABLE_EXTENSIONS) | 36 #if BUILDFLAG(ENABLE_EXTENSIONS) |
37 #include "chrome/browser/extensions/tab_helper.h" | 37 #include "chrome/browser/extensions/tab_helper.h" |
38 #endif | 38 #endif |
39 | 39 |
40 using content::NavigationController; | 40 using content::NavigationController; |
41 using content::WebContents; | 41 using content::WebContents; |
42 | 42 |
43 namespace sync_sessions { | 43 namespace sync_sessions { |
44 | 44 |
45 namespace { | 45 namespace { |
46 | 46 |
47 SyncedTabDelegate* GetSyncedTabDelegateFromWebContents( | 47 SyncedTabDelegate* GetSyncedTabDelegateFromWebContents( |
48 content::WebContents* web_contents) { | 48 content::WebContents* web_contents) { |
49 #if BUILDFLAG(ANDROID_JAVA_UI) | 49 #if defined(OS_ANDROID) |
50 TabAndroid* tab = TabAndroid::FromWebContents(web_contents); | 50 TabAndroid* tab = TabAndroid::FromWebContents(web_contents); |
51 return tab ? tab->GetSyncedTabDelegate() : nullptr; | 51 return tab ? tab->GetSyncedTabDelegate() : nullptr; |
52 #else | 52 #else |
53 SyncedTabDelegate* delegate = | 53 SyncedTabDelegate* delegate = |
54 TabContentsSyncedTabDelegate::FromWebContents(web_contents); | 54 TabContentsSyncedTabDelegate::FromWebContents(web_contents); |
55 return delegate; | 55 return delegate; |
56 #endif | 56 #endif |
57 } | 57 } |
58 | 58 |
59 } // namespace | 59 } // namespace |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 DCHECK(!handler_); | 205 DCHECK(!handler_); |
206 handler_ = handler; | 206 handler_ = handler; |
207 } | 207 } |
208 | 208 |
209 void NotificationServiceSessionsRouter::Stop() { | 209 void NotificationServiceSessionsRouter::Stop() { |
210 weak_ptr_factory_.InvalidateWeakPtrs(); | 210 weak_ptr_factory_.InvalidateWeakPtrs(); |
211 handler_ = nullptr; | 211 handler_ = nullptr; |
212 } | 212 } |
213 | 213 |
214 } // namespace sync_sessions | 214 } // namespace sync_sessions |
OLD | NEW |