| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/glue/session_change_processor.h" | 5 #include "chrome/browser/sync/glue/session_change_processor.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
| 13 #include "chrome/browser/extensions/extension_tab_helper.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/sync/engine/syncapi.h" | 15 #include "chrome/browser/sync/engine/syncapi.h" |
| 15 #include "chrome/browser/sync/glue/session_model_associator.h" | 16 #include "chrome/browser/sync/glue/session_model_associator.h" |
| 16 #include "chrome/browser/sync/profile_sync_service.h" | 17 #include "chrome/browser/sync/profile_sync_service.h" |
| 17 #include "content/browser/tab_contents/navigation_controller.h" | 18 #include "content/browser/tab_contents/navigation_controller.h" |
| 18 #include "content/browser/tab_contents/tab_contents.h" | 19 #include "content/browser/tab_contents/tab_contents.h" |
| 19 #include "content/common/notification_details.h" | 20 #include "content/common/notification_details.h" |
| 20 #include "content/common/notification_service.h" | 21 #include "content/common/notification_service.h" |
| 21 #include "content/common/notification_source.h" | 22 #include "content/common/notification_source.h" |
| 22 | 23 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 NavigationController* controller = | 119 NavigationController* controller = |
| 119 Source<NavigationController>(source).ptr(); | 120 Source<NavigationController>(source).ptr(); |
| 120 if (controller->profile() != profile_) { | 121 if (controller->profile() != profile_) { |
| 121 return; | 122 return; |
| 122 } | 123 } |
| 123 modified_tabs.push_back(controller->tab_contents()); | 124 modified_tabs.push_back(controller->tab_contents()); |
| 124 break; | 125 break; |
| 125 } | 126 } |
| 126 | 127 |
| 127 case NotificationType::TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED: { | 128 case NotificationType::TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED: { |
| 128 TabContents* tab_contents = Source<TabContents>(source).ptr(); | 129 ExtensionTabHelper* extension_tab_helper = |
| 129 DCHECK(tab_contents); | 130 Source<ExtensionTabHelper>(source).ptr(); |
| 130 if (tab_contents->profile() != profile_) { | 131 if (extension_tab_helper->tab_contents()->profile() != profile_) { |
| 131 return; | 132 return; |
| 132 } | 133 } |
| 133 if (tab_contents->extension_app()) { | 134 if (extension_tab_helper->extension_app()) { |
| 134 modified_tabs.push_back(tab_contents); | 135 modified_tabs.push_back(extension_tab_helper->tab_contents()); |
| 135 } | 136 } |
| 136 break; | 137 break; |
| 137 } | 138 } |
| 138 default: | 139 default: |
| 139 LOG(ERROR) << "Received unexpected notification of type " | 140 LOG(ERROR) << "Received unexpected notification of type " |
| 140 << type.value; | 141 << type.value; |
| 141 break; | 142 break; |
| 142 } | 143 } |
| 143 | 144 |
| 144 // Associate windows first to ensure tabs have homes. | 145 // Associate windows first to ensure tabs have homes. |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 NotificationService::AllSources()); | 257 NotificationService::AllSources()); |
| 257 } | 258 } |
| 258 | 259 |
| 259 void SessionChangeProcessor::StopObserving() { | 260 void SessionChangeProcessor::StopObserving() { |
| 260 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 261 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 261 DCHECK(profile_); | 262 DCHECK(profile_); |
| 262 notification_registrar_.RemoveAll(); | 263 notification_registrar_.RemoveAll(); |
| 263 } | 264 } |
| 264 | 265 |
| 265 } // namespace browser_sync | 266 } // namespace browser_sync |
| OLD | NEW |