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

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

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

Powered by Google App Engine
This is Rietveld 408576698