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

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

Issue 516633002: Stop showing page actions in the location bar with redesign enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest CQ for Master 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 85090fb2c62440d9a1882dec8e07c9dc4f4f63d8..488983f53127621b00b3662d8b56da26f9d352b9 100644
--- a/chrome/browser/extensions/location_bar_controller.cc
+++ b/chrome/browser/extensions/location_bar_controller.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/extensions/extension_action_manager.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_registry.h"
+#include "extensions/common/feature_switch.h"
namespace extensions {
@@ -17,9 +18,12 @@ LocationBarController::LocationBarController(
: web_contents_(web_contents),
browser_context_(web_contents->GetBrowserContext()),
action_manager_(ExtensionActionManager::Get(browser_context_)),
+ should_show_page_actions_(
+ !FeatureSwitch::extension_action_redesign()->IsEnabled()),
active_script_controller_(new ActiveScriptController(web_contents_)),
extension_registry_observer_(this) {
- extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context_));
+ if (should_show_page_actions_)
+ extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context_));
}
LocationBarController::~LocationBarController() {
@@ -29,6 +33,9 @@ std::vector<ExtensionAction*> LocationBarController::GetCurrentActions() {
const ExtensionSet& extensions =
ExtensionRegistry::Get(browser_context_)->enabled_extensions();
std::vector<ExtensionAction*> current_actions;
+ if (!should_show_page_actions_)
+ return current_actions;
+
for (ExtensionSet::const_iterator iter = extensions.begin();
iter != extensions.end();
++iter) {
@@ -59,16 +66,7 @@ void LocationBarController::OnExtensionUnloaded(
content::BrowserContext* browser_context,
const Extension* extension,
UnloadedExtensionInfo::Reason reason) {
- bool should_update = false;
- if (action_manager_->GetPageAction(*extension))
- should_update = true;
-
- if (active_script_controller_->GetActionForExtension(extension)) {
- active_script_controller_->OnExtensionUnloaded(extension);
- should_update = true;
- }
-
- if (should_update) {
+ if (action_manager_->GetPageAction(*extension)) {
ExtensionActionAPI::Get(browser_context)->
NotifyPageActionsChanged(web_contents_);
}
« no previous file with comments | « chrome/browser/extensions/location_bar_controller.h ('k') | chrome/browser/extensions/page_action_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698