| 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/sessions_sync_manager.h" | 5 #include "chrome/browser/sync/sessions/sessions_sync_manager.h" |
| 6 | 6 |
| 7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/sync/glue/synced_tab_delegate.h" | 10 #include "chrome/browser/sync/glue/synced_tab_delegate.h" |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 syncer::SyncChangeList changes; | 389 syncer::SyncChangeList changes; |
| 390 // Associate tabs first so the synced session tracker is aware of them. | 390 // Associate tabs first so the synced session tracker is aware of them. |
| 391 AssociateTab(modified_tab, &changes); | 391 AssociateTab(modified_tab, &changes); |
| 392 // Note, we always associate windows because it's possible a tab became | 392 // Note, we always associate windows because it's possible a tab became |
| 393 // "interesting" by going to a valid URL, in which case it needs to be added | 393 // "interesting" by going to a valid URL, in which case it needs to be added |
| 394 // to the window's tab information. | 394 // to the window's tab information. |
| 395 AssociateWindows(DONT_RELOAD_TABS, syncer::SyncDataList(), &changes); | 395 AssociateWindows(DONT_RELOAD_TABS, syncer::SyncDataList(), &changes); |
| 396 sync_processor_->ProcessSyncChanges(FROM_HERE, changes); | 396 sync_processor_->ProcessSyncChanges(FROM_HERE, changes); |
| 397 } | 397 } |
| 398 | 398 |
| 399 void SessionsSyncManager::OnFaviconPageUrlsUpdated( | 399 void SessionsSyncManager::OnFaviconsChanged( |
| 400 const std::set<GURL>& updated_favicon_page_urls) { | 400 const std::set<GURL>& page_urls, |
| 401 const GURL& /* icon_url */) { |
| 401 // TODO(zea): consider a separate container for tabs with outstanding favicon | 402 // TODO(zea): consider a separate container for tabs with outstanding favicon |
| 402 // loads so we don't have to iterate through all tabs comparing urls. | 403 // loads so we don't have to iterate through all tabs comparing urls. |
| 403 for (std::set<GURL>::const_iterator i = updated_favicon_page_urls.begin(); | 404 for (const GURL& page_url : page_urls) { |
| 404 i != updated_favicon_page_urls.end(); ++i) { | |
| 405 for (TabLinksMap::iterator tab_iter = local_tab_map_.begin(); | 405 for (TabLinksMap::iterator tab_iter = local_tab_map_.begin(); |
| 406 tab_iter != local_tab_map_.end(); | 406 tab_iter != local_tab_map_.end(); |
| 407 ++tab_iter) { | 407 ++tab_iter) { |
| 408 if (tab_iter->second->url() == *i) | 408 if (tab_iter->second->url() == page_url) |
| 409 favicon_cache_.OnPageFaviconUpdated(*i); | 409 favicon_cache_.OnPageFaviconUpdated(page_url); |
| 410 } | 410 } |
| 411 } | 411 } |
| 412 } | 412 } |
| 413 | 413 |
| 414 void SessionsSyncManager::StopSyncing(syncer::ModelType type) { | 414 void SessionsSyncManager::StopSyncing(syncer::ModelType type) { |
| 415 local_event_router_->Stop(); | 415 local_event_router_->Stop(); |
| 416 sync_processor_.reset(NULL); | 416 sync_processor_.reset(NULL); |
| 417 error_handler_.reset(); | 417 error_handler_.reset(); |
| 418 session_tracker_.Clear(); | 418 session_tracker_.Clear(); |
| 419 local_tab_map_.clear(); | 419 local_tab_map_.clear(); |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 << " with age " << session_age_in_days << ", deleting."; | 1064 << " with age " << session_age_in_days << ", deleting."; |
| 1065 DeleteForeignSessionInternal(session_tag, &changes); | 1065 DeleteForeignSessionInternal(session_tag, &changes); |
| 1066 } | 1066 } |
| 1067 } | 1067 } |
| 1068 | 1068 |
| 1069 if (!changes.empty()) | 1069 if (!changes.empty()) |
| 1070 sync_processor_->ProcessSyncChanges(FROM_HERE, changes); | 1070 sync_processor_->ProcessSyncChanges(FROM_HERE, changes); |
| 1071 } | 1071 } |
| 1072 | 1072 |
| 1073 }; // namespace browser_sync | 1073 }; // namespace browser_sync |
| OLD | NEW |