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

Unified Diff: chrome/browser/extensions/api/extension_action/extension_action_api.cc

Issue 496403003: Remove NOTIFICATION_EXTENSION_PAGE_ACTIONS_UPDATED (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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/api/extension_action/extension_action_api.cc
diff --git a/chrome/browser/extensions/api/extension_action/extension_action_api.cc b/chrome/browser/extensions/api/extension_action/extension_action_api.cc
index 1029c311c2b8241c81458aac374ac6ebc05c366e..7d2637d380229c6bf780556ee011b99b99dba5a4 100644
--- a/chrome/browser/extensions/api/extension_action/extension_action_api.cc
+++ b/chrome/browser/extensions/api/extension_action/extension_action_api.cc
@@ -19,6 +19,9 @@
#include "chrome/browser/extensions/tab_helper.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/session_tab_helper.h"
+#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/location_bar/location_bar.h"
#include "chrome/common/extensions/api/extension_action/action_info.h"
#include "chrome/common/render_messages.h"
#include "content/public/browser/navigation_entry.h"
@@ -398,6 +401,9 @@ void ExtensionActionAPI::NotifyChange(ExtensionAction* extension_action,
Observer,
observers_,
OnExtensionActionUpdated(extension_action, web_contents, context));
+
+ if (extension_action->action_type() == ActionInfo::TYPE_PAGE)
+ NotifyPageActionsChanged(web_contents);
}
void ExtensionActionAPI::ClearAllValuesForTab(
@@ -421,6 +427,22 @@ void ExtensionActionAPI::ClearAllValuesForTab(
NotifyChange(extension_action, web_contents, browser_context);
}
}
+
+ NotifyPageActionsChanged(web_contents);
+}
+
+void ExtensionActionAPI::NotifyPageActionsChanged(
+ content::WebContents* web_contents) {
+ Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
+ if (!browser)
+ return;
+ LocationBar* location_bar =
+ browser->window() ? browser->window()->GetLocationBar() : NULL;
+ if (!location_bar)
+ return;
+ location_bar->UpdatePageActions();
+
+ FOR_EACH_OBSERVER(Observer, observers_, OnPageActionsUpdated(web_contents));
}
void ExtensionActionAPI::Shutdown() {

Powered by Google App Engine
This is Rietveld 408576698