summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/extensions/extension_system_impl.cc22
-rw-r--r--chrome/browser/extensions/extension_system_impl.h5
2 files changed, 27 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_system_impl.cc b/chrome/browser/extensions/extension_system_impl.cc
index 47c8295..af180ba 100644
--- a/chrome/browser/extensions/extension_system_impl.cc
+++ b/chrome/browser/extensions/extension_system_impl.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/extensions/extension_system_impl.h"
+#include <algorithm>
+
#include "base/base_switches.h"
#include "base/bind.h"
#include "base/command_line.h"
@@ -47,7 +49,9 @@
#include "extensions/browser/runtime_data.h"
#include "extensions/browser/service_worker_manager.h"
#include "extensions/browser/state_store.h"
+#include "extensions/browser/uninstall_ping_sender.h"
#include "extensions/common/constants.h"
+#include "extensions/common/manifest_url_handlers.h"
#if defined(ENABLE_NOTIFICATIONS)
#include "chrome/browser/notifications/notifier_state_tracker.h"
@@ -76,6 +80,21 @@ const char kRulesDatabaseUMAClientName[] = "Rules";
namespace extensions {
+namespace {
+
+// Helper to serve as an UninstallPingSender::Filter callback.
+UninstallPingSender::FilterResult ShouldSendUninstallPing(
+ const Extension* extension,
+ UninstallReason reason) {
+ if (extension && (extension->from_webstore() ||
+ ManifestURL::UpdatesFromGallery(extension))) {
+ return UninstallPingSender::SEND_PING;
+ }
+ return UninstallPingSender::DO_NOT_SEND_PING;
+}
+
+} // namespace
+
//
// ExtensionSystemImpl::Shared
//
@@ -161,6 +180,9 @@ void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) {
ExtensionPrefs::Get(profile_), Blacklist::Get(profile_),
autoupdate_enabled, extensions_enabled, &ready_));
+ uninstall_ping_sender_.reset(new UninstallPingSender(
+ ExtensionRegistry::Get(profile_), base::Bind(&ShouldSendUninstallPing)));
+
// These services must be registered before the ExtensionService tries to
// load any extensions.
{
diff --git a/chrome/browser/extensions/extension_system_impl.h b/chrome/browser/extensions/extension_system_impl.h
index 30522b1..bff34f3 100644
--- a/chrome/browser/extensions/extension_system_impl.h
+++ b/chrome/browser/extensions/extension_system_impl.h
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_IMPL_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_IMPL_H_
+#include <string>
+
#include "base/macros.h"
#include "build/build_config.h"
#include "extensions/browser/extension_system.h"
@@ -17,6 +19,7 @@ namespace extensions {
class ExtensionSystemSharedFactory;
class NavigationObserver;
class StateStoreNotificationObserver;
+class UninstallPingSender;
// The ExtensionSystem for ProfileImpl and OffTheRecordProfileImpl.
// Implementation details: non-shared services are owned by
@@ -117,6 +120,8 @@ class ExtensionSystemImpl : public ExtensionSystem {
// For verifying the contents of extensions read from disk.
scoped_refptr<ContentVerifier> content_verifier_;
+ scoped_ptr<UninstallPingSender> uninstall_ping_sender_;
+
#if defined(OS_CHROMEOS)
scoped_ptr<chromeos::DeviceLocalAccountManagementPolicyProvider>
device_local_account_management_policy_provider_;