| 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 #include "chrome/browser/browsing_data/hosted_apps_counter.h" | 5 #include "chrome/browser/browsing_data/hosted_apps_counter.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "components/browsing_data/core/pref_names.h" | 12 #include "components/browsing_data/core/pref_names.h" |
| 13 #include "extensions/browser/extension_registry.h" | 13 #include "extensions/browser/extension_registry.h" |
| 14 #include "extensions/common/extension.h" | 14 #include "extensions/common/extension.h" |
| 15 | 15 |
| 16 HostedAppsCounter::HostedAppsCounter(Profile* profile) | 16 HostedAppsCounter::HostedAppsCounter(Profile* profile) |
| 17 : BrowsingDataCounter(browsing_data::prefs::kDeleteHostedAppsData), | 17 : profile_(profile) {} |
| 18 profile_(profile) {} | |
| 19 | 18 |
| 20 HostedAppsCounter::~HostedAppsCounter() {} | 19 HostedAppsCounter::~HostedAppsCounter() {} |
| 21 | 20 |
| 21 const char* HostedAppsCounter::GetPrefName() const { |
| 22 return browsing_data::prefs::kDeleteHostedAppsData; |
| 23 } |
| 24 |
| 22 void HostedAppsCounter::Count() { | 25 void HostedAppsCounter::Count() { |
| 23 int count = 0; | 26 int count = 0; |
| 24 std::vector<std::string> names; | 27 std::vector<std::string> names; |
| 25 | 28 |
| 26 std::unique_ptr<extensions::ExtensionSet> extensions = | 29 std::unique_ptr<extensions::ExtensionSet> extensions = |
| 27 extensions::ExtensionRegistry::Get(profile_) | 30 extensions::ExtensionRegistry::Get(profile_) |
| 28 ->GenerateInstalledExtensionsSet(); | 31 ->GenerateInstalledExtensionsSet(); |
| 29 | 32 |
| 30 for (const auto& extension : *extensions) { | 33 for (const auto& extension : *extensions) { |
| 31 if (extension->is_hosted_app()) | 34 if (extension->is_hosted_app()) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 43 | 46 |
| 44 // HostedAppsCounter::HostedAppsResult ----------------------------------------- | 47 // HostedAppsCounter::HostedAppsResult ----------------------------------------- |
| 45 | 48 |
| 46 HostedAppsCounter::HostedAppsResult::HostedAppsResult( | 49 HostedAppsCounter::HostedAppsResult::HostedAppsResult( |
| 47 const HostedAppsCounter* source, | 50 const HostedAppsCounter* source, |
| 48 ResultInt num_apps, | 51 ResultInt num_apps, |
| 49 const std::vector<std::string>& examples) | 52 const std::vector<std::string>& examples) |
| 50 : FinishedResult(source, num_apps), examples_(examples) {} | 53 : FinishedResult(source, num_apps), examples_(examples) {} |
| 51 | 54 |
| 52 HostedAppsCounter::HostedAppsResult::~HostedAppsResult() {} | 55 HostedAppsCounter::HostedAppsResult::~HostedAppsResult() {} |
| OLD | NEW |