OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 COMPONENTS_UKM_UKM_SOURCE_H_ | 5 #ifndef COMPONENTS_UKM_UKM_SOURCE_H_ |
6 #define COMPONENTS_UKM_UKM_SOURCE_H_ | 6 #define COMPONENTS_UKM_UKM_SOURCE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
13 | 13 |
14 namespace ukm { | 14 namespace ukm { |
15 | 15 |
16 class Source; | 16 class Source; |
17 | 17 |
18 // Contains UKM data for a single navigation entry. | 18 // Contains UKM data for a single navigation entry. |
19 class UkmSource { | 19 class UkmSource { |
20 public: | 20 public: |
21 UkmSource(); | 21 UkmSource(); |
22 ~UkmSource(); | 22 ~UkmSource(); |
23 | 23 |
24 const GURL& committed_url() const { return committed_url_; } | 24 const GURL& committed_url() const { return committed_url_; } |
25 void set_committed_url(const GURL& committed_url) { | 25 void set_committed_url(const GURL& committed_url) { |
26 committed_url_ = committed_url; | 26 committed_url_ = committed_url; |
27 } | 27 } |
28 | 28 |
29 base::Time navigation_start() const { return navigation_start_; } | |
30 void set_navigation_start(base::Time navigation_start) { | |
31 navigation_start_ = navigation_start; | |
32 } | |
33 | |
34 base::TimeDelta first_contentful_paint() const { | 29 base::TimeDelta first_contentful_paint() const { |
35 return first_contentful_paint_; | 30 return first_contentful_paint_; |
36 } | 31 } |
37 void set_first_contentful_paint(base::TimeDelta first_contentful_paint) { | 32 void set_first_contentful_paint(base::TimeDelta first_contentful_paint) { |
38 first_contentful_paint_ = first_contentful_paint; | 33 first_contentful_paint_ = first_contentful_paint; |
39 } | 34 } |
40 | 35 |
41 // Serializes the members of the class into the supplied proto. | 36 // Serializes the members of the class into the supplied proto. |
42 void PopulateProto(Source* proto_source); | 37 void PopulateProto(Source* proto_source); |
43 | 38 |
44 private: | 39 private: |
45 GURL committed_url_; | 40 GURL committed_url_; |
46 base::Time navigation_start_; | |
47 base::TimeDelta first_contentful_paint_; | 41 base::TimeDelta first_contentful_paint_; |
48 | 42 |
49 DISALLOW_COPY_AND_ASSIGN(UkmSource); | 43 DISALLOW_COPY_AND_ASSIGN(UkmSource); |
50 }; | 44 }; |
51 | 45 |
52 } // namespace ukm | 46 } // namespace ukm |
53 | 47 |
54 #endif // COMPONENTS_UKM_UKM_SOURCE_H_ | 48 #endif // COMPONENTS_UKM_UKM_SOURCE_H_ |
OLD | NEW |