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

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

Issue 14497003: Moves TabNavigation into components/sessions and renames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Really remove webkit_support Created 7 years, 7 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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_model_associator.h" 5 #include "chrome/browser/sync/glue/session_model_associator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 11 matching lines...) Expand all
22 #include "chrome/browser/sync/glue/device_info.h" 22 #include "chrome/browser/sync/glue/device_info.h"
23 #include "chrome/browser/sync/glue/synced_device_tracker.h" 23 #include "chrome/browser/sync/glue/synced_device_tracker.h"
24 #include "chrome/browser/sync/glue/synced_session.h" 24 #include "chrome/browser/sync/glue/synced_session.h"
25 #include "chrome/browser/sync/glue/synced_tab_delegate.h" 25 #include "chrome/browser/sync/glue/synced_tab_delegate.h"
26 #include "chrome/browser/sync/glue/synced_window_delegate.h" 26 #include "chrome/browser/sync/glue/synced_window_delegate.h"
27 #include "chrome/browser/sync/profile_sync_service.h" 27 #include "chrome/browser/sync/profile_sync_service.h"
28 #include "chrome/common/chrome_notification_types.h" 28 #include "chrome/common/chrome_notification_types.h"
29 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
30 #include "chrome/common/pref_names.h" 30 #include "chrome/common/pref_names.h"
31 #include "chrome/common/url_constants.h" 31 #include "chrome/common/url_constants.h"
32 #include "components/sessions/serialized_navigation_entry.h"
32 #include "components/user_prefs/pref_registry_syncable.h" 33 #include "components/user_prefs/pref_registry_syncable.h"
33 #include "content/public/browser/favicon_status.h" 34 #include "content/public/browser/favicon_status.h"
34 #include "content/public/browser/navigation_entry.h" 35 #include "content/public/browser/navigation_entry.h"
35 #include "content/public/browser/notification_details.h" 36 #include "content/public/browser/notification_details.h"
36 #include "content/public/browser/notification_service.h" 37 #include "content/public/browser/notification_service.h"
37 #include "sync/api/sync_error.h" 38 #include "sync/api/sync_error.h"
38 #include "sync/api/time.h" 39 #include "sync/api/time.h"
39 #include "sync/internal_api/public/base/model_type.h" 40 #include "sync/internal_api/public/base/model_type.h"
40 #include "sync/internal_api/public/base/model_type_invalidation_map.h" 41 #include "sync/internal_api/public/base/model_type_invalidation_map.h"
41 #include "sync/internal_api/public/read_node.h" 42 #include "sync/internal_api/public/read_node.h"
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 current_index - kMaxSyncNavigationCount); 476 current_index - kMaxSyncNavigationCount);
476 const int max_index = std::min(current_index + kMaxSyncNavigationCount, 477 const int max_index = std::min(current_index + kMaxSyncNavigationCount,
477 tab_delegate.GetEntryCount()); 478 tab_delegate.GetEntryCount());
478 session_tab->navigations.clear(); 479 session_tab->navigations.clear();
479 for (int i = min_index; i < max_index; ++i) { 480 for (int i = min_index; i < max_index; ++i) {
480 const NavigationEntry* entry = (i == pending_index) ? 481 const NavigationEntry* entry = (i == pending_index) ?
481 tab_delegate.GetPendingEntry() : tab_delegate.GetEntryAtIndex(i); 482 tab_delegate.GetPendingEntry() : tab_delegate.GetEntryAtIndex(i);
482 DCHECK(entry); 483 DCHECK(entry);
483 if (entry->GetVirtualURL().is_valid()) { 484 if (entry->GetVirtualURL().is_valid()) {
484 session_tab->navigations.push_back( 485 session_tab->navigations.push_back(
485 TabNavigation::FromNavigationEntry(i, *entry)); 486 ::sessions::SerializedNavigationEntry::FromNavigationEntry(i,
487 *entry));
486 } 488 }
487 } 489 }
488 session_tab->session_storage_persistent_id.clear(); 490 session_tab->session_storage_persistent_id.clear();
489 } 491 }
490 492
491 void SessionModelAssociator::FaviconsUpdated( 493 void SessionModelAssociator::FaviconsUpdated(
492 const std::set<GURL>& urls) { 494 const std::set<GURL>& urls) {
493 // TODO(zea): consider a separate container for tabs with outstanding favicon 495 // TODO(zea): consider a separate container for tabs with outstanding favicon
494 // loads so we don't have to iterate through all tabs comparing urls. 496 // loads so we don't have to iterate through all tabs comparing urls.
495 for (std::set<GURL>::const_iterator i = urls.begin(); i != urls.end(); ++i) { 497 for (std::set<GURL>::const_iterator i = urls.begin(); i != urls.end(); ++i) {
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 1161
1160 bool SessionModelAssociator::CryptoReadyIfNecessary() { 1162 bool SessionModelAssociator::CryptoReadyIfNecessary() {
1161 // We only access the cryptographer while holding a transaction. 1163 // We only access the cryptographer while holding a transaction.
1162 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); 1164 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare());
1163 const syncer::ModelTypeSet encrypted_types = trans.GetEncryptedTypes(); 1165 const syncer::ModelTypeSet encrypted_types = trans.GetEncryptedTypes();
1164 return !encrypted_types.Has(SESSIONS) || 1166 return !encrypted_types.Has(SESSIONS) ||
1165 sync_service_->IsCryptographerReady(&trans); 1167 sync_service_->IsCryptographerReady(&trans);
1166 } 1168 }
1167 1169
1168 } // namespace browser_sync 1170 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sessions/tab_restore_service_helper.cc ('k') | chrome/browser/sync/glue/session_model_associator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698