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

Side by Side Diff: components/sessions/serialized_navigation_entry.cc

Issue 128193002: Include the referrer policy in sync'd tab navigations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
« no previous file with comments | « no previous file | components/sessions/serialized_navigation_entry_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/sessions/serialized_navigation_entry.h" 5 #include "components/sessions/serialized_navigation_entry.h"
6 6
7 #include "base/pickle.h" 7 #include "base/pickle.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "content/public/browser/favicon_status.h" 9 #include "content/public/browser/favicon_status.h"
10 #include "content/public/browser/navigation_controller.h" 10 #include "content/public/browser/navigation_controller.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 return navigation; 59 return navigation;
60 } 60 }
61 61
62 SerializedNavigationEntry SerializedNavigationEntry::FromSyncData( 62 SerializedNavigationEntry SerializedNavigationEntry::FromSyncData(
63 int index, 63 int index,
64 const sync_pb::TabNavigation& sync_data) { 64 const sync_pb::TabNavigation& sync_data) {
65 SerializedNavigationEntry navigation; 65 SerializedNavigationEntry navigation;
66 navigation.index_ = index; 66 navigation.index_ = index;
67 navigation.unique_id_ = sync_data.unique_id(); 67 navigation.unique_id_ = sync_data.unique_id();
68 navigation.referrer_ = 68 navigation.referrer_ = content::Referrer(
69 content::Referrer(GURL(sync_data.referrer()), 69 GURL(sync_data.referrer()),
70 blink::WebReferrerPolicyDefault); 70 static_cast<blink::WebReferrerPolicy>(sync_data.referrer_policy()));
71 navigation.virtual_url_ = GURL(sync_data.virtual_url()); 71 navigation.virtual_url_ = GURL(sync_data.virtual_url());
72 navigation.title_ = base::UTF8ToUTF16(sync_data.title()); 72 navigation.title_ = base::UTF8ToUTF16(sync_data.title());
73 navigation.page_state_ = 73 navigation.page_state_ =
74 content::PageState::CreateFromEncodedData(sync_data.state()); 74 content::PageState::CreateFromEncodedData(sync_data.state());
75 75
76 uint32 transition = 0; 76 uint32 transition = 0;
77 if (sync_data.has_page_transition()) { 77 if (sync_data.has_page_transition()) {
78 switch (sync_data.page_transition()) { 78 switch (sync_data.page_transition()) {
79 case sync_pb::SyncEnums_PageTransition_LINK: 79 case sync_pb::SyncEnums_PageTransition_LINK:
80 transition = content::PAGE_TRANSITION_LINK; 80 transition = content::PAGE_TRANSITION_LINK;
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 DCHECK_EQ(0u, content_pack_categories_.size()); 359 DCHECK_EQ(0u, content_pack_categories_.size());
360 360
361 return entry.Pass(); 361 return entry.Pass();
362 } 362 }
363 363
364 // TODO(zea): perhaps sync state (scroll position, form entries, etc.) as well? 364 // TODO(zea): perhaps sync state (scroll position, form entries, etc.) as well?
365 // See http://crbug.com/67068. 365 // See http://crbug.com/67068.
366 sync_pb::TabNavigation SerializedNavigationEntry::ToSyncData() const { 366 sync_pb::TabNavigation SerializedNavigationEntry::ToSyncData() const {
367 sync_pb::TabNavigation sync_data; 367 sync_pb::TabNavigation sync_data;
368 sync_data.set_virtual_url(virtual_url_.spec()); 368 sync_data.set_virtual_url(virtual_url_.spec());
369 // FIXME(zea): Support referrer policy?
370 sync_data.set_referrer(referrer_.url.spec()); 369 sync_data.set_referrer(referrer_.url.spec());
370 sync_data.set_referrer_policy(referrer_.policy);
371 sync_data.set_title(base::UTF16ToUTF8(title_)); 371 sync_data.set_title(base::UTF16ToUTF8(title_));
372 372
373 // Page transition core. 373 // Page transition core.
374 COMPILE_ASSERT(content::PAGE_TRANSITION_LAST_CORE == 374 COMPILE_ASSERT(content::PAGE_TRANSITION_LAST_CORE ==
375 content::PAGE_TRANSITION_KEYWORD_GENERATED, 375 content::PAGE_TRANSITION_KEYWORD_GENERATED,
376 PageTransitionCoreBounds); 376 PageTransitionCoreBounds);
377 switch (PageTransitionStripQualifier(transition_type_)) { 377 switch (PageTransitionStripQualifier(transition_type_)) {
378 case content::PAGE_TRANSITION_LINK: 378 case content::PAGE_TRANSITION_LINK:
379 sync_data.set_page_transition( 379 sync_data.set_page_transition(
380 sync_pb::SyncEnums_PageTransition_LINK); 380 sync_pb::SyncEnums_PageTransition_LINK);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 for (std::vector<SerializedNavigationEntry>::const_iterator 479 for (std::vector<SerializedNavigationEntry>::const_iterator
480 it = navigations.begin(); it != navigations.end(); ++it) { 480 it = navigations.begin(); it != navigations.end(); ++it) {
481 entries.push_back( 481 entries.push_back(
482 it->ToNavigationEntry(page_id, browser_context).release()); 482 it->ToNavigationEntry(page_id, browser_context).release());
483 ++page_id; 483 ++page_id;
484 } 484 }
485 return entries; 485 return entries;
486 } 486 }
487 487
488 } // namespace sessions 488 } // namespace sessions
OLDNEW
« no previous file with comments | « no previous file | components/sessions/serialized_navigation_entry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698