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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 void WebContentsImpl::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 1157 void WebContentsImpl::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { |
1158 if (browser_plugin_embedder_ && | 1158 if (browser_plugin_embedder_ && |
1159 browser_plugin_embedder_->HandleKeyboardEvent(event)) { | 1159 browser_plugin_embedder_->HandleKeyboardEvent(event)) { |
1160 return; | 1160 return; |
1161 } | 1161 } |
1162 | 1162 |
1163 if (delegate_) | 1163 if (delegate_) |
1164 delegate_->HandleKeyboardEvent(this, event); | 1164 delegate_->HandleKeyboardEvent(this, event); |
1165 } | 1165 } |
1166 | 1166 |
1167 bool WebContentsImpl::PreHandleWheelEvent( | 1167 bool WebContentsImpl::HandleWheelEvent( |
1168 const blink::WebMouseWheelEvent& event) { | 1168 const blink::WebMouseWheelEvent& event) { |
1169 #if !defined(OS_MACOSX) | 1169 #if !defined(OS_MACOSX) |
1170 // On platforms other than Mac, control+mousewheel changes zoom. On Mac, this | 1170 // On platforms other than Mac, control+mousewheel changes zoom. On Mac, this |
1171 // isn't done for two reasons: | 1171 // isn't done for two reasons: |
1172 // -the OS already has a gesture to do this through pinch-zoom | 1172 // -the OS already has a gesture to do this through pinch-zoom |
1173 // -if a user starts an inertial scroll, let's go, and presses control | 1173 // -if a user starts an inertial scroll, let's go, and presses control |
1174 // (i.e. control+tab) then the OS's buffered scroll events will come in | 1174 // (i.e. control+tab) then the OS's buffered scroll events will come in |
1175 // with control key set which isn't what the user wants | 1175 // with control key set which isn't what the user wants |
1176 if (delegate_ && | 1176 if (delegate_ && |
1177 event.wheelTicksY && | 1177 event.wheelTicksY && |
1178 (event.modifiers & blink::WebInputEvent::ControlKey)) { | 1178 (event.modifiers & blink::WebInputEvent::ControlKey)) { |
1179 delegate_->ContentsZoomChange(event.wheelTicksY > 0); | 1179 delegate_->ContentsZoomChange(event.wheelTicksY > 0); |
1180 return true; | 1180 return true; |
1181 } | 1181 } |
1182 #endif | 1182 #endif |
1183 | |
1184 return false; | 1183 return false; |
1185 } | 1184 } |
1186 | 1185 |
1187 bool WebContentsImpl::PreHandleGestureEvent( | 1186 bool WebContentsImpl::PreHandleGestureEvent( |
1188 const blink::WebGestureEvent& event) { | 1187 const blink::WebGestureEvent& event) { |
1189 return delegate_ && delegate_->PreHandleGestureEvent(this, event); | 1188 return delegate_ && delegate_->PreHandleGestureEvent(this, event); |
1190 } | 1189 } |
1191 | 1190 |
1192 #if defined(OS_WIN) | 1191 #if defined(OS_WIN) |
1193 gfx::NativeViewAccessible WebContentsImpl::GetParentNativeViewAccessible() { | 1192 gfx::NativeViewAccessible WebContentsImpl::GetParentNativeViewAccessible() { |
(...skipping 2450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3644 | 3643 |
3645 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 3644 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
3646 if (!delegate_) | 3645 if (!delegate_) |
3647 return; | 3646 return; |
3648 const gfx::Size new_size = GetPreferredSize(); | 3647 const gfx::Size new_size = GetPreferredSize(); |
3649 if (new_size != old_size) | 3648 if (new_size != old_size) |
3650 delegate_->UpdatePreferredSize(this, new_size); | 3649 delegate_->UpdatePreferredSize(this, new_size); |
3651 } | 3650 } |
3652 | 3651 |
3653 } // namespace content | 3652 } // namespace content |
OLD | NEW |