Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7436)

Unified Diff: chrome/browser/ui/app_list/search/app_result.cc

Issue 298023009: Remove InstallTracker's extension load, unload observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DCHECK Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/app_list/search/app_result.h ('k') | extensions/browser/extension_registry.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/search/app_result.cc
diff --git a/chrome/browser/ui/app_list/search/app_result.cc b/chrome/browser/ui/app_list/search/app_result.cc
index 2375213f3193746bc0fa347cd1a525e40fb86db8..1c22b2c91616d438f5e7cadbfa7dcf50269aab32 100644
--- a/chrome/browser/ui/app_list/search/app_result.cc
+++ b/chrome/browser/ui/app_list/search/app_result.cc
@@ -6,8 +6,6 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_util.h"
-#include "chrome/browser/extensions/install_tracker.h"
-#include "chrome/browser/extensions/install_tracker_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/app_context_menu.h"
#include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
@@ -16,6 +14,7 @@
#include "chrome/browser/ui/extensions/extension_enable_flow.h"
#include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h"
#include "content/public/browser/user_metrics.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/extension_system_provider.h"
#include "extensions/browser/extensions_browser_client.h"
@@ -34,7 +33,7 @@ AppResult::AppResult(Profile* profile,
: profile_(profile),
app_id_(app_id),
controller_(controller),
- install_tracker_(NULL) {
+ extension_registry_(NULL) {
set_id(extensions::Extension::GetBaseURLFromExtensionId(app_id_).spec());
const extensions::Extension* extension =
@@ -52,11 +51,12 @@ AppResult::AppResult(Profile* profile,
extensions::util::GetDefaultAppIcon(),
this));
UpdateIcon();
- StartObservingInstall();
+
+ StartObservingExtensionRegistry();
}
AppResult::~AppResult() {
- StopObservingInstall();
+ StopObservingExtensionRegistry();
}
void AppResult::UpdateFromMatch(const TokenizedString& title,
@@ -121,18 +121,17 @@ ui::MenuModel* AppResult::GetContextMenuModel() {
return context_menu_->GetMenuModel();
}
-void AppResult::StartObservingInstall() {
- DCHECK(!install_tracker_);
+void AppResult::StartObservingExtensionRegistry() {
+ DCHECK(!extension_registry_);
- install_tracker_ = extensions::InstallTrackerFactory::GetForProfile(profile_);
- install_tracker_->AddObserver(this);
+ extension_registry_ = extensions::ExtensionRegistry::Get(profile_);
+ extension_registry_->AddObserver(this);
}
-void AppResult::StopObservingInstall() {
- if (install_tracker_)
- install_tracker_->RemoveObserver(this);
-
- install_tracker_ = NULL;
+void AppResult::StopObservingExtensionRegistry() {
+ if (extension_registry_)
+ extension_registry_->RemoveObserver(this);
+ extension_registry_ = NULL;
}
bool AppResult::RunExtensionEnableFlow() {
@@ -183,17 +182,22 @@ void AppResult::ExtensionEnableFlowAborted(bool user_initiated) {
controller_->OnCloseChildDialog();
}
-void AppResult::OnExtensionLoaded(const extensions::Extension* extension) {
+void AppResult::OnExtensionLoaded(content::BrowserContext* browser_context,
+ const extensions::Extension* extension) {
UpdateIcon();
}
-void AppResult::OnExtensionUninstalled(const extensions::Extension* extension) {
+void AppResult::OnExtensionUninstalled(content::BrowserContext* browser_context,
+ const extensions::Extension* extension) {
if (extension->id() != app_id_)
return;
NotifyItemUninstalled();
}
-void AppResult::OnShutdown() { StopObservingInstall(); }
+void AppResult::OnShutdown(extensions::ExtensionRegistry* registry) {
+ DCHECK_EQ(extension_registry_, registry);
+ StopObservingExtensionRegistry();
xiyuan 2014/06/04 19:39:43 nit: wrong indent.
+}
} // namespace app_list
« no previous file with comments | « chrome/browser/ui/app_list/search/app_result.h ('k') | extensions/browser/extension_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698