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

Unified Diff: chrome/browser/ui/views/wrench_menu.cc

Issue 8201006: Views: Rebuild wrench menu if error is added or removed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years, 2 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
« no previous file with comments | « chrome/browser/ui/views/wrench_menu.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/wrench_menu.cc
===================================================================
--- chrome/browser/ui/views/wrench_menu.cc (revision 104036)
+++ chrome/browser/ui/views/wrench_menu.cc (working copy)
@@ -14,6 +14,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h"
+#include "chrome/common/chrome_notification_types.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/user_metrics.h"
#include "content/common/content_notification_types.h"
@@ -568,6 +569,8 @@
selected_index_(0),
bookmark_menu_(NULL),
first_bookmark_command_id_(0) {
+ registrar_.Add(this, chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED,
+ Source<Profile>(browser_->profile()));
}
WrenchMenu::~WrenchMenu() {
@@ -769,6 +772,21 @@
root_->Cancel();
}
+
+void WrenchMenu::Observe(int type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ switch (type) {
+ case chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED:
+ // A change in the global errors list can add or remove items from the
+ // menu. Close the menu to avoid have a stale menu on-screen.
+ root_->Cancel();
+ break;
+ default:
+ NOTREACHED();
+ }
+}
+
void WrenchMenu::PopulateMenu(MenuItemView* parent,
MenuModel* model,
int* next_id) {
« no previous file with comments | « chrome/browser/ui/views/wrench_menu.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698