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

Unified Diff: ui/base/ui_base_types.cc

Issue 16979002: Add ContextMenuSourceType to views::ContextMenuController::ShowContextMenuForView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/ui_base_types.h ('k') | ui/message_center/views/message_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/ui_base_types.cc
diff --git a/ui/base/ui_base_types.cc b/ui/base/ui_base_types.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4863c8f4f66772905dd22f3a6d9e86dbcdd21238
--- /dev/null
+++ b/ui/base/ui_base_types.cc
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/base/ui_base_types.h"
+
+#include "ui/base/events/event.h"
+
+namespace ui {
+
+MenuSourceType GetMenuSourceTypeForEvent(const ui::Event& event) {
+ ui::MenuSourceType source_type = ui::MENU_SOURCE_MOUSE;
+ if (event.IsKeyEvent())
+ source_type = ui::MENU_SOURCE_KEYBOARD;
+ if (event.IsTouchEvent() || event.IsGestureEvent())
+ source_type = ui::MENU_SOURCE_TOUCH;
+ return source_type;
+}
+
+} // namespace ui
« no previous file with comments | « ui/base/ui_base_types.h ('k') | ui/message_center/views/message_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698