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

Side by Side Diff: chrome/browser/chromeos/views/native_menu_domui.cc

Issue 3801011: touchui: Directly process key and mouse events. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: nit Created 10 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/chromeos/views/native_menu_domui.h" 5 #include "chrome/browser/chromeos/views/native_menu_domui.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "app/menus/menu_model.h" 9 #include "app/menus/menu_model.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "chrome/browser/browser.h" 12 #include "chrome/browser/browser.h"
13 #include "chrome/browser/browser_list.h" 13 #include "chrome/browser/browser_list.h"
14 #include "chrome/browser/browser_window.h" 14 #include "chrome/browser/browser_window.h"
15 #include "chrome/browser/chromeos/dom_ui/menu_ui.h" 15 #include "chrome/browser/chromeos/dom_ui/menu_ui.h"
16 #include "chrome/browser/chromeos/views/domui_menu_widget.h" 16 #include "chrome/browser/chromeos/views/domui_menu_widget.h"
17 #include "chrome/browser/chromeos/views/menu_locator.h" 17 #include "chrome/browser/chromeos/views/menu_locator.h"
18 #include "chrome/browser/profile_manager.h" 18 #include "chrome/browser/profile_manager.h"
19 #include "chrome/common/url_constants.h" 19 #include "chrome/common/url_constants.h"
20 #include "gfx/rect.h" 20 #include "gfx/rect.h"
21 #include "views/controls/menu/menu_2.h" 21 #include "views/controls/menu/menu_2.h"
22 #include "views/controls/menu/native_menu_gtk.h" 22 #include "views/controls/menu/native_menu_gtk.h"
23 #include "views/controls/menu/nested_dispatcher_gtk.h" 23 #include "views/controls/menu/nested_dispatcher_gtk.h"
24 24
25 #if defined(TOUCH_UI)
26 #include "views/focus/accelerator_handler.h"
27 #endif
28
25 namespace { 29 namespace {
26 30
27 using chromeos::NativeMenuDOMUI; 31 using chromeos::NativeMenuDOMUI;
28 using chromeos::DOMUIMenuWidget; 32 using chromeos::DOMUIMenuWidget;
29 33
30 // Returns true if the menu item type specified can be executed as a command. 34 // Returns true if the menu item type specified can be executed as a command.
31 bool MenuTypeCanExecute(menus::MenuModel::ItemType type) { 35 bool MenuTypeCanExecute(menus::MenuModel::ItemType type) {
32 return type == menus::MenuModel::TYPE_COMMAND || 36 return type == menus::MenuModel::TYPE_COMMAND ||
33 type == menus::MenuModel::TYPE_CHECK || 37 type == menus::MenuModel::TYPE_CHECK ||
34 type == menus::MenuModel::TYPE_RADIO; 38 type == menus::MenuModel::TYPE_RADIO;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 } 241 }
238 break; 242 break;
239 } 243 }
240 default: 244 default:
241 break; 245 break;
242 } 246 }
243 gtk_main_do_event(event); 247 gtk_main_do_event(event);
244 return true; 248 return true;
245 } 249 }
246 250
251 #if defined(TOUCH_UI)
252 bool NativeMenuDOMUI::Dispatch(XEvent* xevent) {
253 return views::DispatchXEvent(xevent);
254 }
255 #endif
256
247 //////////////////////////////////////////////////////////////////////////////// 257 ////////////////////////////////////////////////////////////////////////////////
248 // NativeMenuDOMUI, MenuControl implementation: 258 // NativeMenuDOMUI, MenuControl implementation:
249 259
250 void NativeMenuDOMUI::Activate(menus::MenuModel* model, 260 void NativeMenuDOMUI::Activate(menus::MenuModel* model,
251 int index, 261 int index,
252 ActivationMode activation) { 262 ActivationMode activation) {
253 NativeMenuDOMUI* root = GetRoot(); 263 NativeMenuDOMUI* root = GetRoot();
254 if (root) { 264 if (root) {
255 if (activation == CLOSE_AND_ACTIVATE) { 265 if (activation == CLOSE_AND_ACTIVATE) {
256 root->activated_menu_ = model; 266 root->activated_menu_ = model;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { 404 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) {
395 menus::MenuModel* model = menu->model(); 405 menus::MenuModel* model = menu->model();
396 if (chromeos::MenuUI::IsEnabled()) { 406 if (chromeos::MenuUI::IsEnabled()) {
397 return new chromeos::NativeMenuDOMUI(model, true); 407 return new chromeos::NativeMenuDOMUI(model, true);
398 } else { 408 } else {
399 return new NativeMenuGtk(menu); 409 return new NativeMenuGtk(menu);
400 } 410 }
401 } 411 }
402 412
403 } // namespace views 413 } // namespace views
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/views/native_menu_domui.h ('k') | views/controls/menu/menu_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698