Chromium Code Reviews| Index: chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm |
| diff --git a/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm b/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm |
| index 206a1a2dd19efca76aff3a8899a2ef73bbd1cf13..87681d0a57baefc57d2e011b27a731e460bef981 100644 |
| --- a/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm |
| +++ b/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm |
| @@ -14,11 +14,13 @@ |
| #import "chrome/browser/ui/cocoa/history_overlay_controller.h" |
| #import "chrome/browser/ui/cocoa/view_id_util.h" |
| #include "chrome/common/spellcheck_messages.h" |
| +#include "chrome/common/url_constants.h" |
| #include "content/browser/mac/closure_blocks_leopard_compat.h" |
| #include "content/browser/renderer_host/render_view_host.h" |
| #include "content/browser/renderer_host/render_widget_host.h" |
| #include "content/browser/renderer_host/render_widget_host_view.h" |
| #include "content/public/browser/render_view_host_observer.h" |
| +#include "content/public/browser/web_contents.h" |
| // Declare things that are part of the 10.7 SDK. |
| #if !defined(MAC_OS_X_VERSION_10_7) || \ |
| @@ -170,6 +172,20 @@ class SpellCheckRenderViewObserver : public content::RenderViewHostObserver { |
| if (isDevtoolsRwhv) |
| return NO; |
| + // TODO(thakis): This is wrong, as it will navigate the frontmost browser |
| + // for swipe events on background windows. It also navigates the frontmost |
| + // browser for swipes on extensions popups. And it's a dependency problem, |
| + // too. http://crbug.com/102541 |
| + Browser* browser = BrowserList::GetLastActive(); |
| + |
| + if (browser && [NSEvent isSwipeTrackingFromScrollEventsEnabled]) { |
| + content::WebContents* contents = browser->GetSelectedWebContents(); |
| + if (contents && contents->GetURL() == GURL(chrome::kChromeUINewTabURL)) { |
| + // Always do history navigation on the NTP if it's enabled. |
| + gotUnhandledWheelEvent_ = true; |
|
Robert Sesek
2012/01/30 18:09:22
nit: should be YES
Nico
2012/01/30 18:11:22
Yes.
|
| + } |
| + } |
| + |
| if (gotUnhandledWheelEvent_ && |
| [NSEvent isSwipeTrackingFromScrollEventsEnabled] && |
| [theEvent phase] == NSEventPhaseChanged) { |
| @@ -182,7 +198,7 @@ class SpellCheckRenderViewObserver : public content::RenderViewHostObserver { |
| bool isRightScroll = [theEvent scrollingDeltaX] < 0; |
| bool goForward = isRightScroll; |
| bool canGoBack = false, canGoForward = false; |
| - if (Browser* browser = BrowserList::GetLastActive()) { |
| + if (browser) { |
| canGoBack = browser->CanGoBack(); |
| canGoForward = browser->CanGoForward(); |
| } |
| @@ -263,7 +279,7 @@ class SpellCheckRenderViewObserver : public content::RenderViewHostObserver { |
| return YES; |
| } |
| } |
| - return NO; |
| + return gotUnhandledWheelEvent_; |
| } |
| - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item |