| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #import "chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegat
e.h" | 5 #import "chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegat
e.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #include "chrome/browser/debugger/devtools_window.h" |
| 10 #include "chrome/browser/spellchecker/spellchecker_platform_engine.h" | 11 #include "chrome/browser/spellchecker/spellchecker_platform_engine.h" |
| 11 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_list.h" | 13 #include "chrome/browser/ui/browser_list.h" |
| 13 #import "chrome/browser/ui/cocoa/history_overlay_controller.h" | 14 #import "chrome/browser/ui/cocoa/history_overlay_controller.h" |
| 14 #import "chrome/browser/ui/cocoa/view_id_util.h" | 15 #import "chrome/browser/ui/cocoa/view_id_util.h" |
| 15 #include "chrome/common/spellcheck_messages.h" | 16 #include "chrome/common/spellcheck_messages.h" |
| 16 #include "content/browser/debugger/devtools_client_host.h" | |
| 17 #include "content/browser/mac/closure_blocks_leopard_compat.h" | 17 #include "content/browser/mac/closure_blocks_leopard_compat.h" |
| 18 #include "content/browser/renderer_host/render_view_host.h" | 18 #include "content/browser/renderer_host/render_view_host.h" |
| 19 #include "content/browser/renderer_host/render_view_host_observer.h" | 19 #include "content/browser/renderer_host/render_view_host_observer.h" |
| 20 #include "content/browser/renderer_host/render_widget_host.h" | 20 #include "content/browser/renderer_host/render_widget_host.h" |
| 21 #include "content/browser/renderer_host/render_widget_host_view.h" | 21 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 22 | 22 |
| 23 // Declare things that are part of the 10.7 SDK. | 23 // Declare things that are part of the 10.7 SDK. |
| 24 #if !defined(MAC_OS_X_VERSION_10_7) || \ | 24 #if !defined(MAC_OS_X_VERSION_10_7) || \ |
| 25 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 | 25 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 |
| 26 enum { | 26 enum { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 // Scroll events always go to the web first, and can only trigger history | 159 // Scroll events always go to the web first, and can only trigger history |
| 160 // swiping if they come back unhandled. | 160 // swiping if they come back unhandled. |
| 161 if ([theEvent phase] == NSEventPhaseBegan) { | 161 if ([theEvent phase] == NSEventPhaseBegan) { |
| 162 totalScrollDelta_ = NSZeroSize; | 162 totalScrollDelta_ = NSZeroSize; |
| 163 gotUnhandledWheelEvent_ = false; | 163 gotUnhandledWheelEvent_ = false; |
| 164 } | 164 } |
| 165 | 165 |
| 166 if (!render_widget_host_ || !render_widget_host_->IsRenderView()) | 166 if (!render_widget_host_ || !render_widget_host_->IsRenderView()) |
| 167 return NO; | 167 return NO; |
| 168 bool isDevtoolsRwhv = DevToolsClientHost::FindOwnerClientHost( | 168 bool isDevtoolsRwhv = DevToolsWindow::IsDevToolsWindow( |
| 169 static_cast<RenderViewHost*>(render_widget_host_)) != NULL; | 169 static_cast<RenderViewHost*>(render_widget_host_)); |
| 170 if (isDevtoolsRwhv) | 170 if (isDevtoolsRwhv) |
| 171 return NO; | 171 return NO; |
| 172 | 172 |
| 173 if (gotUnhandledWheelEvent_ && | 173 if (gotUnhandledWheelEvent_ && |
| 174 [NSEvent isSwipeTrackingFromScrollEventsEnabled] && | 174 [NSEvent isSwipeTrackingFromScrollEventsEnabled] && |
| 175 [theEvent phase] == NSEventPhaseChanged) { | 175 [theEvent phase] == NSEventPhaseChanged) { |
| 176 totalScrollDelta_.width += [theEvent scrollingDeltaX]; | 176 totalScrollDelta_.width += [theEvent scrollingDeltaX]; |
| 177 totalScrollDelta_.height += [theEvent scrollingDeltaY]; | 177 totalScrollDelta_.height += [theEvent scrollingDeltaY]; |
| 178 | 178 |
| 179 bool isHorizontalGesture = | 179 bool isHorizontalGesture = |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 } | 328 } |
| 329 | 329 |
| 330 - (void)spellCheckEnabled:(BOOL)enabled checked:(BOOL)checked { | 330 - (void)spellCheckEnabled:(BOOL)enabled checked:(BOOL)checked { |
| 331 spellcheck_enabled_ = enabled; | 331 spellcheck_enabled_ = enabled; |
| 332 spellcheck_checked_ = checked; | 332 spellcheck_checked_ = checked; |
| 333 } | 333 } |
| 334 | 334 |
| 335 // END Spellchecking methods | 335 // END Spellchecking methods |
| 336 | 336 |
| 337 @end | 337 @end |
| OLD | NEW |