1// Copyright 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#ifndef UI_BASE_WINDOW_OPEN_DISPOSITION_H_
6#define UI_BASE_WINDOW_OPEN_DISPOSITION_H_
7
8#include "ui/base/ui_base_export.h"
9
10// A Java counterpart will be generated for this enum.
11// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.ui
12enum WindowOpenDisposition {
13  UNKNOWN,
14  SUPPRESS_OPEN,
15  CURRENT_TAB,
16  // Indicates that only one tab with the url should exist in the same window.
17  SINGLETON_TAB,
18  NEW_FOREGROUND_TAB,
19  NEW_BACKGROUND_TAB,
20  NEW_POPUP,
21  NEW_WINDOW,
22  SAVE_TO_DISK,
23  OFF_THE_RECORD,
24  IGNORE_ACTION,
25  // Update when adding a new disposition.
26  WINDOW_OPEN_DISPOSITION_LAST = IGNORE_ACTION
27};
28
29namespace ui {
30
31// Translates event flags from a click on a link into the user's desired
32// window disposition.  For example, a middle click would mean to open
33// a background tab.
34UI_BASE_EXPORT WindowOpenDisposition DispositionFromClick(bool middle_button,
35                                                          bool alt_key,
36                                                          bool ctrl_key,
37                                                          bool meta_key,
38                                                          bool shift_key);
39
40// Translates event flags into what kind of disposition they represents.
41// For example, a middle click would mean to open a background tab.
42// event_flags are the flags as understood by ui::MouseEvent.
43UI_BASE_EXPORT WindowOpenDisposition DispositionFromEventFlags(int event_flags);
44
45}  // namespace ui
46
47#endif  // UI_BASE_WINDOW_OPEN_DISPOSITION_H_
48