OLD | NEW |
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 COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_OBSE
RVER_H_ | 5 #ifndef COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_OBSE
RVER_H_ |
6 #define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_OBSE
RVER_H_ | 6 #define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_OBSE
RVER_H_ |
7 | 7 |
8 #include "base/containers/scoped_ptr_map.h" | 8 #include "base/containers/scoped_ptr_map.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 namespace IPC { | 26 namespace IPC { |
27 class Message; | 27 class Message; |
28 } // namespace IPC | 28 } // namespace IPC |
29 | 29 |
30 namespace rappor { | 30 namespace rappor { |
31 class RapporService; | 31 class RapporService; |
32 } | 32 } |
33 | 33 |
34 namespace page_load_metrics { | 34 namespace page_load_metrics { |
35 | 35 |
| 36 // Returns true if the given URL matches a Google CAPTCHA page. |
| 37 bool IsGoogleCaptcha(const GURL& url); |
| 38 |
36 // These constants are for keeping the tests in sync. | 39 // These constants are for keeping the tests in sync. |
37 const char kHistogramNameFirstLayout[] = | 40 const char kHistogramNameFirstLayout[] = |
38 "PageLoad.Timing2.NavigationToFirstLayout"; | 41 "PageLoad.Timing2.NavigationToFirstLayout"; |
39 const char kHistogramNameFirstTextPaint[] = | 42 const char kHistogramNameFirstTextPaint[] = |
40 "PageLoad.Timing2.NavigationToFirstTextPaint"; | 43 "PageLoad.Timing2.NavigationToFirstTextPaint"; |
41 const char kHistogramNameDomContent[] = | 44 const char kHistogramNameDomContent[] = |
42 "PageLoad.Timing2.NavigationToDOMContentLoadedEventFired"; | 45 "PageLoad.Timing2.NavigationToDOMContentLoadedEventFired"; |
43 const char kHistogramNameLoad[] = "PageLoad.Timing2.NavigationToLoadEventFired"; | 46 const char kHistogramNameLoad[] = "PageLoad.Timing2.NavigationToLoadEventFired"; |
44 const char kBGHistogramNameFirstLayout[] = | 47 const char kBGHistogramNameFirstLayout[] = |
45 "PageLoad.Timing2.NavigationToFirstLayout.Background"; | 48 "PageLoad.Timing2.NavigationToFirstLayout.Background"; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 ERR_IPC_FROM_BAD_URL_SCHEME, | 154 ERR_IPC_FROM_BAD_URL_SCHEME, |
152 | 155 |
153 // If we track a navigation, but the renderer sends us no IPCs. This could | 156 // If we track a navigation, but the renderer sends us no IPCs. This could |
154 // occur if the browser filters loads less aggressively than the renderer. | 157 // occur if the browser filters loads less aggressively than the renderer. |
155 ERR_NO_IPCS_RECEIVED, | 158 ERR_NO_IPCS_RECEIVED, |
156 | 159 |
157 // Add values before this final count. | 160 // Add values before this final count. |
158 ERR_LAST_ENTRY | 161 ERR_LAST_ENTRY |
159 }; | 162 }; |
160 | 163 |
| 164 // Values of the UMA GoogleCaptcha.Event histogram. |
| 165 enum GoogleCaptchaEvent { |
| 166 // A Google CAPTCHA page was shown to the user. |
| 167 GOOGLE_CAPTCHA_SHOWN, |
| 168 // A Google CAPTCHA page was solved by the user. |
| 169 GOOGLE_CAPTCHA_SOLVED, |
| 170 // Add new values before this final count. |
| 171 GOOGLE_CAPTCHA_EVENT_BOUNDARY, |
| 172 }; |
| 173 |
161 // This class tracks a given page load, starting from navigation start / | 174 // This class tracks a given page load, starting from navigation start / |
162 // provisional load, until a new navigation commits or the navigation fails. It | 175 // provisional load, until a new navigation commits or the navigation fails. It |
163 // also records RAPPOR/UMA about the page load. | 176 // also records RAPPOR/UMA about the page load. |
164 // MetricsWebContentsObserver manages a set of provisional PageLoadTrackers, as | 177 // MetricsWebContentsObserver manages a set of provisional PageLoadTrackers, as |
165 // well as a committed PageLoadTracker. | 178 // well as a committed PageLoadTracker. |
166 class PageLoadTracker { | 179 class PageLoadTracker { |
167 public: | 180 public: |
168 // Caller must guarantee that the observers pointer outlives this class. | 181 // Caller must guarantee that the observers pointer outlives this class. |
169 PageLoadTracker(bool in_foreground, | 182 PageLoadTracker(bool in_foreground, |
170 rappor::RapporService* const rappor_service, | 183 rappor::RapporService* const rappor_service, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 void AddObserver(PageLoadMetricsObserver* observer) override; | 245 void AddObserver(PageLoadMetricsObserver* observer) override; |
233 void RemoveObserver(PageLoadMetricsObserver* observer) override; | 246 void RemoveObserver(PageLoadMetricsObserver* observer) override; |
234 | 247 |
235 // content::WebContentsObserver implementation: | 248 // content::WebContentsObserver implementation: |
236 bool OnMessageReceived(const IPC::Message& message, | 249 bool OnMessageReceived(const IPC::Message& message, |
237 content::RenderFrameHost* render_frame_host) override; | 250 content::RenderFrameHost* render_frame_host) override; |
238 void DidStartNavigation( | 251 void DidStartNavigation( |
239 content::NavigationHandle* navigation_handle) override; | 252 content::NavigationHandle* navigation_handle) override; |
240 void DidFinishNavigation( | 253 void DidFinishNavigation( |
241 content::NavigationHandle* navigation_handle) override; | 254 content::NavigationHandle* navigation_handle) override; |
| 255 void DidRedirectNavigation( |
| 256 content::NavigationHandle* navigation_handle) override; |
242 | 257 |
243 void WasShown() override; | 258 void WasShown() override; |
244 void WasHidden() override; | 259 void WasHidden() override; |
245 | 260 |
246 void RenderProcessGone(base::TerminationStatus status) override; | 261 void RenderProcessGone(base::TerminationStatus status) override; |
247 | 262 |
248 private: | 263 private: |
249 friend class content::WebContentsUserData<MetricsWebContentsObserver>; | 264 friend class content::WebContentsUserData<MetricsWebContentsObserver>; |
250 | 265 |
251 void OnTimingUpdated(content::RenderFrameHost*, const PageLoadTiming& timing); | 266 void OnTimingUpdated(content::RenderFrameHost*, const PageLoadTiming& timing); |
(...skipping 11 matching lines...) Expand all Loading... |
263 | 278 |
264 rappor::RapporService* const rappor_service_; | 279 rappor::RapporService* const rappor_service_; |
265 base::ObserverList<PageLoadMetricsObserver, true> observers_; | 280 base::ObserverList<PageLoadMetricsObserver, true> observers_; |
266 | 281 |
267 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver); | 282 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver); |
268 }; | 283 }; |
269 | 284 |
270 } // namespace page_load_metrics | 285 } // namespace page_load_metrics |
271 | 286 |
272 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_O
BSERVER_H_ | 287 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_O
BSERVER_H_ |
OLD | NEW |