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

Side by Side Diff: components/sessions/content/content_serialized_navigation_driver.cc

Issue 2478573004: Convert GURL::{host,path} to GURL::{host_piece,path_piece} for ==. (Closed)
Patch Set: rebase to #431874 Created 4 years, 1 month 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
OLDNEW
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 "components/sessions/content/content_serialized_navigation_driver.h" 5 #include "components/sessions/content/content_serialized_navigation_driver.h"
6 6
7 #include "base/memory/singleton.h" 7 #include "base/memory/singleton.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "components/sessions/core/serialized_navigation_entry.h" 9 #include "components/sessions/core/serialized_navigation_entry.h"
10 #include "content/public/common/page_state.h" 10 #include "content/public/common/page_state.h"
11 #include "content/public/common/referrer.h" 11 #include "content/public/common/referrer.h"
12 #include "content/public/common/url_constants.h" 12 #include "content/public/common/url_constants.h"
13 13
14 namespace sessions { 14 namespace sessions {
15 15
16 namespace { 16 namespace {
17 const int kObsoleteReferrerPolicyAlways = 0; 17 const int kObsoleteReferrerPolicyAlways = 0;
18 const int kObsoleteReferrerPolicyDefault = 1; 18 const int kObsoleteReferrerPolicyDefault = 1;
19 const int kObsoleteReferrerPolicyNever = 2; 19 const int kObsoleteReferrerPolicyNever = 2;
20 const int kObsoleteReferrerPolicyOrigin = 3; 20 const int kObsoleteReferrerPolicyOrigin = 3;
21 21
22 bool IsUberOrUberReplacementURL(const GURL& url) { 22 bool IsUberOrUberReplacementURL(const GURL& url) {
23 return url.SchemeIs(content::kChromeUIScheme) && 23 return url.SchemeIs(content::kChromeUIScheme) &&
24 (url.host() == content::kChromeUIHistoryHost || 24 (url.host_piece() == content::kChromeUIHistoryHost ||
25 url.host() == content::kChromeUIUberHost); 25 url.host_piece() == content::kChromeUIUberHost);
26 } 26 }
27 27
28 } // namespace 28 } // namespace
29 29
30 // static 30 // static
31 SerializedNavigationDriver* SerializedNavigationDriver::Get() { 31 SerializedNavigationDriver* SerializedNavigationDriver::Get() {
32 return ContentSerializedNavigationDriver::GetInstance(); 32 return ContentSerializedNavigationDriver::GetInstance();
33 } 33 }
34 34
35 // static 35 // static
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 if (navigation->referrer_url_ != new_referrer.url) { 124 if (navigation->referrer_url_ != new_referrer.url) {
125 navigation->referrer_url_ = GURL(); 125 navigation->referrer_url_ = GURL();
126 navigation->referrer_policy_ = GetDefaultReferrerPolicy(); 126 navigation->referrer_policy_ = GetDefaultReferrerPolicy();
127 navigation->encoded_page_state_ = 127 navigation->encoded_page_state_ =
128 StripReferrerFromPageState(navigation->encoded_page_state_); 128 StripReferrerFromPageState(navigation->encoded_page_state_);
129 } 129 }
130 130
131 #if defined(OS_ANDROID) 131 #if defined(OS_ANDROID)
132 // Rewrite the old new tab and welcome page URLs to the new NTP URL. 132 // Rewrite the old new tab and welcome page URLs to the new NTP URL.
133 if (navigation->virtual_url_.SchemeIs(content::kChromeUIScheme) && 133 if (navigation->virtual_url_.SchemeIs(content::kChromeUIScheme) &&
134 (navigation->virtual_url_.host() == "welcome" || 134 (navigation->virtual_url_.host_piece() == "welcome" ||
135 navigation->virtual_url_.host() == "newtab")) { 135 navigation->virtual_url_.host_piece() == "newtab")) {
136 navigation->virtual_url_ = GURL("chrome-native://newtab/"); 136 navigation->virtual_url_ = GURL("chrome-native://newtab/");
137 navigation->original_request_url_ = navigation->virtual_url_; 137 navigation->original_request_url_ = navigation->virtual_url_;
138 navigation->encoded_page_state_ = content::PageState::CreateFromURL( 138 navigation->encoded_page_state_ = content::PageState::CreateFromURL(
139 navigation->virtual_url_).ToEncodedData(); 139 navigation->virtual_url_).ToEncodedData();
140 } 140 }
141 #endif // defined(OS_ANDROID) 141 #endif // defined(OS_ANDROID)
142 } 142 }
143 143
144 std::string ContentSerializedNavigationDriver::StripReferrerFromPageState( 144 std::string ContentSerializedNavigationDriver::StripReferrerFromPageState(
145 const std::string& page_state) const { 145 const std::string& page_state) const {
(...skipping 10 matching lines...) Expand all
156 DCHECK(handler.get()); 156 DCHECK(handler.get());
157 extended_info_handler_map_[key] = std::move(handler); 157 extended_info_handler_map_[key] = std::move(handler);
158 } 158 }
159 159
160 const ContentSerializedNavigationDriver::ExtendedInfoHandlerMap& 160 const ContentSerializedNavigationDriver::ExtendedInfoHandlerMap&
161 ContentSerializedNavigationDriver::GetAllExtendedInfoHandlers() const { 161 ContentSerializedNavigationDriver::GetAllExtendedInfoHandlers() const {
162 return extended_info_handler_map_; 162 return extended_info_handler_map_;
163 } 163 }
164 164
165 } // namespace sessions 165 } // namespace sessions
OLDNEW
« no previous file with comments | « components/search_engines/template_url_service.cc ('k') | components/url_formatter/url_formatter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698