| 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_HOSTED_APPS_COUNTER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_HOSTED_APPS_COUNTER_H_ |
| 6 #define CHROME_BROWSER_BROWSING_DATA_HOSTED_APPS_COUNTER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_HOSTED_APPS_COUNTER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "chrome/browser/browsing_data/browsing_data_counter.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "components/browsing_data/counters/browsing_data_counter.h" |
| 12 | 13 |
| 13 // A BrowsingDataCounter that returns the number of hosted apps and names | 14 // A BrowsingDataCounter that returns the number of hosted apps and names |
| 14 // of up to two of them as examples. | 15 // of up to two of them as examples. |
| 15 class HostedAppsCounter: public BrowsingDataCounter { | 16 class HostedAppsCounter: public BrowsingDataCounter { |
| 16 public: | 17 public: |
| 17 class HostedAppsResult : public FinishedResult { | 18 class HostedAppsResult : public FinishedResult { |
| 18 public: | 19 public: |
| 19 HostedAppsResult(const HostedAppsCounter* source, | 20 HostedAppsResult(const HostedAppsCounter* source, |
| 20 ResultInt num_apps, | 21 ResultInt num_apps, |
| 21 const std::vector<std::string>& examples); | 22 const std::vector<std::string>& examples); |
| 22 ~HostedAppsResult() override; | 23 ~HostedAppsResult() override; |
| 23 | 24 |
| 24 const std::vector<std::string>& examples() const { return examples_; } | 25 const std::vector<std::string>& examples() const { return examples_; } |
| 25 | 26 |
| 26 private: | 27 private: |
| 27 const std::vector<std::string> examples_; | 28 const std::vector<std::string> examples_; |
| 28 | 29 |
| 29 DISALLOW_COPY_AND_ASSIGN(HostedAppsResult); | 30 DISALLOW_COPY_AND_ASSIGN(HostedAppsResult); |
| 30 }; | 31 }; |
| 31 | 32 |
| 32 HostedAppsCounter(); | 33 explicit HostedAppsCounter(Profile* profile); |
| 33 ~HostedAppsCounter() override; | 34 ~HostedAppsCounter() override; |
| 34 | 35 |
| 35 // BrowsingDataCounter: | |
| 36 const std::string& GetPrefName() const override; | |
| 37 | |
| 38 private: | 36 private: |
| 39 // BrowsingDataCounter: | 37 // BrowsingDataCounter: |
| 40 void Count() override; | 38 void Count() override; |
| 41 | 39 |
| 42 const std::string pref_name_; | 40 Profile* profile_; |
| 43 | 41 |
| 44 DISALLOW_COPY_AND_ASSIGN(HostedAppsCounter); | 42 DISALLOW_COPY_AND_ASSIGN(HostedAppsCounter); |
| 45 }; | 43 }; |
| 46 | 44 |
| 47 #endif // CHROME_BROWSER_BROWSING_DATA_HOSTED_APPS_COUNTER_H_ | 45 #endif // CHROME_BROWSER_BROWSING_DATA_HOSTED_APPS_COUNTER_H_ |
| OLD | NEW |