| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/sessions2/notification_service_sessions_router.h" | 5 #include "chrome/browser/sync/sessions2/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" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 if (!flare_.is_null()) { | 128 if (!flare_.is_null()) { |
| 129 flare_.Run(syncer::SESSIONS); | 129 flare_.Run(syncer::SESSIONS); |
| 130 flare_.Reset(); | 130 flare_.Reset(); |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 void NotificationServiceSessionsRouter::OnNavigationBlocked( | 134 void NotificationServiceSessionsRouter::OnNavigationBlocked( |
| 135 content::WebContents* web_contents) { | 135 content::WebContents* web_contents) { |
| 136 SyncedTabDelegate* tab = | 136 SyncedTabDelegate* tab = |
| 137 SyncedTabDelegate::ImplFromWebContents(web_contents); | 137 SyncedTabDelegate::ImplFromWebContents(web_contents); |
| 138 if (!tab) | 138 if (!tab || !handler_) |
| 139 return; | 139 return; |
| 140 | 140 |
| 141 DCHECK(tab->profile() == profile_); | 141 DCHECK(tab->profile() == profile_); |
| 142 handler_->OnLocalTabModified(tab); | 142 handler_->OnLocalTabModified(tab); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void NotificationServiceSessionsRouter::StartRoutingTo( | 145 void NotificationServiceSessionsRouter::StartRoutingTo( |
| 146 LocalSessionEventHandler* handler) { | 146 LocalSessionEventHandler* handler) { |
| 147 DCHECK(!handler_); | 147 DCHECK(!handler_); |
| 148 handler_ = handler; | 148 handler_ = handler; |
| 149 } | 149 } |
| 150 | 150 |
| 151 void NotificationServiceSessionsRouter::Stop() { | 151 void NotificationServiceSessionsRouter::Stop() { |
| 152 weak_ptr_factory_.InvalidateWeakPtrs(); | 152 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 153 registrar_.RemoveAll(); | 153 registrar_.RemoveAll(); |
| 154 handler_ = NULL; | 154 handler_ = NULL; |
| 155 } | 155 } |
| 156 | 156 |
| 157 } // namespace browser_sync | 157 } // namespace browser_sync |
| OLD | NEW |