| 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/extensions/tab_helper.h" | 9 #include "chrome/browser/extensions/tab_helper.h" |
| 10 #include "chrome/browser/favicon/favicon_changed_details.h" | 10 #include "chrome/browser/favicon/favicon_changed_details.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/sync/glue/sync_start_util.h" | 12 #include "chrome/browser/sync/glue/sync_start_util.h" |
| 13 #include "chrome/browser/sync/glue/synced_tab_delegate.h" | 13 #include "chrome/browser/sync/glue/synced_tab_delegate.h" |
| 14 #include "chrome/browser/sync/sessions/sessions_util.h" | 14 #include "chrome/browser/sync/sessions/sessions_util.h" |
| 15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 16 #include "content/public/browser/navigation_controller.h" | 16 #include "content/public/browser/navigation_controller.h" |
| 17 #include "content/public/browser/navigation_entry.h" | 17 #include "content/public/browser/navigation_entry.h" |
| 18 #include "content/public/browser/notification_details.h" | 18 #include "content/public/browser/notification_details.h" |
| 19 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
| 20 #include "content/public/browser/notification_source.h" | 20 #include "content/public/browser/notification_source.h" |
| 21 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
| 22 | 22 |
| 23 #if defined(ENABLE_MANAGED_USERS) | 23 #if defined(ENABLE_MANAGED_USERS) |
| 24 #include "chrome/browser/managed_mode/managed_user_service.h" | 24 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 25 #include "chrome/browser/managed_mode/managed_user_service_factory.h" | 25 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 using content::NavigationController; | 28 using content::NavigationController; |
| 29 using content::WebContents; | 29 using content::WebContents; |
| 30 | 30 |
| 31 namespace browser_sync { | 31 namespace browser_sync { |
| 32 | 32 |
| 33 NotificationServiceSessionsRouter::NotificationServiceSessionsRouter( | 33 NotificationServiceSessionsRouter::NotificationServiceSessionsRouter( |
| 34 Profile* profile, const syncer::SyncableService::StartSyncFlare& flare) | 34 Profile* profile, const syncer::SyncableService::StartSyncFlare& flare) |
| 35 : handler_(NULL), | 35 : handler_(NULL), |
| (...skipping 14 matching lines...) Expand all Loading... |
| 50 registrar_.Add(this, | 50 registrar_.Add(this, |
| 51 chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, | 51 chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, |
| 52 content::NotificationService::AllSources()); | 52 content::NotificationService::AllSources()); |
| 53 registrar_.Add(this, | 53 registrar_.Add(this, |
| 54 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 54 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
| 55 content::NotificationService::AllBrowserContextsAndSources()); | 55 content::NotificationService::AllBrowserContextsAndSources()); |
| 56 registrar_.Add(this, chrome::NOTIFICATION_FAVICON_CHANGED, | 56 registrar_.Add(this, chrome::NOTIFICATION_FAVICON_CHANGED, |
| 57 content::Source<Profile>(profile_)); | 57 content::Source<Profile>(profile_)); |
| 58 #if defined(ENABLE_MANAGED_USERS) | 58 #if defined(ENABLE_MANAGED_USERS) |
| 59 if (profile_->IsSupervised()) { | 59 if (profile_->IsSupervised()) { |
| 60 ManagedUserService* managed_user_service = | 60 SupervisedUserService* supervised_user_service = |
| 61 ManagedUserServiceFactory::GetForProfile(profile_); | 61 SupervisedUserServiceFactory::GetForProfile(profile_); |
| 62 managed_user_service->AddNavigationBlockedCallback( | 62 supervised_user_service->AddNavigationBlockedCallback( |
| 63 base::Bind(&NotificationServiceSessionsRouter::OnNavigationBlocked, | 63 base::Bind(&NotificationServiceSessionsRouter::OnNavigationBlocked, |
| 64 weak_ptr_factory_.GetWeakPtr())); | 64 weak_ptr_factory_.GetWeakPtr())); |
| 65 } | 65 } |
| 66 #endif | 66 #endif |
| 67 } | 67 } |
| 68 | 68 |
| 69 NotificationServiceSessionsRouter::~NotificationServiceSessionsRouter() {} | 69 NotificationServiceSessionsRouter::~NotificationServiceSessionsRouter() {} |
| 70 | 70 |
| 71 void NotificationServiceSessionsRouter::Observe( | 71 void NotificationServiceSessionsRouter::Observe( |
| 72 int type, | 72 int type, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 DCHECK(!handler_); | 154 DCHECK(!handler_); |
| 155 handler_ = handler; | 155 handler_ = handler; |
| 156 } | 156 } |
| 157 | 157 |
| 158 void NotificationServiceSessionsRouter::Stop() { | 158 void NotificationServiceSessionsRouter::Stop() { |
| 159 weak_ptr_factory_.InvalidateWeakPtrs(); | 159 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 160 handler_ = NULL; | 160 handler_ = NULL; |
| 161 } | 161 } |
| 162 | 162 |
| 163 } // namespace browser_sync | 163 } // namespace browser_sync |
| OLD | NEW |