 Chromium Code Reviews
 Chromium Code Reviews Issue 2481013007:
  Improve tracking of user initiated page loads.  (Closed)
    
  
    Issue 2481013007:
  Improve tracking of user initiated page loads.  (Closed) 
  | 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 CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 
| 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_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/common/page_load_metrics/page_load_timing.h" | 10 #include "chrome/common/page_load_metrics/page_load_timing.h" | 
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 | 63 | 
| 64 base::TimeDelta time_to_failed_provisional_load; | 64 base::TimeDelta time_to_failed_provisional_load; | 
| 65 net::Error error; | 65 net::Error error; | 
| 66 }; | 66 }; | 
| 67 | 67 | 
| 68 struct PageLoadExtraInfo { | 68 struct PageLoadExtraInfo { | 
| 69 PageLoadExtraInfo( | 69 PageLoadExtraInfo( | 
| 70 const base::Optional<base::TimeDelta>& first_background_time, | 70 const base::Optional<base::TimeDelta>& first_background_time, | 
| 71 const base::Optional<base::TimeDelta>& first_foreground_time, | 71 const base::Optional<base::TimeDelta>& first_foreground_time, | 
| 72 bool started_in_foreground, | 72 bool started_in_foreground, | 
| 73 bool user_gesture, | 73 bool user_initiated, | 
| 74 const GURL& committed_url, | 74 const GURL& committed_url, | 
| 75 const GURL& start_url, | 75 const GURL& start_url, | 
| 76 UserAbortType abort_type, | 76 UserAbortType abort_type, | 
| 77 bool abort_user_initiated, | 77 bool abort_user_initiated, | 
| 78 const base::Optional<base::TimeDelta>& time_to_abort, | 78 const base::Optional<base::TimeDelta>& time_to_abort, | 
| 79 int num_cache_requests, | 79 int num_cache_requests, | 
| 80 int num_network_requests, | 80 int num_network_requests, | 
| 81 const PageLoadMetadata& metadata); | 81 const PageLoadMetadata& metadata); | 
| 82 | 82 | 
| 83 PageLoadExtraInfo(const PageLoadExtraInfo& other); | 83 PageLoadExtraInfo(const PageLoadExtraInfo& other); | 
| 84 | 84 | 
| 85 ~PageLoadExtraInfo(); | 85 ~PageLoadExtraInfo(); | 
| 86 | 86 | 
| 87 // The first time that the page was backgrounded since the navigation started. | 87 // The first time that the page was backgrounded since the navigation started. | 
| 88 const base::Optional<base::TimeDelta> first_background_time; | 88 const base::Optional<base::TimeDelta> first_background_time; | 
| 89 | 89 | 
| 90 // The first time that the page was foregrounded since the navigation started. | 90 // The first time that the page was foregrounded since the navigation started. | 
| 91 const base::Optional<base::TimeDelta> first_foreground_time; | 91 const base::Optional<base::TimeDelta> first_foreground_time; | 
| 92 | 92 | 
| 93 // True if the page load started in the foreground. | 93 // True if the page load started in the foreground. | 
| 94 const bool started_in_foreground; | 94 const bool started_in_foreground; | 
| 95 | 95 | 
| 96 // True if this is either a browser initiated navigation or the user_gesture | 96 // True if this is either a browser initiated navigation or the user_gesture | 
| 97 // bit is true in the renderer. | 97 // bit is true in the renderer. | 
| 98 const bool user_gesture; | 98 const bool user_initiated; | 
| 99 | 99 | 
| 100 // Committed URL. If the page load did not commit, |committed_url| will be | 100 // Committed URL. If the page load did not commit, |committed_url| will be | 
| 101 // empty. | 101 // empty. | 
| 102 const GURL committed_url; | 102 const GURL committed_url; | 
| 103 | 103 | 
| 104 // The URL that started the navigation, before redirects. | 104 // The URL that started the navigation, before redirects. | 
| 105 const GURL start_url; | 105 const GURL start_url; | 
| 106 | 106 | 
| 107 // The abort time and time to abort for this page load. If the page was not | 107 // The abort time and time to abort for this page load. If the page was not | 
| 108 // aborted, |abort_type| will be |ABORT_NONE|. | 108 // aborted, |abort_type| will be |ABORT_NONE|. | 
| 109 const UserAbortType abort_type; | 109 const UserAbortType abort_type; | 
| 110 | 110 | 
| 111 // Whether the page load that aborted this page load was user initiated. | |
| 
Charlie Harrison
2016/11/10 22:26:05
nit: Can this comment be more general too?
 
Bryan McQuade
2016/11/10 22:52:50
Sure, I duped the other comment.
 | |
| 111 // TODO(csharrison): If more metadata for aborts is needed we should provide a | 112 // TODO(csharrison): If more metadata for aborts is needed we should provide a | 
| 112 // better abstraction. Note that this is an approximation. | 113 // better abstraction. Note that this is an approximation. | 
| 113 bool abort_user_initiated; | 114 bool abort_user_initiated; | 
| 114 | 115 | 
| 115 const base::Optional<base::TimeDelta> time_to_abort; | 116 const base::Optional<base::TimeDelta> time_to_abort; | 
| 116 | 117 | 
| 117 // Note: these are only approximations, based on WebContents attribution from | 118 // Note: these are only approximations, based on WebContents attribution from | 
| 118 // ResourceRequestInfo objects while this is the currently committed load in | 119 // ResourceRequestInfo objects while this is the currently committed load in | 
| 119 // the WebContents. | 120 // the WebContents. | 
| 120 int num_cache_requests; | 121 int num_cache_requests; | 
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 261 // OnFailedProvisionalLoad is invoked for tracked page loads that did not | 262 // OnFailedProvisionalLoad is invoked for tracked page loads that did not | 
| 262 // commit, immediately before the observer is deleted. | 263 // commit, immediately before the observer is deleted. | 
| 263 virtual void OnFailedProvisionalLoad( | 264 virtual void OnFailedProvisionalLoad( | 
| 264 const FailedProvisionalLoadInfo& failed_provisional_load_info, | 265 const FailedProvisionalLoadInfo& failed_provisional_load_info, | 
| 265 const PageLoadExtraInfo& extra_info) {} | 266 const PageLoadExtraInfo& extra_info) {} | 
| 266 }; | 267 }; | 
| 267 | 268 | 
| 268 } // namespace page_load_metrics | 269 } // namespace page_load_metrics | 
| 269 | 270 | 
| 270 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 271 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 
| OLD | NEW |