OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 delegate_->PreHandleKeyboardEvent(this, event, is_keyboard_shortcut); | 1229 delegate_->PreHandleKeyboardEvent(this, event, is_keyboard_shortcut); |
1230 } | 1230 } |
1231 | 1231 |
1232 void WebContentsImpl::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 1232 void WebContentsImpl::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { |
1233 if (delegate_) | 1233 if (delegate_) |
1234 delegate_->HandleKeyboardEvent(this, event); | 1234 delegate_->HandleKeyboardEvent(this, event); |
1235 } | 1235 } |
1236 | 1236 |
1237 bool WebContentsImpl::PreHandleWheelEvent( | 1237 bool WebContentsImpl::PreHandleWheelEvent( |
1238 const WebKit::WebMouseWheelEvent& event) { | 1238 const WebKit::WebMouseWheelEvent& event) { |
| 1239 #if !defined(OS_MACOSX) |
| 1240 // On platforms other than Mac, control+mousewheel changes zoom. On Mac, this |
| 1241 // isn't done for two reasons: |
| 1242 // -the OS already has a gesture to do this through pinch-zoom |
| 1243 // -if a user starts an inertial scroll, let's go, and presses control |
| 1244 // (i.e. control+tab) then the OS's buffered scroll events will come in |
| 1245 // with control key set which isn't what the user wants |
1239 if (delegate_ && | 1246 if (delegate_ && |
1240 event.wheelTicksY && | 1247 event.wheelTicksY && |
1241 (event.modifiers & WebKit::WebInputEvent::ControlKey)) { | 1248 (event.modifiers & WebKit::WebInputEvent::ControlKey)) { |
1242 delegate_->ContentsZoomChange(event.wheelTicksY > 0); | 1249 delegate_->ContentsZoomChange(event.wheelTicksY > 0); |
1243 return true; | 1250 return true; |
1244 } | 1251 } |
| 1252 #endif |
1245 | 1253 |
1246 return false; | 1254 return false; |
1247 } | 1255 } |
1248 | 1256 |
1249 void WebContentsImpl::HandleMouseMove() { | 1257 void WebContentsImpl::HandleMouseMove() { |
1250 if (delegate_) { | 1258 if (delegate_) { |
1251 delegate_->ContentsMouseEvent( | 1259 delegate_->ContentsMouseEvent( |
1252 this, gfx::Screen::GetNativeScreen()->GetCursorScreenPoint(), true); | 1260 this, gfx::Screen::GetNativeScreen()->GetCursorScreenPoint(), true); |
1253 } | 1261 } |
1254 } | 1262 } |
(...skipping 2151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3406 } | 3414 } |
3407 | 3415 |
3408 BrowserPluginGuestManager* | 3416 BrowserPluginGuestManager* |
3409 WebContentsImpl::GetBrowserPluginGuestManager() const { | 3417 WebContentsImpl::GetBrowserPluginGuestManager() const { |
3410 return static_cast<BrowserPluginGuestManager*>( | 3418 return static_cast<BrowserPluginGuestManager*>( |
3411 GetBrowserContext()->GetUserData( | 3419 GetBrowserContext()->GetUserData( |
3412 browser_plugin::kBrowserPluginGuestManagerKeyName)); | 3420 browser_plugin::kBrowserPluginGuestManagerKeyName)); |
3413 } | 3421 } |
3414 | 3422 |
3415 } // namespace content | 3423 } // namespace content |
OLD | NEW |