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" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 content::NotificationService::AllSources()); | 55 content::NotificationService::AllSources()); |
56 #endif | 56 #endif |
57 registrar_.Add(this, | 57 registrar_.Add(this, |
58 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 58 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
59 content::NotificationService::AllBrowserContextsAndSources()); | 59 content::NotificationService::AllBrowserContextsAndSources()); |
60 history::HistoryService* history_service = | 60 history::HistoryService* history_service = |
61 HistoryServiceFactory::GetForProfile(profile, | 61 HistoryServiceFactory::GetForProfile(profile, |
62 ServiceAccessType::EXPLICIT_ACCESS); | 62 ServiceAccessType::EXPLICIT_ACCESS); |
63 if (history_service) { | 63 if (history_service) { |
64 favicon_changed_subscription_ = history_service->AddFaviconChangedCallback( | 64 favicon_changed_subscription_ = history_service->AddFaviconChangedCallback( |
65 base::Bind(&NotificationServiceSessionsRouter::OnFaviconChanged, | 65 base::Bind(&NotificationServiceSessionsRouter::OnFaviconsChanged, |
66 base::Unretained(this))); | 66 base::Unretained(this))); |
67 } | 67 } |
68 #if defined(ENABLE_SUPERVISED_USERS) | 68 #if defined(ENABLE_SUPERVISED_USERS) |
69 if (profile_->IsSupervised()) { | 69 if (profile_->IsSupervised()) { |
70 SupervisedUserService* supervised_user_service = | 70 SupervisedUserService* supervised_user_service = |
71 SupervisedUserServiceFactory::GetForProfile(profile_); | 71 SupervisedUserServiceFactory::GetForProfile(profile_); |
72 supervised_user_service->AddNavigationBlockedCallback( | 72 supervised_user_service->AddNavigationBlockedCallback( |
73 base::Bind(&NotificationServiceSessionsRouter::OnNavigationBlocked, | 73 base::Bind(&NotificationServiceSessionsRouter::OnNavigationBlocked, |
74 weak_ptr_factory_.GetWeakPtr())); | 74 weak_ptr_factory_.GetWeakPtr())); |
75 } | 75 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 content::WebContents* web_contents) { | 148 content::WebContents* web_contents) { |
149 SyncedTabDelegate* tab = | 149 SyncedTabDelegate* tab = |
150 SyncedTabDelegate::ImplFromWebContents(web_contents); | 150 SyncedTabDelegate::ImplFromWebContents(web_contents); |
151 if (!tab || !handler_) | 151 if (!tab || !handler_) |
152 return; | 152 return; |
153 | 153 |
154 DCHECK(tab->profile() == profile_); | 154 DCHECK(tab->profile() == profile_); |
155 handler_->OnLocalTabModified(tab); | 155 handler_->OnLocalTabModified(tab); |
156 } | 156 } |
157 | 157 |
158 void NotificationServiceSessionsRouter::OnFaviconChanged( | 158 void NotificationServiceSessionsRouter::OnFaviconsChanged( |
159 const std::set<GURL>& changed_favicons) { | 159 const std::vector<GURL>& page_urls, |
| 160 const std::vector<GURL>& icon_urls) { |
160 if (handler_) | 161 if (handler_) |
161 handler_->OnFaviconPageUrlsUpdated(changed_favicons); | 162 handler_->OnFaviconsChanged(page_urls, icon_urls); |
162 } | 163 } |
163 | 164 |
164 void NotificationServiceSessionsRouter::StartRoutingTo( | 165 void NotificationServiceSessionsRouter::StartRoutingTo( |
165 LocalSessionEventHandler* handler) { | 166 LocalSessionEventHandler* handler) { |
166 DCHECK(!handler_); | 167 DCHECK(!handler_); |
167 handler_ = handler; | 168 handler_ = handler; |
168 } | 169 } |
169 | 170 |
170 void NotificationServiceSessionsRouter::Stop() { | 171 void NotificationServiceSessionsRouter::Stop() { |
171 weak_ptr_factory_.InvalidateWeakPtrs(); | 172 weak_ptr_factory_.InvalidateWeakPtrs(); |
172 handler_ = NULL; | 173 handler_ = NULL; |
173 } | 174 } |
174 | 175 |
175 } // namespace browser_sync | 176 } // namespace browser_sync |
OLD | NEW |