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

Unified Diff: chrome/browser/extensions/location_bar_controller.cc

Issue 505373002: Remove Extension Loaded/Unloaded notifications from LocationBarView(Mac) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master for cq Created 6 years, 4 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
Index: chrome/browser/extensions/location_bar_controller.cc
diff --git a/chrome/browser/extensions/location_bar_controller.cc b/chrome/browser/extensions/location_bar_controller.cc
index 12ad8dba73f66c676cfc8c47d7dfcc9c53773ace..85090fb2c62440d9a1882dec8e07c9dc4f4f63d8 100644
--- a/chrome/browser/extensions/location_bar_controller.cc
+++ b/chrome/browser/extensions/location_bar_controller.cc
@@ -16,6 +16,7 @@ LocationBarController::LocationBarController(
content::WebContents* web_contents)
: web_contents_(web_contents),
browser_context_(web_contents->GetBrowserContext()),
+ action_manager_(ExtensionActionManager::Get(browser_context_)),
active_script_controller_(new ActiveScriptController(web_contents_)),
extension_registry_observer_(this) {
extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context_));
@@ -27,8 +28,6 @@ LocationBarController::~LocationBarController() {
std::vector<ExtensionAction*> LocationBarController::GetCurrentActions() {
const ExtensionSet& extensions =
ExtensionRegistry::Get(browser_context_)->enabled_extensions();
- ExtensionActionManager* action_manager =
- ExtensionActionManager::Get(browser_context_);
std::vector<ExtensionAction*> current_actions;
for (ExtensionSet::const_iterator iter = extensions.begin();
iter != extensions.end();
@@ -36,7 +35,7 @@ std::vector<ExtensionAction*> LocationBarController::GetCurrentActions() {
// Right now, we can consolidate these actions because we only want to show
// one action per extension. If clicking on an active script action ever
// has a response, then we will need to split the actions.
- ExtensionAction* action = action_manager->GetPageAction(**iter);
+ ExtensionAction* action = action_manager_->GetPageAction(**iter);
if (!action)
action = active_script_controller_->GetActionForExtension(iter->get());
if (action)
@@ -46,12 +45,22 @@ std::vector<ExtensionAction*> LocationBarController::GetCurrentActions() {
return current_actions;
}
+void LocationBarController::OnExtensionLoaded(
+ content::BrowserContext* browser_context,
+ const Extension* extension) {
+ if (action_manager_->GetPageAction(*extension) ||
+ active_script_controller_->GetActionForExtension(extension)) {
+ ExtensionActionAPI::Get(browser_context)->
+ NotifyPageActionsChanged(web_contents_);
+ }
+}
+
void LocationBarController::OnExtensionUnloaded(
content::BrowserContext* browser_context,
const Extension* extension,
UnloadedExtensionInfo::Reason reason) {
bool should_update = false;
- if (ExtensionActionManager::Get(browser_context_)->GetPageAction(*extension))
+ if (action_manager_->GetPageAction(*extension))
should_update = true;
if (active_script_controller_->GetActionForExtension(extension)) {
« no previous file with comments | « chrome/browser/extensions/location_bar_controller.h ('k') | chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698