| 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_BROWSING_DATA_MEDIA_LICENSES_COUNTER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_MEDIA_LICENSES_COUNTER_H_ |
| 6 #define CHROME_BROWSER_BROWSING_DATA_MEDIA_LICENSES_COUNTER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_MEDIA_LICENSES_COUNTER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "chrome/browser/browsing_data/browsing_data_counter.h" | 12 #include "components/browsing_data/counters/browsing_data_counter.h" |
| 13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 14 | 14 |
| 15 class Profile; |
| 16 |
| 15 // MediaLicensesCounter is used to determine the number of origins that | 17 // MediaLicensesCounter is used to determine the number of origins that |
| 16 // have plugin private filesystem data (used by EME). It does not include | 18 // have plugin private filesystem data (used by EME). It does not include |
| 17 // origins that have content licenses owned by Flash. | 19 // origins that have content licenses owned by Flash. |
| 18 class MediaLicensesCounter : public BrowsingDataCounter { | 20 class MediaLicensesCounter : public browsing_data::BrowsingDataCounter { |
| 19 public: | 21 public: |
| 20 // MediaLicenseResult is the result of counting the number of origins | 22 // MediaLicenseResult is the result of counting the number of origins |
| 21 // that have plugin private filesystem data. It also contains one of the | 23 // that have plugin private filesystem data. It also contains one of the |
| 22 // origins so that a message can displayed providing an example of the | 24 // origins so that a message can displayed providing an example of the |
| 23 // origins that hold content licenses. | 25 // origins that hold content licenses. |
| 24 class MediaLicenseResult : public FinishedResult { | 26 class MediaLicenseResult : public FinishedResult { |
| 25 public: | 27 public: |
| 26 MediaLicenseResult(const MediaLicensesCounter* source, | 28 MediaLicenseResult(const MediaLicensesCounter* source, |
| 27 const std::set<GURL>& origins); | 29 const std::set<GURL>& origins); |
| 28 ~MediaLicenseResult() override; | 30 ~MediaLicenseResult() override; |
| 29 | 31 |
| 30 const std::string& GetOneOrigin() const; | 32 const std::string& GetOneOrigin() const; |
| 31 | 33 |
| 32 private: | 34 private: |
| 33 std::string one_origin_; | 35 std::string one_origin_; |
| 34 }; | 36 }; |
| 35 | 37 |
| 36 MediaLicensesCounter(); | 38 explicit MediaLicensesCounter(Profile* profile); |
| 37 ~MediaLicensesCounter() override; | 39 ~MediaLicensesCounter() override; |
| 38 | 40 |
| 39 // BrowsingDataCounter implementation. | 41 private: |
| 40 const std::string& GetPrefName() const final; | 42 Profile* profile_; |
| 41 | 43 |
| 42 private: | |
| 43 // BrowsingDataCounter implementation. | 44 // BrowsingDataCounter implementation. |
| 44 void Count() final; | 45 void Count() final; |
| 45 | 46 |
| 46 // Determining the set of origins used by the plugin private filesystem is | 47 // Determining the set of origins used by the plugin private filesystem is |
| 47 // done asynchronously. This callback returns the results, which are | 48 // done asynchronously. This callback returns the results, which are |
| 48 // subsequently reported. | 49 // subsequently reported. |
| 49 void OnContentLicensesObtained(const std::set<GURL>& origins); | 50 void OnContentLicensesObtained(const std::set<GURL>& origins); |
| 50 | 51 |
| 51 const std::string pref_name_; | |
| 52 base::WeakPtrFactory<MediaLicensesCounter> weak_ptr_factory_; | 52 base::WeakPtrFactory<MediaLicensesCounter> weak_ptr_factory_; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 #endif // CHROME_BROWSER_BROWSING_DATA_MEDIA_LICENSES_COUNTER_H_ | 55 #endif // CHROME_BROWSER_BROWSING_DATA_MEDIA_LICENSES_COUNTER_H_ |
| OLD | NEW |