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

Side by Side Diff: chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.h

Issue 2936543002: Move Google search related util methods to page_load_metrics_util (Closed)
Patch Set: incorporated falken's comment Created 3 years, 6 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 | « no previous file | chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_FROM_GWS_PAGE_LOAD_METRICS_OB SERVER_H_ 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_FROM_GWS_PAGE_LOAD_METRICS_OB SERVER_H_
6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_FROM_GWS_PAGE_LOAD_METRICS_OB SERVER_H_ 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_FROM_GWS_PAGE_LOAD_METRICS_OB SERVER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/optional.h" 9 #include "base/optional.h"
10 #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h" 10 #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 void OnParseStart(const page_load_metrics::mojom::PageLoadTiming& timing, 89 void OnParseStart(const page_load_metrics::mojom::PageLoadTiming& timing,
90 const page_load_metrics::PageLoadExtraInfo& extra_info); 90 const page_load_metrics::PageLoadExtraInfo& extra_info);
91 void OnParseStop(const page_load_metrics::mojom::PageLoadTiming& timing, 91 void OnParseStop(const page_load_metrics::mojom::PageLoadTiming& timing,
92 const page_load_metrics::PageLoadExtraInfo& extra_info); 92 const page_load_metrics::PageLoadExtraInfo& extra_info);
93 void OnUserInput(const blink::WebInputEvent& event); 93 void OnUserInput(const blink::WebInputEvent& event);
94 void FlushMetricsOnAppEnterBackground( 94 void FlushMetricsOnAppEnterBackground(
95 const page_load_metrics::mojom::PageLoadTiming& timing, 95 const page_load_metrics::mojom::PageLoadTiming& timing,
96 const page_load_metrics::PageLoadExtraInfo& extra_info); 96 const page_load_metrics::PageLoadExtraInfo& extra_info);
97 97
98 // The methods below are public only for testing. 98 // The methods below are public only for testing.
99 static bool IsGoogleSearchHostname(const GURL& url);
100 static bool IsGoogleSearchResultUrl(const GURL& url);
101 static bool IsGoogleSearchRedirectorUrl(const GURL& url);
102 bool ShouldLogFailedProvisionalLoadMetrics(); 99 bool ShouldLogFailedProvisionalLoadMetrics();
103 bool ShouldLogPostCommitMetrics(const GURL& url); 100 bool ShouldLogPostCommitMetrics(const GURL& url);
104 bool ShouldLogForegroundEventAfterCommit( 101 bool ShouldLogForegroundEventAfterCommit(
105 const base::Optional<base::TimeDelta>& event, 102 const base::Optional<base::TimeDelta>& event,
106 const page_load_metrics::PageLoadExtraInfo& info); 103 const page_load_metrics::PageLoadExtraInfo& info);
107 104
108 // Whether the given query string contains the given component. The query
109 // parameter should contain the query string of a URL (the portion following
110 // the question mark, excluding the question mark). The component must fully
111 // match a component in the query string. For example, 'foo=bar' would match
112 // the query string 'a=b&foo=bar&c=d' but would not match 'a=b&zzzfoo=bar&c=d'
113 // since, though foo=bar appears in the query string, the key specified in the
114 // component 'foo' does not match the full key in the query string
115 // 'zzzfoo'. For QueryContainsComponent, the component should of the form
116 // 'key=value'. For QueryContainsComponentPrefix, the component should be of
117 // the form 'key=' (where the value is not specified).
118 static bool QueryContainsComponent(const base::StringPiece query,
119 const base::StringPiece component);
120 static bool QueryContainsComponentPrefix(const base::StringPiece query,
121 const base::StringPiece component);
122
123 private: 105 private:
124 bool previously_committed_url_is_search_results_ = false; 106 bool previously_committed_url_is_search_results_ = false;
125 bool previously_committed_url_is_search_redirector_ = false; 107 bool previously_committed_url_is_search_redirector_ = false;
126 bool navigation_initiated_via_link_ = false; 108 bool navigation_initiated_via_link_ = false;
127 bool provisional_url_has_search_hostname_ = false; 109 bool provisional_url_has_search_hostname_ = false;
128 110
129 // The state of if first paint is triggered. 111 // The state of if first paint is triggered.
130 bool first_paint_triggered_ = false; 112 bool first_paint_triggered_ = false;
131 113
132 base::TimeTicks navigation_start_; 114 base::TimeTicks navigation_start_;
133 115
134 // The time of first user interaction after paint from navigation start. 116 // The time of first user interaction after paint from navigation start.
135 base::Optional<base::TimeDelta> first_user_interaction_after_paint_; 117 base::Optional<base::TimeDelta> first_user_interaction_after_paint_;
136 118
137 // Common helper for QueryContainsComponent and QueryContainsComponentPrefix.
138 static bool QueryContainsComponentHelper(const base::StringPiece query,
139 const base::StringPiece component,
140 bool component_is_prefix);
141
142 DISALLOW_COPY_AND_ASSIGN(FromGWSPageLoadMetricsLogger); 119 DISALLOW_COPY_AND_ASSIGN(FromGWSPageLoadMetricsLogger);
143 }; 120 };
144 121
145 class FromGWSPageLoadMetricsObserver 122 class FromGWSPageLoadMetricsObserver
146 : public page_load_metrics::PageLoadMetricsObserver { 123 : public page_load_metrics::PageLoadMetricsObserver {
147 public: 124 public:
148 FromGWSPageLoadMetricsObserver(); 125 FromGWSPageLoadMetricsObserver();
149 126
150 // page_load_metrics::PageLoadMetricsObserver implementation: 127 // page_load_metrics::PageLoadMetricsObserver implementation:
151 ObservePolicy OnStart(content::NavigationHandle* navigation_handle, 128 ObservePolicy OnStart(content::NavigationHandle* navigation_handle,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 169
193 void OnUserInput(const blink::WebInputEvent& event) override; 170 void OnUserInput(const blink::WebInputEvent& event) override;
194 171
195 private: 172 private:
196 FromGWSPageLoadMetricsLogger logger_; 173 FromGWSPageLoadMetricsLogger logger_;
197 174
198 DISALLOW_COPY_AND_ASSIGN(FromGWSPageLoadMetricsObserver); 175 DISALLOW_COPY_AND_ASSIGN(FromGWSPageLoadMetricsObserver);
199 }; 176 };
200 177
201 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_FROM_GWS_PAGE_LOAD_METRICS _OBSERVER_H_ 178 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_FROM_GWS_PAGE_LOAD_METRICS _OBSERVER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698