• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 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 "chrome/browser/ui/views/event_utils.h"
6 
7 #include "content/browser/disposition_utils.h"
8 #include "views/events/event.h"
9 
10 using views::Event;
11 
12 namespace event_utils {
13 
DispositionFromEventFlags(int event_flags)14 WindowOpenDisposition DispositionFromEventFlags(int event_flags) {
15   return disposition_utils::DispositionFromClick(
16       (event_flags & ui::EF_MIDDLE_BUTTON_DOWN) != 0,
17       (event_flags & ui::EF_ALT_DOWN) != 0,
18       (event_flags & ui::EF_CONTROL_DOWN) != 0,
19       false /* meta_key */,
20       (event_flags & ui::EF_SHIFT_DOWN) != 0);
21 }
22 
IsPossibleDispositionEvent(const views::MouseEvent & event)23 bool IsPossibleDispositionEvent(const views::MouseEvent& event) {
24   return event.IsLeftMouseButton() || event.IsMiddleMouseButton();
25 }
26 
27 }
28