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& initial_url() const { return initial_url_; } | |
28 const GURL& url() const { return url_; } | 29 const GURL& url() const { return url_; } |
29 void set_url(const GURL& url) { url_ = url; } | 30 void set_url(const GURL& url) { url_ = url; } |
31 void UpdateUrl(const GURL& url); | |
rkaplow
2017/03/02 18:46:54
can you comment on this (with some init url detail
Bryan McQuade
2017/03/02 22:18:32
Done
| |
30 | 32 |
31 // Serializes the members of the class into the supplied proto. | 33 // Serializes the members of the class into the supplied proto. |
32 void PopulateProto(Source* proto_source) const; | 34 void PopulateProto(Source* proto_source) const; |
33 | 35 |
34 private: | 36 private: |
35 int32_t id_; | 37 int32_t id_; |
38 | |
39 // The final, canonical URL for this source. | |
36 GURL url_; | 40 GURL url_; |
37 | 41 |
42 // The initial URL for this source. Only set if different from |url_| (i.e. if | |
43 // the URL changed over the lifetime of this source). | |
44 GURL initial_url_; | |
45 | |
38 DISALLOW_COPY_AND_ASSIGN(UkmSource); | 46 DISALLOW_COPY_AND_ASSIGN(UkmSource); |
39 }; | 47 }; |
40 | 48 |
41 } // namespace ukm | 49 } // namespace ukm |
42 | 50 |
43 #endif // COMPONENTS_UKM_UKM_SOURCE_H_ | 51 #endif // COMPONENTS_UKM_UKM_SOURCE_H_ |
OLD | NEW |