summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/gtk/gtk_util.cc
diff options
context:
space:
mode:
authorstevenjb@google.com <stevenjb@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-14 23:52:47 +0000
committerstevenjb@google.com <stevenjb@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-14 23:52:47 +0000
commit5713e56f49c7897050ae60affa5701c11b23aeab (patch)
tree35ec555a3f304afc75e73910247fc046002d57db /chrome/browser/ui/gtk/gtk_util.cc
parent30cb0223461f81472988870845626863471310b3 (diff)
downloadchromium_src-5713e56f49c7897050ae60affa5701c11b23aeab.zip
chromium_src-5713e56f49c7897050ae60affa5701c11b23aeab.tar.gz
chromium_src-5713e56f49c7897050ae60affa5701c11b23aeab.tar.bz2
Control-click on an app opens it in a new tab, like clicking a link.
Middle-click does the same. Note that some apps default to opening in a new tab. Also consolidated code to compute window disposition from a click for GTK, Views and DOM UI. BUG=chromium-os:7555 TEST=Install an app that normally loads in the same tab as the new tab page, like Notepad: https://chrome.google.com/webstore/detail/imflbkfmiojnkhopijhajoodloaklbln?hl=en-US# * Click on Notepad. Verify it launches in same tab * Control-click on it. Verify opens in new tab * Middle-click on it. Verify opens in new tab * Right-click, select "Notepad" from menu. Verify launches in same tab * Right-click, set Notepad to launch in new window. Control-click on Notepad. Verify it launches in a new window, and the new tab page is still open. * Also try loading a normal web page, then control-clicking on links, control-shift-clicking on links, and shift-clicking on links. Verify behavior matches last release. Review URL: http://codereview.chromium.org/6293024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74877 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/gtk/gtk_util.cc')
-rw-r--r--chrome/browser/ui/gtk/gtk_util.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/chrome/browser/ui/gtk/gtk_util.cc b/chrome/browser/ui/gtk/gtk_util.cc
index 16ee8d1..92e1aec 100644
--- a/chrome/browser/ui/gtk/gtk_util.cc
+++ b/chrome/browser/ui/gtk/gtk_util.cc
@@ -23,6 +23,7 @@
#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_window.h"
+#include "chrome/browser/disposition_utils.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/tab_contents.h"
@@ -150,14 +151,12 @@ GtkWidget* GetBrowserWindowFocusedWidget(BrowserWindow* window) {
namespace event_utils {
WindowOpenDisposition DispositionFromEventFlags(guint event_flags) {
- if ((event_flags & GDK_BUTTON2_MASK) || (event_flags & GDK_CONTROL_MASK)) {
- return (event_flags & GDK_SHIFT_MASK) ?
- NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB;
- }
-
- if (event_flags & GDK_SHIFT_MASK)
- return NEW_WINDOW;
- return false /*event.IsAltDown()*/ ? SAVE_TO_DISK : CURRENT_TAB;
+ return disposition_utils::DispositionFromClick(
+ event_flags & GDK_BUTTON2_MASK,
+ event_flags & GDK_MOD1_MASK,
+ event_flags & GDK_CONTROL_MASK,
+ event_flags & GDK_META_MASK,
+ event_flags & GDK_SHIFT_MASK);
}
} // namespace event_utils