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

Side by Side Diff: chrome/browser/ui/gtk/menu_gtk.cc

Issue 6893046: added CTRL+Click and SHIFT+Click handler for context menu, Back and Forward. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: make this patch applicable to the latest trunk Created 9 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/gtk/menu_gtk.h" 5 #include "chrome/browser/ui/gtk/menu_gtk.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/stl_util-inl.h" 12 #include "base/stl_util-inl.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/app/chrome_command_ids.h" 14 #include "chrome/app/chrome_command_ids.h"
15 #include "chrome/browser/ui/gtk/gtk_custom_menu.h" 15 #include "chrome/browser/ui/gtk/gtk_custom_menu.h"
16 #include "chrome/browser/ui/gtk/gtk_custom_menu_item.h" 16 #include "chrome/browser/ui/gtk/gtk_custom_menu_item.h"
17 #include "chrome/browser/ui/gtk/gtk_util.h" 17 #include "chrome/browser/ui/gtk/gtk_util.h"
18 #include "third_party/skia/include/core/SkBitmap.h" 18 #include "third_party/skia/include/core/SkBitmap.h"
19 #include "ui/base/models/accelerator_gtk.h" 19 #include "ui/base/models/accelerator_gtk.h"
20 #include "ui/base/models/button_menu_item_model.h" 20 #include "ui/base/models/button_menu_item_model.h"
21 #include "ui/base/models/menu_model.h" 21 #include "ui/base/models/menu_model.h"
22 #include "ui/gfx/gtk_util.h" 22 #include "ui/gfx/gtk_util.h"
23 #include "webkit/glue/window_open_disposition.h" 23 #include "views/events/event.h"
24 24
25 bool MenuGtk::block_activation_ = false; 25 bool MenuGtk::block_activation_ = false;
26 26
27 namespace { 27 namespace {
28 28
29 // Sets the ID of a menu item. 29 // Sets the ID of a menu item.
30 void SetMenuItemID(GtkWidget* menu_item, int menu_id) { 30 void SetMenuItemID(GtkWidget* menu_item, int menu_id) {
31 DCHECK_GE(menu_id, 0); 31 DCHECK_GE(menu_id, 0);
32 32
33 // Add 1 to the menu_id to avoid setting zero (null) to "menu-id". 33 // Add 1 to the menu_id to avoid setting zero (null) to "menu-id".
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 700
701 *y = CalculateMenuYPosition(&screen_rect, &menu_req, NULL, *y); 701 *y = CalculateMenuYPosition(&screen_rect, &menu_req, NULL, *y);
702 } 702 }
703 703
704 void MenuGtk::ExecuteCommand(ui::MenuModel* model, int id) { 704 void MenuGtk::ExecuteCommand(ui::MenuModel* model, int id) {
705 if (delegate_) 705 if (delegate_)
706 delegate_->CommandWillBeExecuted(); 706 delegate_->CommandWillBeExecuted();
707 707
708 GdkEvent* event = gtk_get_current_event(); 708 GdkEvent* event = gtk_get_current_event();
709 if (event && event->type == GDK_BUTTON_RELEASE) { 709 if (event && event->type == GDK_BUTTON_RELEASE) {
710 model->ActivatedAtWithDisposition( 710 int flags = event_utils::GetEventFlagsFromGdkState(event->button.state);
711 id, event_utils::DispositionFromEventFlags(event->button.state)); 711 model->ActivatedAtWithFlags(id, flags);
712 } else { 712 } else {
713 model->ActivatedAt(id); 713 model->ActivatedAt(id);
714 } 714 }
715 715
716 if (event) 716 if (event)
717 gdk_event_free(event); 717 gdk_event_free(event);
718 } 718 }
719 719
720 void MenuGtk::OnMenuShow(GtkWidget* widget) { 720 void MenuGtk::OnMenuShow(GtkWidget* widget) {
721 model_->MenuWillShow(); 721 model_->MenuWillShow();
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 gtk_widget_hide(widget); 824 gtk_widget_hide(widget);
825 } 825 }
826 826
827 GtkWidget* submenu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(widget)); 827 GtkWidget* submenu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(widget));
828 if (submenu) { 828 if (submenu) {
829 gtk_container_foreach(GTK_CONTAINER(submenu), &SetMenuItemInfo, 829 gtk_container_foreach(GTK_CONTAINER(submenu), &SetMenuItemInfo,
830 userdata); 830 userdata);
831 } 831 }
832 } 832 }
833 } 833 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/gtk_util.cc ('k') | chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698