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 24b5c33d7d6dec07113f07e9916d1a2d1778f214..12ad8dba73f66c676cfc8c47d7dfcc9c53773ace 100644 |
--- a/chrome/browser/extensions/location_bar_controller.cc |
+++ b/chrome/browser/extensions/location_bar_controller.cc |
@@ -4,12 +4,9 @@ |
#include "chrome/browser/extensions/location_bar_controller.h" |
-#include "base/logging.h" |
#include "chrome/browser/extensions/active_script_controller.h" |
#include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
-#include "chrome/browser/extensions/page_action_controller.h" |
-#include "chrome/common/extensions/api/extension_action/action_info.h" |
-#include "content/public/browser/navigation_details.h" |
+#include "chrome/browser/extensions/extension_action_manager.h" |
#include "content/public/browser/web_contents.h" |
#include "extensions/browser/extension_registry.h" |
@@ -17,13 +14,11 @@ namespace extensions { |
LocationBarController::LocationBarController( |
content::WebContents* web_contents) |
- : WebContentsObserver(web_contents), |
- web_contents_(web_contents), |
+ : web_contents_(web_contents), |
+ browser_context_(web_contents->GetBrowserContext()), |
active_script_controller_(new ActiveScriptController(web_contents_)), |
- page_action_controller_(new PageActionController(web_contents_)), |
extension_registry_observer_(this) { |
- extension_registry_observer_.Add( |
- ExtensionRegistry::Get(web_contents_->GetBrowserContext())); |
+ extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context_)); |
} |
LocationBarController::~LocationBarController() { |
@@ -31,8 +26,9 @@ LocationBarController::~LocationBarController() { |
std::vector<ExtensionAction*> LocationBarController::GetCurrentActions() { |
const ExtensionSet& extensions = |
- ExtensionRegistry::Get(web_contents_->GetBrowserContext()) |
- ->enabled_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(); |
@@ -40,8 +36,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 = |
- page_action_controller_->GetActionForExtension(iter->get()); |
+ ExtensionAction* action = action_manager->GetPageAction(**iter); |
if (!action) |
action = active_script_controller_->GetActionForExtension(iter->get()); |
if (action) |
@@ -51,25 +46,14 @@ std::vector<ExtensionAction*> LocationBarController::GetCurrentActions() { |
return current_actions; |
} |
-void LocationBarController::DidNavigateMainFrame( |
- const content::LoadCommittedDetails& details, |
- const content::FrameNavigateParams& params) { |
- if (details.is_in_page) |
- return; |
- |
- page_action_controller_->OnNavigated(); |
- active_script_controller_->OnNavigated(); |
-} |
- |
void LocationBarController::OnExtensionUnloaded( |
content::BrowserContext* browser_context, |
const Extension* extension, |
UnloadedExtensionInfo::Reason reason) { |
bool should_update = false; |
- if (page_action_controller_->GetActionForExtension(extension)) { |
- page_action_controller_->OnExtensionUnloaded(extension); |
+ if (ExtensionActionManager::Get(browser_context_)->GetPageAction(*extension)) |
should_update = true; |
- } |
+ |
if (active_script_controller_->GetActionForExtension(extension)) { |
active_script_controller_->OnExtensionUnloaded(extension); |
should_update = true; |
@@ -77,7 +61,7 @@ void LocationBarController::OnExtensionUnloaded( |
if (should_update) { |
ExtensionActionAPI::Get(browser_context)-> |
- NotifyPageActionsChanged(web_contents()); |
+ NotifyPageActionsChanged(web_contents_); |
} |
} |