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

Unified Diff: views/controls/menu/native_menu_win.cc

Issue 6732007: Native menu implementation for bug 5679. Followup to http://codereview.chromium.org/2928005/ Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: More code review updates. Created 9 years, 8 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
« chrome/browser/ui/gtk/menu_gtk.cc ('K') | « views/controls/menu/native_menu_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/menu/native_menu_win.cc
diff --git a/views/controls/menu/native_menu_win.cc b/views/controls/menu/native_menu_win.cc
index b9c78a1617a2fec961b97e9d7f2bcbc60f2b6d0f..19f32eec16b1e36b25a7ce613ccc8e7a317d93f9 100644
--- a/views/controls/menu/native_menu_win.cc
+++ b/views/controls/menu/native_menu_win.cc
@@ -5,6 +5,7 @@
#include "views/controls/menu/native_menu_win.h"
#include "base/logging.h"
+#include "base/message_loop.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
#include "base/win/wrapped_window_proc.h"
@@ -340,12 +341,18 @@ void NativeMenuWin::RunMenuAt(const gfx::Point& point, int alignment) {
// opening of the menu.
listeners_called_ = false;
+ // Retrieving favicons from history requires nestable tasks.
+ MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
+
+ model_->SetMenuModelDelegate(this);
+
// Command dispatch is done through WM_MENUCOMMAND, handled by the host
// window.
HWND hwnd = host_window_->hwnd();
TrackPopupMenuEx(menu_, flags, point.x(), point.y(), host_window_->hwnd(),
NULL);
+ model_->SetMenuModelDelegate(NULL);
UnhookWindowsHookEx(hhook);
open_native_menu_win_ = NULL;
}
@@ -416,6 +423,15 @@ void NativeMenuWin::SetMinimumWidth(int width) {
NOTIMPLEMENTED();
}
+void NativeMenuWin::OnIconChanged(int model_index) {
+ // Translate the model_index to the menu_index.
+ int first_item_index_ = model_->GetFirstItemIndex(GetNativeMenu());
+ int menu_index = model_index + first_item_index_;
+ // Unfortunately this repaints the entire menu.
+ SetMenuItemState(menu_index, model_->IsEnabledAt(model_index),
+ model_->IsItemCheckedAt(model_index), false);
+}
+
////////////////////////////////////////////////////////////////////////////////
// NativeMenuWin, private:
« chrome/browser/ui/gtk/menu_gtk.cc ('K') | « views/controls/menu/native_menu_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698