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

Side by Side Diff: chrome/browser/page_load_metrics/page_load_metrics_observer.h

Issue 2857963002: Revert "[PageLoadMetrics] Keep track of Ad Sizes on Pages" (Closed)
Patch Set: Created 3 years, 7 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
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_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 <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/optional.h" 12 #include "base/optional.h"
13 #include "chrome/common/page_load_metrics/page_load_timing.h" 13 #include "chrome/common/page_load_metrics/page_load_timing.h"
14 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_data .h" 14 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_data .h"
15 #include "content/public/browser/navigation_handle.h" 15 #include "content/public/browser/navigation_handle.h"
16 #include "content/public/browser/web_contents_observer.h" 16 #include "content/public/browser/web_contents_observer.h"
17 #include "content/public/common/resource_type.h"
18 #include "third_party/WebKit/public/platform/WebInputEvent.h" 17 #include "third_party/WebKit/public/platform/WebInputEvent.h"
19 #include "url/gurl.h" 18 #include "url/gurl.h"
20 19
21 namespace page_load_metrics { 20 namespace page_load_metrics {
22 21
23 // This enum represents how a page load ends. If the action occurs before the 22 // This enum represents how a page load ends. If the action occurs before the
24 // page load finishes (or reaches some point like first paint), then we consider 23 // page load finishes (or reaches some point like first paint), then we consider
25 // the load to be aborted. 24 // the load to be aborted.
26 enum PageEndReason { 25 enum PageEndReason {
27 // Page lifetime has not yet ended (page is still active). 26 // Page lifetime has not yet ended (page is still active).
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 const PageLoadMetadata main_frame_metadata; 194 const PageLoadMetadata main_frame_metadata;
196 195
197 // PageLoadMetadata for child frames of the current page load. 196 // PageLoadMetadata for child frames of the current page load.
198 const PageLoadMetadata child_frame_metadata; 197 const PageLoadMetadata child_frame_metadata;
199 }; 198 };
200 199
201 // Container for various information about a completed request within a page 200 // Container for various information about a completed request within a page
202 // load. 201 // load.
203 struct ExtraRequestCompleteInfo { 202 struct ExtraRequestCompleteInfo {
204 ExtraRequestCompleteInfo( 203 ExtraRequestCompleteInfo(
205 const GURL& url,
206 int frame_tree_node_id,
207 bool was_cached, 204 bool was_cached,
208 int64_t raw_body_bytes, 205 int64_t raw_body_bytes,
209 int64_t original_network_content_length, 206 int64_t original_network_content_length,
210 std::unique_ptr<data_reduction_proxy::DataReductionProxyData> 207 std::unique_ptr<data_reduction_proxy::DataReductionProxyData>
211 data_reduction_proxy_data, 208 data_reduction_proxy_data,
212 content::ResourceType detected_resource_type); 209 content::ResourceType detected_resource_type);
213 210
214 ~ExtraRequestCompleteInfo(); 211 ~ExtraRequestCompleteInfo();
215 212
216 // The URL for the request.
217 const GURL url;
218
219 // The frame tree node id that initiated the request.
220 const int frame_tree_node_id;
221
222 // True if the resource was loaded from cache. 213 // True if the resource was loaded from cache.
223 const bool was_cached; 214 const bool was_cached;
224 215
225 // The number of body (not header) prefilter bytes. 216 // The number of body (not header) prefilter bytes.
226 const int64_t raw_body_bytes; 217 const int64_t raw_body_bytes;
227 218
228 // The number of body (not header) bytes that the data reduction proxy saw 219 // The number of body (not header) bytes that the data reduction proxy saw
229 // before it compressed the requests. 220 // before it compressed the requests.
230 const int64_t original_network_content_length; 221 const int64_t original_network_content_length;
231 222
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 content::NavigationHandle* navigation_handle); 280 content::NavigationHandle* navigation_handle);
290 281
291 // OnCommit is triggered when a page load commits, i.e. when we receive the 282 // OnCommit is triggered when a page load commits, i.e. when we receive the
292 // first data for the request. The navigation handle holds relevant data for 283 // first data for the request. The navigation handle holds relevant data for
293 // the navigation, but will be destroyed soon after this call. Don't hold a 284 // the navigation, but will be destroyed soon after this call. Don't hold a
294 // reference to it. 285 // reference to it.
295 // Observers that return STOP_OBSERVING will not receive any additional 286 // Observers that return STOP_OBSERVING will not receive any additional
296 // callbacks, and will be deleted after invocation of this method returns. 287 // callbacks, and will be deleted after invocation of this method returns.
297 virtual ObservePolicy OnCommit(content::NavigationHandle* navigation_handle); 288 virtual ObservePolicy OnCommit(content::NavigationHandle* navigation_handle);
298 289
299 // OnDidFinishSubFrameNavigation is triggered when a sub-frame of the
300 // committed page has finished navigating. It has either committed, aborted,
301 // was a same document navigation, or has been replaced. It is up to the
302 // observer to query |navigation_handle| to determine which happened. Note
303 // that |navigation_handle| will be destroyed soon after this call. Don't
304 // hold a reference to it.
305 virtual ObservePolicy OnDidFinishSubFrameNavigation(
306 content::NavigationHandle* navigation_handle);
307
308 // OnHidden is triggered when a page leaves the foreground. It does not fire 290 // OnHidden is triggered when a page leaves the foreground. It does not fire
309 // when a foreground page is permanently closed; for that, listen to 291 // when a foreground page is permanently closed; for that, listen to
310 // OnComplete instead. 292 // OnComplete instead.
311 virtual ObservePolicy OnHidden(const PageLoadTiming& timing, 293 virtual ObservePolicy OnHidden(const PageLoadTiming& timing,
312 const PageLoadExtraInfo& extra_info); 294 const PageLoadExtraInfo& extra_info);
313 295
314 // OnShown is triggered when a page is brought to the foreground. It does not 296 // OnShown is triggered when a page is brought to the foreground. It does not
315 // fire when the page first loads; for that, listen for OnStart instead. 297 // fire when the page first loads; for that, listen for OnStart instead.
316 virtual ObservePolicy OnShown(); 298 virtual ObservePolicy OnShown();
317 299
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 // OnFailedProvisionalLoad is invoked for tracked page loads that did not 398 // OnFailedProvisionalLoad is invoked for tracked page loads that did not
417 // commit, immediately before the observer is deleted. 399 // commit, immediately before the observer is deleted.
418 virtual void OnFailedProvisionalLoad( 400 virtual void OnFailedProvisionalLoad(
419 const FailedProvisionalLoadInfo& failed_provisional_load_info, 401 const FailedProvisionalLoadInfo& failed_provisional_load_info,
420 const PageLoadExtraInfo& extra_info) {} 402 const PageLoadExtraInfo& extra_info) {}
421 403
422 // Called whenever a request load begins. 404 // Called whenever a request load begins.
423 virtual void OnStartedResource( 405 virtual void OnStartedResource(
424 const ExtraRequestStartInfo& extra_request_start_info) {} 406 const ExtraRequestStartInfo& extra_request_start_info) {}
425 407
426 // Called whenever a request is loaded for this page load. This comes 408 // Called whenever a request is loaded for this page load.
427 // unfiltered from the ResourceDispatcherHost and may include blob requests
428 // and data uris.
429 virtual void OnLoadedResource( 409 virtual void OnLoadedResource(
430 const ExtraRequestCompleteInfo& extra_request_complete_info) {} 410 const ExtraRequestCompleteInfo& extra_request_complete_info) {}
431 }; 411 };
432 412
433 } // namespace page_load_metrics 413 } // namespace page_load_metrics
434 414
435 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ 415 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698