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

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

Issue 8806011: Make NavigationEntry and friends use content::Referrer instead of plain URLs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 years 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) 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_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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 } 374 }
375 375
376 // Static 376 // Static
377 // TODO(zea): perhaps sync state (scroll position, form entries, etc.) as well? 377 // TODO(zea): perhaps sync state (scroll position, form entries, etc.) as well?
378 // See http://crbug.com/67068. 378 // See http://crbug.com/67068.
379 void SessionModelAssociator::PopulateSessionSpecificsNavigation( 379 void SessionModelAssociator::PopulateSessionSpecificsNavigation(
380 const TabNavigation* navigation, 380 const TabNavigation* navigation,
381 sync_pb::TabNavigation* tab_navigation) { 381 sync_pb::TabNavigation* tab_navigation) {
382 tab_navigation->set_index(navigation->index()); 382 tab_navigation->set_index(navigation->index());
383 tab_navigation->set_virtual_url(navigation->virtual_url().spec()); 383 tab_navigation->set_virtual_url(navigation->virtual_url().spec());
384 tab_navigation->set_referrer(navigation->referrer().spec()); 384 // FIXME(zea): Support referrer policy?
385 tab_navigation->set_referrer(navigation->referrer().url.spec());
385 tab_navigation->set_title(UTF16ToUTF8(navigation->title())); 386 tab_navigation->set_title(UTF16ToUTF8(navigation->title()));
386 switch (navigation->transition()) { 387 switch (navigation->transition()) {
387 case content::PAGE_TRANSITION_LINK: 388 case content::PAGE_TRANSITION_LINK:
388 tab_navigation->set_page_transition( 389 tab_navigation->set_page_transition(
389 sync_pb::TabNavigation_PageTransition_LINK); 390 sync_pb::TabNavigation_PageTransition_LINK);
390 break; 391 break;
391 case content::PAGE_TRANSITION_TYPED: 392 case content::PAGE_TRANSITION_TYPED:
392 tab_navigation->set_page_transition( 393 tab_navigation->set_page_transition(
393 sync_pb::TabNavigation_PageTransition_TYPED); 394 sync_pb::TabNavigation_PageTransition_TYPED);
394 break; 395 break;
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 break; 869 break;
869 case sync_pb:: 870 case sync_pb::
870 TabNavigation_PageTransitionQualifier_SERVER_REDIRECT: 871 TabNavigation_PageTransitionQualifier_SERVER_REDIRECT:
871 transition = content::PAGE_TRANSITION_SERVER_REDIRECT; 872 transition = content::PAGE_TRANSITION_SERVER_REDIRECT;
872 break; 873 break;
873 default: 874 default:
874 transition = content::PAGE_TRANSITION_TYPED; 875 transition = content::PAGE_TRANSITION_TYPED;
875 } 876 }
876 } 877 }
877 } 878 }
878 TabNavigation tab_navigation(index, virtual_url, referrer, title, state, 879 TabNavigation tab_navigation(
879 transition); 880 index, virtual_url,
881 content::Referrer(referrer, WebKit::WebReferrerPolicyDefault), title,
882 state, transition);
880 navigations->insert(navigations->end(), tab_navigation); 883 navigations->insert(navigations->end(), tab_navigation);
881 } 884 }
882 885
883 bool SessionModelAssociator::UpdateSyncModelDataFromClient() { 886 bool SessionModelAssociator::UpdateSyncModelDataFromClient() {
884 DCHECK(CalledOnValidThread()); 887 DCHECK(CalledOnValidThread());
885 // TODO(zea): the logic for determining if we want to sync and the loading of 888 // TODO(zea): the logic for determining if we want to sync and the loading of
886 // the previous session should go here. We can probably reuse the code for 889 // the previous session should go here. We can probably reuse the code for
887 // loading the current session from the old session implementation. 890 // loading the current session from the old session implementation.
888 // SessionService::SessionCallback* callback = 891 // SessionService::SessionCallback* callback =
889 // NewCallback(this, &SessionModelAssociator::OnGotSession); 892 // NewCallback(this, &SessionModelAssociator::OnGotSession);
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 bool SessionModelAssociator::CryptoReadyIfNecessary() { 1247 bool SessionModelAssociator::CryptoReadyIfNecessary() {
1245 // We only access the cryptographer while holding a transaction. 1248 // We only access the cryptographer while holding a transaction.
1246 sync_api::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); 1249 sync_api::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare());
1247 syncable::ModelTypeSet encrypted_types; 1250 syncable::ModelTypeSet encrypted_types;
1248 encrypted_types = sync_api::GetEncryptedTypes(&trans); 1251 encrypted_types = sync_api::GetEncryptedTypes(&trans);
1249 return encrypted_types.count(SESSIONS) == 0 || 1252 return encrypted_types.count(SESSIONS) == 0 ||
1250 sync_service_->IsCryptographerReady(&trans); 1253 sync_service_->IsCryptographerReady(&trans);
1251 } 1254 }
1252 1255
1253 } // namespace browser_sync 1256 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_types.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