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

Side by Side Diff: content/common/navigation_params.cc

Issue 2720763002: PlzNavigate: preserve SourceLocation when navigating (Closed)
Patch Set: Fix rebase compilation issues Created 3 years, 9 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
« no previous file with comments | « content/common/navigation_params.h ('k') | content/public/test/render_view_test.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 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 "content/common/navigation_params.h" 5 #include "content/common/navigation_params.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "content/common/service_worker/service_worker_types.h" 9 #include "content/common/service_worker/service_worker_types.h"
10 #include "content/public/common/appcache_info.h" 10 #include "content/public/common/appcache_info.h"
11 #include "content/public/common/browser_side_navigation_policy.h" 11 #include "content/public/common/browser_side_navigation_policy.h"
12 #include "content/public/common/url_constants.h" 12 #include "content/public/common/url_constants.h"
13 #include "url/gurl.h" 13 #include "url/gurl.h"
14 #include "url/url_constants.h" 14 #include "url/url_constants.h"
15 15
16 namespace content { 16 namespace content {
17 17
18 // PlzNavigate 18 // PlzNavigate
19 bool ShouldMakeNetworkRequestForURL(const GURL& url) { 19 bool ShouldMakeNetworkRequestForURL(const GURL& url) {
20 CHECK(IsBrowserSideNavigationEnabled()); 20 CHECK(IsBrowserSideNavigationEnabled());
21 21
22 // Javascript URLs, about:blank, srcdoc should not send a request 22 // Javascript URLs, about:blank, srcdoc should not send a request
23 // to the network stack. 23 // to the network stack.
24 return !url.IsAboutBlank() && !url.SchemeIs(url::kJavaScriptScheme) && 24 return !url.IsAboutBlank() && !url.SchemeIs(url::kJavaScriptScheme) &&
25 !url.is_empty() && !url.SchemeIs(url::kContentIDScheme) && 25 !url.is_empty() && !url.SchemeIs(url::kContentIDScheme) &&
26 url != content::kAboutSrcDocURL; 26 url != content::kAboutSrcDocURL;
27 } 27 }
28 28
29 SourceLocation::SourceLocation() : line_number(0), column_number(0) {}
30
31 SourceLocation::SourceLocation(const std::string& url,
32 unsigned int line_number,
33 unsigned int column_number)
34 : url(url), line_number(line_number), column_number(column_number) {}
35
36 SourceLocation::~SourceLocation() {}
37
29 CommonNavigationParams::CommonNavigationParams() 38 CommonNavigationParams::CommonNavigationParams()
30 : transition(ui::PAGE_TRANSITION_LINK), 39 : transition(ui::PAGE_TRANSITION_LINK),
31 navigation_type(FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT), 40 navigation_type(FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT),
32 allow_download(true), 41 allow_download(true),
33 should_replace_current_entry(false), 42 should_replace_current_entry(false),
34 report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT), 43 report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT),
35 previews_state(PREVIEWS_UNSPECIFIED), 44 previews_state(PREVIEWS_UNSPECIFIED),
36 navigation_start(base::TimeTicks::Now()), 45 navigation_start(base::TimeTicks::Now()),
37 method("GET") {} 46 method("GET") {}
38 47
39 CommonNavigationParams::CommonNavigationParams( 48 CommonNavigationParams::CommonNavigationParams(
40 const GURL& url, 49 const GURL& url,
41 const Referrer& referrer, 50 const Referrer& referrer,
42 ui::PageTransition transition, 51 ui::PageTransition transition,
43 FrameMsg_Navigate_Type::Value navigation_type, 52 FrameMsg_Navigate_Type::Value navigation_type,
44 bool allow_download, 53 bool allow_download,
45 bool should_replace_current_entry, 54 bool should_replace_current_entry,
46 base::TimeTicks ui_timestamp, 55 base::TimeTicks ui_timestamp,
47 FrameMsg_UILoadMetricsReportType::Value report_type, 56 FrameMsg_UILoadMetricsReportType::Value report_type,
48 const GURL& base_url_for_data_url, 57 const GURL& base_url_for_data_url,
49 const GURL& history_url_for_data_url, 58 const GURL& history_url_for_data_url,
50 PreviewsState previews_state, 59 PreviewsState previews_state,
51 const base::TimeTicks& navigation_start, 60 const base::TimeTicks& navigation_start,
52 std::string method, 61 std::string method,
53 const scoped_refptr<ResourceRequestBodyImpl>& post_data) 62 const scoped_refptr<ResourceRequestBodyImpl>& post_data,
63 base::Optional<SourceLocation> source_location)
54 : url(url), 64 : url(url),
55 referrer(referrer), 65 referrer(referrer),
56 transition(transition), 66 transition(transition),
57 navigation_type(navigation_type), 67 navigation_type(navigation_type),
58 allow_download(allow_download), 68 allow_download(allow_download),
59 should_replace_current_entry(should_replace_current_entry), 69 should_replace_current_entry(should_replace_current_entry),
60 ui_timestamp(ui_timestamp), 70 ui_timestamp(ui_timestamp),
61 report_type(report_type), 71 report_type(report_type),
62 base_url_for_data_url(base_url_for_data_url), 72 base_url_for_data_url(base_url_for_data_url),
63 history_url_for_data_url(history_url_for_data_url), 73 history_url_for_data_url(history_url_for_data_url),
64 previews_state(previews_state), 74 previews_state(previews_state),
65 navigation_start(navigation_start), 75 navigation_start(navigation_start),
66 method(method), 76 method(method),
67 post_data(post_data) { 77 post_data(post_data),
78 source_location(source_location) {
68 // |method != "POST"| should imply absence of |post_data|. 79 // |method != "POST"| should imply absence of |post_data|.
69 if (method != "POST" && post_data) { 80 if (method != "POST" && post_data) {
70 NOTREACHED(); 81 NOTREACHED();
71 this->post_data = nullptr; 82 this->post_data = nullptr;
72 } 83 }
73 } 84 }
74 85
75 CommonNavigationParams::CommonNavigationParams( 86 CommonNavigationParams::CommonNavigationParams(
76 const CommonNavigationParams& other) = default; 87 const CommonNavigationParams& other) = default;
77 88
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 const RequestNavigationParams& request_params) 207 const RequestNavigationParams& request_params)
197 : common_params(common_params), 208 : common_params(common_params),
198 start_params(start_params), 209 start_params(start_params),
199 request_params(request_params) { 210 request_params(request_params) {
200 } 211 }
201 212
202 NavigationParams::~NavigationParams() { 213 NavigationParams::~NavigationParams() {
203 } 214 }
204 215
205 } // namespace content 216 } // namespace content
OLDNEW
« no previous file with comments | « content/common/navigation_params.h ('k') | content/public/test/render_view_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698