Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Side by Side Diff: chrome/browser/sync/glue/session_change_processor.cc

Issue 10079023: Move notifications used only in chrome/ out of content/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: six! Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 case chrome::NOTIFICATION_BROWSER_OPENED: { 103 case chrome::NOTIFICATION_BROWSER_OPENED: {
104 Browser* browser = content::Source<Browser>(source).ptr(); 104 Browser* browser = content::Source<Browser>(source).ptr();
105 if (!browser || browser->profile() != profile_) { 105 if (!browser || browser->profile() != profile_) {
106 return; 106 return;
107 } 107 }
108 DVLOG(1) << "Received BROWSER_OPENED for profile " << profile_; 108 DVLOG(1) << "Received BROWSER_OPENED for profile " << profile_;
109 break; 109 break;
110 } 110 }
111 111
112 case content::NOTIFICATION_TAB_PARENTED: { 112 case chrome::NOTIFICATION_TAB_PARENTED: {
113 SyncedTabDelegate* tab = 113 SyncedTabDelegate* tab =
114 content::Source<TabContentsWrapper>(source).ptr()-> 114 content::Source<TabContentsWrapper>(source).ptr()->
115 synced_tab_delegate(); 115 synced_tab_delegate();
116 if (!tab || tab->profile() != profile_) { 116 if (!tab || tab->profile() != profile_) {
117 return; 117 return;
118 } 118 }
119 modified_tabs.push_back(tab); 119 modified_tabs.push_back(tab);
120 DVLOG(1) << "Received TAB_PARENTED for profile " << profile_; 120 DVLOG(1) << "Received TAB_PARENTED for profile " << profile_;
121 break; 121 break;
122 } 122 }
123 123
124 case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME: { 124 case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME: {
125 TabContentsWrapper* tab_contents_wrapper = 125 TabContentsWrapper* tab_contents_wrapper =
126 TabContentsWrapper::GetCurrentWrapperForContents( 126 TabContentsWrapper::GetCurrentWrapperForContents(
127 content::Source<WebContents>(source).ptr()); 127 content::Source<WebContents>(source).ptr());
128 if (!tab_contents_wrapper) { 128 if (!tab_contents_wrapper) {
129 return; 129 return;
130 } 130 }
131 SyncedTabDelegate* tab = tab_contents_wrapper->synced_tab_delegate(); 131 SyncedTabDelegate* tab = tab_contents_wrapper->synced_tab_delegate();
132 if (!tab || tab->profile() != profile_) { 132 if (!tab || tab->profile() != profile_) {
133 return; 133 return;
134 } 134 }
135 modified_tabs.push_back(tab); 135 modified_tabs.push_back(tab);
136 DVLOG(1) << "Received LOAD_COMPLETED_MAIN_FRAME for profile " << profile_; 136 DVLOG(1) << "Received LOAD_COMPLETED_MAIN_FRAME for profile " << profile_;
137 break; 137 break;
138 } 138 }
139 139
140 case content::NOTIFICATION_TAB_CLOSED: { 140 case content::NOTIFICATION_WEB_CONTENTS_DESTROYED: {
141 SyncedTabDelegate* tab = ExtractSyncedTabDelegate(source); 141 TabContentsWrapper* tab_contents_wrapper =
142 TabContentsWrapper::GetCurrentWrapperForContents(
143 content::Source<WebContents>(source).ptr());
144 if (!tab_contents_wrapper) {
145 return;
146 }
147 SyncedTabDelegate* tab = tab_contents_wrapper->synced_tab_delegate();
142 if (!tab || tab->profile() != profile_) { 148 if (!tab || tab->profile() != profile_) {
143 return; 149 return;
144 } 150 }
145 modified_tabs.push_back(tab); 151 modified_tabs.push_back(tab);
146 DVLOG(1) << "Received TAB_CLOSED for profile " << profile_; 152 DVLOG(1) << "Received NOTIFICATION_WEB_CONTENTS_DESTROYED for profile "
153 << profile_;
147 break; 154 break;
148 } 155 }
149 156
150 case content::NOTIFICATION_NAV_LIST_PRUNED: { 157 case content::NOTIFICATION_NAV_LIST_PRUNED: {
151 SyncedTabDelegate* tab = ExtractSyncedTabDelegate(source); 158 SyncedTabDelegate* tab = ExtractSyncedTabDelegate(source);
152 if (!tab || tab->profile() != profile_) { 159 if (!tab || tab->profile() != profile_) {
153 return; 160 return;
154 } 161 }
155 modified_tabs.push_back(tab); 162 modified_tabs.push_back(tab);
156 DVLOG(1) << "Received NAV_LIST_PRUNED for profile " << profile_; 163 DVLOG(1) << "Received NAV_LIST_PRUNED for profile " << profile_;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 void SessionChangeProcessor::StopImpl() { 341 void SessionChangeProcessor::StopImpl() {
335 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 342 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
336 StopObserving(); 343 StopObserving();
337 profile_ = NULL; 344 profile_ = NULL;
338 } 345 }
339 346
340 void SessionChangeProcessor::StartObserving() { 347 void SessionChangeProcessor::StartObserving() {
341 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 348 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
342 if (!profile_) 349 if (!profile_)
343 return; 350 return;
344 notification_registrar_.Add(this, content::NOTIFICATION_TAB_PARENTED, 351 notification_registrar_.Add(this, chrome::NOTIFICATION_TAB_PARENTED,
345 content::NotificationService::AllSources()); 352 content::NotificationService::AllSources());
346 notification_registrar_.Add(this, content::NOTIFICATION_TAB_CLOSED, 353 notification_registrar_.Add(this,
354 content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
347 content::NotificationService::AllSources()); 355 content::NotificationService::AllSources());
348 notification_registrar_.Add(this, content::NOTIFICATION_NAV_LIST_PRUNED, 356 notification_registrar_.Add(this, content::NOTIFICATION_NAV_LIST_PRUNED,
349 content::NotificationService::AllSources()); 357 content::NotificationService::AllSources());
350 notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_CHANGED, 358 notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_CHANGED,
351 content::NotificationService::AllSources()); 359 content::NotificationService::AllSources());
352 notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, 360 notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
353 content::NotificationService::AllSources()); 361 content::NotificationService::AllSources());
354 notification_registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, 362 notification_registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
355 content::NotificationService::AllBrowserContextsAndSources()); 363 content::NotificationService::AllBrowserContextsAndSources());
356 notification_registrar_.Add(this, 364 notification_registrar_.Add(this,
357 chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, 365 chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED,
358 content::NotificationService::AllSources()); 366 content::NotificationService::AllSources());
359 notification_registrar_.Add(this, 367 notification_registrar_.Add(this,
360 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, 368 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
361 content::NotificationService::AllBrowserContextsAndSources()); 369 content::NotificationService::AllBrowserContextsAndSources());
362 notification_registrar_.Add(this, chrome::NOTIFICATION_FAVICON_CHANGED, 370 notification_registrar_.Add(this, chrome::NOTIFICATION_FAVICON_CHANGED,
363 content::Source<Profile>(profile_)); 371 content::Source<Profile>(profile_));
364 } 372 }
365 373
366 void SessionChangeProcessor::StopObserving() { 374 void SessionChangeProcessor::StopObserving() {
367 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 375 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
368 notification_registrar_.RemoveAll(); 376 notification_registrar_.RemoveAll();
369 } 377 }
370 378
371 } // namespace browser_sync 379 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698