Home | History | Annotate | Download | only in base
      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.
      4 
      5 #include "ui/base/ui_base_types.h"
      6 
      7 #include "ui/base/events/event.h"
      8 
      9 namespace ui {
     10 
     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;
     18 }
     19 
     20 }  // namespace ui
     21