diff options
author | ericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-01 21:32:47 +0000 |
---|---|---|
committer | ericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-01 21:32:47 +0000 |
commit | 0d2772ecb10500d6bf4be0c3033ab4021dfbf4a3 (patch) | |
tree | cc47266ff06c35dbab8dc413772889fae9b16be8 /webkit/glue/webview_impl.cc | |
parent | fdbdc954056fd81d6291ccaffae45e849596dd18 (diff) | |
download | chromium_src-0d2772ecb10500d6bf4be0c3033ab4021dfbf4a3.zip chromium_src-0d2772ecb10500d6bf4be0c3033ab4021dfbf4a3.tar.gz chromium_src-0d2772ecb10500d6bf4be0c3033ab4021dfbf4a3.tar.bz2 |
yMake ctrl-clicks in GMail open in background tabs rather than foreground tabs.
This piggybacks on eseidel's fix last July that made middle-clicks work.
BUG=2566
TEST=Manual testing on Vista with GMail and non-GMail links, with ctrl+click, middle-click, click, and ctrl+shift+click.
Review URL: http://codereview.chromium.org/246040
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27770 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webview_impl.cc')
-rw-r--r-- | webkit/glue/webview_impl.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index 86cca15..3572d57 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -105,6 +105,7 @@ using WebKit::WebInputEvent; using WebKit::WebKeyboardEvent; using WebKit::WebMouseEvent; using WebKit::WebMouseWheelEvent; +using WebKit::WebNavigationPolicy; using WebKit::WebPoint; using WebKit::WebRect; using WebKit::WebSettings; @@ -1791,6 +1792,36 @@ void WebViewImpl::DidCommitLoad(bool* is_new_navigation) { observed_new_navigation_ = false; } +// static +bool WebViewImpl::NavigationPolicyFromMouseEvent(unsigned short button, + bool ctrl, bool shift, + bool alt, bool meta, + WebNavigationPolicy* policy) { +#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_FREEBSD) + const bool new_tab_modifier = (button == 1) || ctrl; +#elif defined(OS_MACOSX) + const bool new_tab_modifier = (button == 1) || meta; +#endif + if (!new_tab_modifier && !shift && !alt) + return false; + + DCHECK(policy); + if (new_tab_modifier) { + if (shift) { + *policy = WebKit::WebNavigationPolicyNewForegroundTab; + } else { + *policy = WebKit::WebNavigationPolicyNewBackgroundTab; + } + } else { + if (shift) { + *policy = WebKit::WebNavigationPolicyNewWindow; + } else { + *policy = WebKit::WebNavigationPolicyDownload; + } + } + return true; +} + void WebViewImpl::StartDragging(const WebPoint& event_pos, const WebDragData& drag_data, WebDragOperationsMask mask) { |