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