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

Side by Side Diff: views/controls/menu/native_menu_gtk.h

Issue 383012: Fix for issue 27210, show bookmarks bar menu is out of sync with the browser's status. (Closed)
Patch Set: Created 11 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/chromeos/status_area_view.cc ('k') | views/controls/menu/native_menu_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #ifndef VIEWS_CONTROLS_MENU_NATIVE_MENU_GTK_H_ 5 #ifndef VIEWS_CONTROLS_MENU_NATIVE_MENU_GTK_H_
6 #define VIEWS_CONTROLS_MENU_NATIVE_MENU_GTK_H_ 6 #define VIEWS_CONTROLS_MENU_NATIVE_MENU_GTK_H_
7 7
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include "views/controls/menu/menu_wrapper.h" 10 #include "views/controls/menu/menu_wrapper.h"
(...skipping 15 matching lines...) Expand all
26 virtual void Rebuild(); 26 virtual void Rebuild();
27 virtual void UpdateStates(); 27 virtual void UpdateStates();
28 virtual gfx::NativeMenu GetNativeMenu() const; 28 virtual gfx::NativeMenu GetNativeMenu() const;
29 29
30 private: 30 private:
31 static void OnMenuHidden(GtkWidget* widget, NativeMenuGtk* menu); 31 static void OnMenuHidden(GtkWidget* widget, NativeMenuGtk* menu);
32 32
33 void AddSeparatorAt(int index); 33 void AddSeparatorAt(int index);
34 void AddMenuItemAt(int index, GtkRadioMenuItem** last_radio_item); 34 void AddMenuItemAt(int index, GtkRadioMenuItem** last_radio_item);
35 35
36 void ResetMenu();
37
38 // Updates the menu item's state.
39 void UpdateMenuItemState(GtkWidget* menu_item);
40
36 static void UpdateStateCallback(GtkWidget* menu_item, gpointer data); 41 static void UpdateStateCallback(GtkWidget* menu_item, gpointer data);
37 42
38 void ResetMenu();
39
40 // Callback for gtk_menu_popup to position the menu. 43 // Callback for gtk_menu_popup to position the menu.
41 static void MenuPositionFunc(GtkMenu* menu, int* x, int* y, gboolean* push_in, 44 static void MenuPositionFunc(GtkMenu* menu, int* x, int* y, gboolean* push_in,
42 void* data); 45 void* data);
43 46
44 // Event handlers: 47 // Event handlers:
45 void OnActivate(GtkMenuItem* menu_item); 48 void OnActivate(GtkMenuItem* menu_item);
46 49
47 // Gtk signal handlers. 50 // Gtk signal handlers.
48 static void CallActivate(GtkMenuItem* menu_item, NativeMenuGtk* native_menu); 51 static void CallActivate(GtkMenuItem* menu_item, NativeMenuGtk* native_menu);
49 52
50 Menu2Model* model_; 53 Menu2Model* model_;
51 54
52 GtkWidget* menu_; 55 GtkWidget* menu_;
53 56
54 bool menu_shown_; 57 bool menu_shown_;
55 58
59 // A flag used to avoid misfiring ActivateAt call on the menu model.
60 // This is necessary as GTK menu fires an activate signal even when the
61 // state is changed by |UpdateStates()| API.
62 bool suppress_activate_signal_;
63
56 DISALLOW_COPY_AND_ASSIGN(NativeMenuGtk); 64 DISALLOW_COPY_AND_ASSIGN(NativeMenuGtk);
57 }; 65 };
58 66
59 } // namespace views 67 } // namespace views
60 68
61 #endif // VIEWS_CONTROLS_MENU_NATIVE_MENU_GTK_H_ 69 #endif // VIEWS_CONTROLS_MENU_NATIVE_MENU_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/status_area_view.cc ('k') | views/controls/menu/native_menu_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698