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