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 <stdint.h> | |
9 | |
10 #include "base/macros.h" | |
11 #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h" | |
12 | |
13 namespace content { | |
14 class NavigationHandle; | |
15 } | |
16 | |
17 namespace previews { | |
18 | |
19 // This enum should never be re-ordered to keep a consistent set of previews | |
20 // when reading logs. | |
21 enum PreviewsUKMValues { | |
rkaplow
2017/06/27 22:17:09
it's not clear to me why you want to encode this i
RyanSturm
2017/06/28 16:19:35
That approach is what I initially proposed, since
Bryan McQuade
2017/06/28 16:48:18
Yes, I'm totally supportive of switching to separa
RyanSturm
2017/07/11 21:46:40
Done.
| |
22 PREVIEWS_UKM_NONE = 0, | |
23 PREVIEWS_UKM_CLIENT_LOFI = 1, | |
24 PREVIEWS_UKM_SERVER_LOFI = 1 << 1, | |
25 PREVIEWS_UKM_LITE_PAGE = 1 << 2, | |
26 }; | |
27 | |
28 // Observer responsible for appending previews information to the PLM UKM | |
29 // report. | |
30 class PreviewsUKMObserver : public page_load_metrics::PageLoadMetricsObserver { | |
31 public: | |
32 PreviewsUKMObserver(); | |
33 ~PreviewsUKMObserver() override; | |
34 | |
35 // page_load_metrics::PageLoadMetricsObserver: | |
36 ObservePolicy OnStart(content::NavigationHandle* navigation_handle, | |
37 const GURL& currently_committed_url, | |
38 bool started_in_foreground) override; | |
39 ObservePolicy OnCommit(content::NavigationHandle* navigation_handle, | |
40 ukm::SourceId source_id) override; | |
41 ObservePolicy FlushMetricsOnAppEnterBackground( | |
42 const page_load_metrics::mojom::PageLoadTiming& timing, | |
43 const page_load_metrics::PageLoadExtraInfo& info) override; | |
44 void OnComplete(const page_load_metrics::mojom::PageLoadTiming& timing, | |
45 const page_load_metrics::PageLoadExtraInfo& info) override; | |
46 void OnLoadedResource(const page_load_metrics::ExtraRequestCompleteInfo& | |
47 extra_request_complete_info) override; | |
48 | |
49 private: | |
50 void RecordPreviewsTypes(const page_load_metrics::PageLoadExtraInfo& info); | |
51 | |
52 int previews_types_ = PREVIEWS_UKM_NONE; | |
53 | |
54 DISALLOW_COPY_AND_ASSIGN(PreviewsUKMObserver); | |
55 }; | |
56 | |
57 } // namespace previews | |
58 | |
59 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_PREVIEWS_UKM_OBSERVER_H_ | |
OLD | NEW |