[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / ui / base / window_open_disposition.cc
blobc0d131f4bfc4035d4e30b5be76282f69186cbc1f
1 // Copyright (c) 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.
5 #include "ui/base/window_open_disposition.h"
7 #include "build/build_config.h"
8 #include "ui/events/event_constants.h"
10 namespace ui {
12 WindowOpenDisposition DispositionFromClick(bool middle_button,
13 bool alt_key,
14 bool ctrl_key,
15 bool meta_key,
16 bool shift_key) {
17 // MacOS uses meta key (Command key) to spawn new tabs.
18 #if defined(OS_MACOSX)
19 if (middle_button || meta_key)
20 #else
21 if (middle_button || ctrl_key)
22 #endif
23 return shift_key ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB;
24 if (shift_key)
25 return NEW_WINDOW;
26 if (alt_key)
27 return SAVE_TO_DISK;
28 return CURRENT_TAB;
31 WindowOpenDisposition DispositionFromEventFlags(int event_flags) {
32 return DispositionFromClick(
33 (event_flags & ui::EF_MIDDLE_MOUSE_BUTTON) != 0,
34 (event_flags & ui::EF_ALT_DOWN) != 0,
35 (event_flags & ui::EF_CONTROL_DOWN) != 0,
36 (event_flags & ui::EF_COMMAND_DOWN) != 0,
37 (event_flags & ui::EF_SHIFT_DOWN) != 0);
40 } // namespace ui