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)) { |