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 | 25 |
26 #if BUILDFLAG(ANDROID_JAVA_UI) | 26 #if BUILDFLAG(ANDROID_JAVA_UI) |
27 #include "chrome/browser/android/tab_android.h" | 27 #include "chrome/browser/android/tab_android.h" |
28 #endif | 28 #endif |
29 | 29 |
30 #if defined(ENABLE_SUPERVISED_USERS) | 30 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
31 #include "chrome/browser/supervised_user/supervised_user_service.h" | 31 #include "chrome/browser/supervised_user/supervised_user_service.h" |
32 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 32 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
33 #endif | 33 #endif |
34 | 34 |
35 #if defined(ENABLE_EXTENSIONS) | 35 #if defined(ENABLE_EXTENSIONS) |
36 #include "chrome/browser/extensions/tab_helper.h" | 36 #include "chrome/browser/extensions/tab_helper.h" |
37 #endif | 37 #endif |
38 | 38 |
39 using content::NavigationController; | 39 using content::NavigationController; |
40 using content::WebContents; | 40 using content::WebContents; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 85 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
86 content::NotificationService::AllBrowserContextsAndSources()); | 86 content::NotificationService::AllBrowserContextsAndSources()); |
87 history::HistoryService* history_service = | 87 history::HistoryService* history_service = |
88 HistoryServiceFactory::GetForProfile(profile, | 88 HistoryServiceFactory::GetForProfile(profile, |
89 ServiceAccessType::EXPLICIT_ACCESS); | 89 ServiceAccessType::EXPLICIT_ACCESS); |
90 if (history_service) { | 90 if (history_service) { |
91 favicon_changed_subscription_ = history_service->AddFaviconsChangedCallback( | 91 favicon_changed_subscription_ = history_service->AddFaviconsChangedCallback( |
92 base::Bind(&NotificationServiceSessionsRouter::OnFaviconsChanged, | 92 base::Bind(&NotificationServiceSessionsRouter::OnFaviconsChanged, |
93 base::Unretained(this))); | 93 base::Unretained(this))); |
94 } | 94 } |
95 #if defined(ENABLE_SUPERVISED_USERS) | 95 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
96 if (profile_->IsSupervised()) { | 96 if (profile_->IsSupervised()) { |
97 SupervisedUserService* supervised_user_service = | 97 SupervisedUserService* supervised_user_service = |
98 SupervisedUserServiceFactory::GetForProfile(profile_); | 98 SupervisedUserServiceFactory::GetForProfile(profile_); |
99 supervised_user_service->AddNavigationBlockedCallback( | 99 supervised_user_service->AddNavigationBlockedCallback( |
100 base::Bind(&NotificationServiceSessionsRouter::OnNavigationBlocked, | 100 base::Bind(&NotificationServiceSessionsRouter::OnNavigationBlocked, |
101 weak_ptr_factory_.GetWeakPtr())); | 101 weak_ptr_factory_.GetWeakPtr())); |
102 } | 102 } |
103 #endif | 103 #endif |
104 } | 104 } |
105 | 105 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 DCHECK(!handler_); | 204 DCHECK(!handler_); |
205 handler_ = handler; | 205 handler_ = handler; |
206 } | 206 } |
207 | 207 |
208 void NotificationServiceSessionsRouter::Stop() { | 208 void NotificationServiceSessionsRouter::Stop() { |
209 weak_ptr_factory_.InvalidateWeakPtrs(); | 209 weak_ptr_factory_.InvalidateWeakPtrs(); |
210 handler_ = nullptr; | 210 handler_ = nullptr; |
211 } | 211 } |
212 | 212 |
213 } // namespace sync_sessions | 213 } // namespace sync_sessions |
OLD | NEW |