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

Unified Diff: ui/base/window_open_disposition.cc

Issue 11896047: Move the methods in disposition_utils.h and event_disposition.h to ui\base\window_open_disposition.… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix regex in ui.gyp Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/window_open_disposition.h ('k') | ui/ui.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/window_open_disposition.cc
===================================================================
--- ui/base/window_open_disposition.cc (revision 0)
+++ ui/base/window_open_disposition.cc (revision 0)
@@ -0,0 +1,40 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/base/window_open_disposition.h"
+
+#include "build/build_config.h"
+#include "ui/base/events/event_constants.h"
+
+namespace ui {
+
+WindowOpenDisposition DispositionFromClick(bool middle_button,
+ bool alt_key,
+ bool ctrl_key,
+ bool meta_key,
+ bool shift_key) {
+ // MacOS uses meta key (Command key) to spawn new tabs.
+#if defined(OS_MACOSX)
+ if (middle_button || meta_key)
+#else
+ if (middle_button || ctrl_key)
+#endif
+ return shift_key ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB;
+ if (shift_key)
+ return NEW_WINDOW;
+ if (alt_key)
+ return SAVE_TO_DISK;
+ return CURRENT_TAB;
+}
+
+WindowOpenDisposition DispositionFromEventFlags(int event_flags) {
+ return DispositionFromClick(
+ (event_flags & ui::EF_MIDDLE_MOUSE_BUTTON) != 0,
+ (event_flags & ui::EF_ALT_DOWN) != 0,
+ (event_flags & ui::EF_CONTROL_DOWN) != 0,
+ (event_flags & ui::EF_COMMAND_DOWN) != 0,
+ (event_flags & ui::EF_SHIFT_DOWN) != 0);
+}
+
+} // namespace ui
Property changes on: ui\base\window_open_disposition.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « ui/base/window_open_disposition.h ('k') | ui/ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698