| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CHROME_BROWSER_TAB_CONTENTS_ORIGINS_SEEN_SERVICE_H_ | 5 #ifndef COMPONENTS_NAVIGATION_METRICS_ORIGINS_SEEN_SERVICE_H_ |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_ORIGINS_SEEN_SERVICE_H_ | 6 #define COMPONENTS_NAVIGATION_METRICS_ORIGINS_SEEN_SERVICE_H_ |
| 7 | 7 |
| 8 #include "base/containers/mru_cache.h" | 8 #include "base/containers/mru_cache.h" |
| 9 #include "components/keyed_service/core/keyed_service.h" | 9 #include "components/keyed_service/core/keyed_service.h" |
| 10 #include "url/origin.h" | 10 #include "url/origin.h" |
| 11 | 11 |
| 12 namespace navigation_metrics { |
| 13 |
| 12 class OriginsSeenService : public KeyedService { | 14 class OriginsSeenService : public KeyedService { |
| 13 public: | 15 public: |
| 14 OriginsSeenService(); | 16 OriginsSeenService(); |
| 15 ~OriginsSeenService() override; | 17 ~OriginsSeenService() override; |
| 16 | 18 |
| 17 // Used when deciding whether or not to record | 19 // Used when deciding whether or not to record |
| 18 // Navigation.SchemePerUniqueOrigin[OTR]. Inserts a copy of |origin| into the | 20 // Navigation.SchemePerUniqueOrigin[OTR]. Inserts a copy of |origin| into the |
| 19 // set |origins_seen_|, and returns whether or not |origin| was already in the | 21 // set |origins_seen_|, and returns whether or not |origin| was already in the |
| 20 // set. | 22 // set. |
| 21 bool Insert(const url::Origin& origin); | 23 bool Insert(const url::Origin& origin); |
| 22 | 24 |
| 23 private: | 25 private: |
| 24 // Used by |HaveAlreadySeenOrigin|. This cache is in volatile storage because | 26 // Used by |HaveAlreadySeenOrigin|. This cache is in volatile storage because |
| 25 // Off The Record Profiles also use this Service. | 27 // Off The Record Profiles also use this Service. |
| 26 base::MRUCache<url::Origin, bool> origins_seen_; | 28 base::MRUCache<url::Origin, bool> origins_seen_; |
| 27 }; | 29 }; |
| 28 | 30 |
| 29 #endif // CHROME_BROWSER_TAB_CONTENTS_ORIGINS_SEEN_SERVICE_H_ | 31 } // namespace navigation_metrics |
| 32 |
| 33 #endif // COMPONENTS_NAVIGATION_METRICS_ORIGINS_SEEN_SERVICE_H_ |
| OLD | NEW |