summaryrefslogtreecommitdiff
path: root/ui/base/ui_base_types.cc
blob: e757edb1e6f315acb889834d3773bfaabca63908 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Copyright 2013 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/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