| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_MEDIA_PAGE_LOAD_METRICS_OBSER
VER_H_ |
| 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_MEDIA_PAGE_LOAD_METRICS_OBSER
VER_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h" |
| 12 #include "content/public/browser/web_contents_observer.h" |
| 13 |
| 14 namespace page_load_metrics { |
| 15 struct PageLoadExtraInfo; |
| 16 struct PageLoadTiming; |
| 17 } |
| 18 |
| 19 // Observer responsible for recording metrics on pages that play at least one |
| 20 // MEDIA request. |
| 21 class MediaPageLoadMetricsObserver |
| 22 : public page_load_metrics::PageLoadMetricsObserver { |
| 23 public: |
| 24 MediaPageLoadMetricsObserver(); |
| 25 ~MediaPageLoadMetricsObserver() override; |
| 26 |
| 27 // page_load_metrics::PageLoadMetricsObserver: |
| 28 void OnComplete(const page_load_metrics::PageLoadTiming& timing, |
| 29 const page_load_metrics::PageLoadExtraInfo& info) override; |
| 30 page_load_metrics::PageLoadMetricsObserver::ObservePolicy |
| 31 FlushMetricsOnAppEnterBackground( |
| 32 const page_load_metrics::PageLoadTiming& timing, |
| 33 const page_load_metrics::PageLoadExtraInfo& info) override; |
| 34 void OnLoadedResource( |
| 35 const page_load_metrics::ExtraRequestInfo& extra_request_info) override; |
| 36 void MediaStartedPlaying( |
| 37 const content::WebContentsObserver::MediaPlayerInfo& video_type, |
| 38 bool is_in_main_frame) override; |
| 39 |
| 40 private: |
| 41 // Records histograms for byte information. |
| 42 void RecordByteHistograms(); |
| 43 |
| 44 // The number of body (not header) prefilter bytes consumed by requests for |
| 45 // the page. |
| 46 int64_t cache_bytes_; |
| 47 int64_t network_bytes_; |
| 48 |
| 49 // Whether the page load played a media element. |
| 50 bool played_media_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(MediaPageLoadMetricsObserver); |
| 53 }; |
| 54 |
| 55 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_MEDIA_PAGE_LOAD_METRICS_OB
SERVER_H_ |
| OLD | NEW |