Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: ui/base/window_open_disposition.cc

Issue 2248873002: Convert WindowOpenDisposition to an enum class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/window_open_disposition.h ('k') | ui/keyboard/content/keyboard_ui_content.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/base/window_open_disposition.h" 5 #include "ui/base/window_open_disposition.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "ui/events/event_constants.h" 8 #include "ui/events/event_constants.h"
9 9
10 namespace ui { 10 namespace ui {
11 11
12 WindowOpenDisposition DispositionFromClick(bool middle_button, 12 WindowOpenDisposition DispositionFromClick(bool middle_button,
13 bool alt_key, 13 bool alt_key,
14 bool ctrl_key, 14 bool ctrl_key,
15 bool meta_key, 15 bool meta_key,
16 bool shift_key) { 16 bool shift_key) {
17 // MacOS uses meta key (Command key) to spawn new tabs. 17 // MacOS uses meta key (Command key) to spawn new tabs.
18 #if defined(OS_MACOSX) 18 #if defined(OS_MACOSX)
19 if (middle_button || meta_key) 19 if (middle_button || meta_key)
20 #else 20 #else
21 if (middle_button || ctrl_key) 21 if (middle_button || ctrl_key)
22 #endif 22 #endif
23 return shift_key ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB; 23 return shift_key ? WindowOpenDisposition::NEW_FOREGROUND_TAB
24 : WindowOpenDisposition::NEW_BACKGROUND_TAB;
24 if (shift_key) 25 if (shift_key)
25 return NEW_WINDOW; 26 return WindowOpenDisposition::NEW_WINDOW;
26 if (alt_key) 27 if (alt_key)
27 return SAVE_TO_DISK; 28 return WindowOpenDisposition::SAVE_TO_DISK;
28 return CURRENT_TAB; 29 return WindowOpenDisposition::CURRENT_TAB;
29 } 30 }
30 31
31 WindowOpenDisposition DispositionFromEventFlags(int event_flags) { 32 WindowOpenDisposition DispositionFromEventFlags(int event_flags) {
32 return DispositionFromClick( 33 return DispositionFromClick(
33 (event_flags & ui::EF_MIDDLE_MOUSE_BUTTON) != 0, 34 (event_flags & ui::EF_MIDDLE_MOUSE_BUTTON) != 0,
34 (event_flags & ui::EF_ALT_DOWN) != 0, 35 (event_flags & ui::EF_ALT_DOWN) != 0,
35 (event_flags & ui::EF_CONTROL_DOWN) != 0, 36 (event_flags & ui::EF_CONTROL_DOWN) != 0,
36 (event_flags & ui::EF_COMMAND_DOWN) != 0, 37 (event_flags & ui::EF_COMMAND_DOWN) != 0,
37 (event_flags & ui::EF_SHIFT_DOWN) != 0); 38 (event_flags & ui::EF_SHIFT_DOWN) != 0);
38 } 39 }
39 40
40 } // namespace ui 41 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/window_open_disposition.h ('k') | ui/keyboard/content/keyboard_ui_content.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698