ui_base_types.cc 582 B

1234567891011121314151617181920
  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. #include "ui/base/ui_base_types.h"
  5. #include "ui/events/event.h"
  6. namespace ui {
  7. MenuSourceType GetMenuSourceTypeForEvent(const ui::Event& event) {
  8. ui::MenuSourceType source_type = ui::MENU_SOURCE_MOUSE;
  9. if (event.IsKeyEvent())
  10. source_type = ui::MENU_SOURCE_KEYBOARD;
  11. if (event.IsTouchEvent() || event.IsGestureEvent())
  12. source_type = ui::MENU_SOURCE_TOUCH;
  13. return source_type;
  14. }
  15. } // namespace ui