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_PREVIEWS_UKM_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_PREVIEWS_UKM_OBSERVER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/sequence_checker.h" |
| 10 #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h" |
| 11 |
| 12 namespace content { |
| 13 class NavigationHandle; |
| 14 } |
| 15 |
| 16 namespace previews { |
| 17 |
| 18 // Observer responsible for appending previews information to the PLM UKM |
| 19 // report. |
| 20 class PreviewsUKMObserver : public page_load_metrics::PageLoadMetricsObserver { |
| 21 public: |
| 22 PreviewsUKMObserver(); |
| 23 ~PreviewsUKMObserver() override; |
| 24 |
| 25 // page_load_metrics::PageLoadMetricsObserver: |
| 26 ObservePolicy OnStart(content::NavigationHandle* navigation_handle, |
| 27 const GURL& currently_committed_url, |
| 28 bool started_in_foreground) override; |
| 29 ObservePolicy OnCommit(content::NavigationHandle* navigation_handle, |
| 30 ukm::SourceId source_id) override; |
| 31 ObservePolicy FlushMetricsOnAppEnterBackground( |
| 32 const page_load_metrics::mojom::PageLoadTiming& timing, |
| 33 const page_load_metrics::PageLoadExtraInfo& info) override; |
| 34 void OnComplete(const page_load_metrics::mojom::PageLoadTiming& timing, |
| 35 const page_load_metrics::PageLoadExtraInfo& info) override; |
| 36 void OnLoadedResource(const page_load_metrics::ExtraRequestCompleteInfo& |
| 37 extra_request_complete_info) override; |
| 38 void OnEventOccurred(const void* const event_key) override; |
| 39 |
| 40 private: |
| 41 void RecordPreviewsTypes(const page_load_metrics::PageLoadExtraInfo& info); |
| 42 |
| 43 bool server_lofi_seen_ = false; |
| 44 bool client_lofi_seen_ = false; |
| 45 bool lite_page_seen_ = false; |
| 46 bool opt_out_occurred_ = false; |
| 47 |
| 48 SEQUENCE_CHECKER(sequence_checker_); |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(PreviewsUKMObserver); |
| 51 }; |
| 52 |
| 53 } // namespace previews |
| 54 |
| 55 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_PREVIEWS_UKM_OBSERVER_H_ |
OLD | NEW |