Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / base / ui_base_types.cc
blobe757edb1e6f315acb889834d3773bfaabca63908
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/base/ui_base_types.h"
7 #include "ui/events/event.h"
9 namespace ui {
11 MenuSourceType GetMenuSourceTypeForEvent(const ui::Event& event) {
12 ui::MenuSourceType source_type = ui::MENU_SOURCE_MOUSE;
13 if (event.IsKeyEvent())
14 source_type = ui::MENU_SOURCE_KEYBOARD;
15 if (event.IsTouchEvent() || event.IsGestureEvent())
16 source_type = ui::MENU_SOURCE_TOUCH;
17 return source_type;
20 } // namespace ui