| OLD | NEW |
| 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" |
| 11 #include "chrome/browser/extensions/tab_helper.h" | 11 #include "chrome/browser/extensions/tab_helper.h" |
| 12 #include "chrome/browser/history/history_notifications.h" | 12 #include "chrome/browser/favicon/favicon_changed_details.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/sync/glue/session_model_associator.h" | 14 #include "chrome/browser/sync/glue/session_model_associator.h" |
| 15 #include "chrome/browser/sync/profile_sync_service.h" | 15 #include "chrome/browser/sync/profile_sync_service.h" |
| 16 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" | 16 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" |
| 17 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
| 18 #include "content/public/browser/navigation_controller.h" | 18 #include "content/public/browser/navigation_controller.h" |
| 19 #include "content/public/browser/navigation_entry.h" | 19 #include "content/public/browser/navigation_entry.h" |
| 20 #include "content/public/browser/notification_details.h" | 20 #include "content/public/browser/notification_details.h" |
| 21 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
| 22 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 int type, | 83 int type, |
| 84 const content::NotificationSource& source, | 84 const content::NotificationSource& source, |
| 85 const content::NotificationDetails& details) { | 85 const content::NotificationDetails& details) { |
| 86 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 86 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 87 DCHECK(profile_); | 87 DCHECK(profile_); |
| 88 | 88 |
| 89 // Track which windows and/or tabs are modified. | 89 // Track which windows and/or tabs are modified. |
| 90 std::vector<SyncedTabDelegate*> modified_tabs; | 90 std::vector<SyncedTabDelegate*> modified_tabs; |
| 91 switch (type) { | 91 switch (type) { |
| 92 case chrome::NOTIFICATION_FAVICON_CHANGED: { | 92 case chrome::NOTIFICATION_FAVICON_CHANGED: { |
| 93 content::Details<history::FaviconChangeDetails> favicon_details(details); | 93 content::Details<FaviconChangedDetails> favicon_details(details); |
| 94 session_model_associator_->FaviconsUpdated(favicon_details->urls); | 94 session_model_associator_->FaviconsUpdated(favicon_details->urls); |
| 95 // Note: we favicon notifications don't affect tab contents, so we return | 95 // Note: we favicon notifications don't affect tab contents, so we return |
| 96 // here instead of continuing on to reassociate tabs/windows. | 96 // here instead of continuing on to reassociate tabs/windows. |
| 97 return; | 97 return; |
| 98 } | 98 } |
| 99 | 99 |
| 100 case chrome::NOTIFICATION_BROWSER_OPENED: { | 100 case chrome::NOTIFICATION_BROWSER_OPENED: { |
| 101 Browser* browser = content::Source<Browser>(source).ptr(); | 101 Browser* browser = content::Source<Browser>(source).ptr(); |
| 102 if (!browser || browser->profile() != profile_) { | 102 if (!browser || browser->profile() != profile_) { |
| 103 return; | 103 return; |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 notification_registrar_.Add(this, chrome::NOTIFICATION_FAVICON_CHANGED, | 354 notification_registrar_.Add(this, chrome::NOTIFICATION_FAVICON_CHANGED, |
| 355 content::Source<Profile>(profile_)); | 355 content::Source<Profile>(profile_)); |
| 356 } | 356 } |
| 357 | 357 |
| 358 void SessionChangeProcessor::StopObserving() { | 358 void SessionChangeProcessor::StopObserving() { |
| 359 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 359 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 360 notification_registrar_.RemoveAll(); | 360 notification_registrar_.RemoveAll(); |
| 361 } | 361 } |
| 362 | 362 |
| 363 } // namespace browser_sync | 363 } // namespace browser_sync |
| OLD | NEW |