Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(328)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 288113005: <webview>: Cleanup Pointer Lock & Simplify HandleKeyboardEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unnecessary braces Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 } 1180 }
1181 1181
1182 bool WebContentsImpl::PreHandleKeyboardEvent( 1182 bool WebContentsImpl::PreHandleKeyboardEvent(
1183 const NativeWebKeyboardEvent& event, 1183 const NativeWebKeyboardEvent& event,
1184 bool* is_keyboard_shortcut) { 1184 bool* is_keyboard_shortcut) {
1185 return delegate_ && 1185 return delegate_ &&
1186 delegate_->PreHandleKeyboardEvent(this, event, is_keyboard_shortcut); 1186 delegate_->PreHandleKeyboardEvent(this, event, is_keyboard_shortcut);
1187 } 1187 }
1188 1188
1189 void WebContentsImpl::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { 1189 void WebContentsImpl::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {
1190 if (browser_plugin_embedder_ &&
1191 browser_plugin_embedder_->HandleKeyboardEvent(event)) {
1192 return;
1193 }
1194
1195 if (delegate_) 1190 if (delegate_)
1196 delegate_->HandleKeyboardEvent(this, event); 1191 delegate_->HandleKeyboardEvent(this, event);
1197 } 1192 }
1198 1193
1199 bool WebContentsImpl::HandleWheelEvent( 1194 bool WebContentsImpl::HandleWheelEvent(
1200 const blink::WebMouseWheelEvent& event) { 1195 const blink::WebMouseWheelEvent& event) {
1201 #if !defined(OS_MACOSX) 1196 #if !defined(OS_MACOSX)
1202 // On platforms other than Mac, control+mousewheel changes zoom. On Mac, this 1197 // On platforms other than Mac, control+mousewheel changes zoom. On Mac, this
1203 // isn't done for two reasons: 1198 // isn't done for two reasons:
1204 // -the OS already has a gesture to do this through pinch-zoom 1199 // -the OS already has a gesture to do this through pinch-zoom
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
2222 2217
2223 int WebContentsImpl::GetMaximumZoomPercent() const { 2218 int WebContentsImpl::GetMaximumZoomPercent() const {
2224 return maximum_zoom_percent_; 2219 return maximum_zoom_percent_;
2225 } 2220 }
2226 2221
2227 gfx::Size WebContentsImpl::GetPreferredSize() const { 2222 gfx::Size WebContentsImpl::GetPreferredSize() const {
2228 return capturer_count_ == 0 ? preferred_size_ : preferred_size_for_capture_; 2223 return capturer_count_ == 0 ? preferred_size_ : preferred_size_for_capture_;
2229 } 2224 }
2230 2225
2231 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { 2226 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) {
2227 if (GetBrowserPluginGuest())
2228 return GetBrowserPluginGuest()->LockMouse(allowed);
2229
2232 return GetRenderViewHost() ? 2230 return GetRenderViewHost() ?
2233 GetRenderViewHostImpl()->GotResponseToLockMouseRequest(allowed) : false; 2231 GetRenderViewHostImpl()->GotResponseToLockMouseRequest(allowed) : false;
2234 } 2232 }
2235 2233
2236 bool WebContentsImpl::HasOpener() const { 2234 bool WebContentsImpl::HasOpener() const {
2237 return opener_ != NULL; 2235 return opener_ != NULL;
2238 } 2236 }
2239 2237
2240 void WebContentsImpl::DidChooseColorInColorChooser(SkColor color) { 2238 void WebContentsImpl::DidChooseColorInColorChooser(SkColor color) {
2241 if (!color_chooser_info_.get()) 2239 if (!color_chooser_info_.get())
(...skipping 1723 matching lines...) Expand 10 before | Expand all | Expand 10 after
3965 3963
3966 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { 3964 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) {
3967 if (!delegate_) 3965 if (!delegate_)
3968 return; 3966 return;
3969 const gfx::Size new_size = GetPreferredSize(); 3967 const gfx::Size new_size = GetPreferredSize();
3970 if (new_size != old_size) 3968 if (new_size != old_size)
3971 delegate_->UpdatePreferredSize(this, new_size); 3969 delegate_->UpdatePreferredSize(this, new_size);
3972 } 3970 }
3973 3971
3974 } // namespace content 3972 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.cc ('k') | content/public/browser/browser_plugin_guest_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698