| 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 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1279 FOR_EACH_OBSERVER(WebContentsObserver, | 1279 FOR_EACH_OBSERVER(WebContentsObserver, |
| 1280 observers_, | 1280 observers_, |
| 1281 DidDestroyFullscreenWidget( | 1281 DidDestroyFullscreenWidget( |
| 1282 fullscreen_widget_routing_id_)); | 1282 fullscreen_widget_routing_id_)); |
| 1283 fullscreen_widget_routing_id_ = MSG_ROUTING_NONE; | 1283 fullscreen_widget_routing_id_ = MSG_ROUTING_NONE; |
| 1284 if (fullscreen_widget_had_focus_at_shutdown_) | 1284 if (fullscreen_widget_had_focus_at_shutdown_) |
| 1285 view_->RestoreFocus(); | 1285 view_->RestoreFocus(); |
| 1286 } | 1286 } |
| 1287 } | 1287 } |
| 1288 | 1288 |
| 1289 void WebContentsImpl::RenderWidgetGotFocus( |
| 1290 RenderWidgetHostImpl* render_widget_host) { |
| 1291 // Notify the delegate if an embedded fullscreen widget was focused. |
| 1292 if (delegate_ && render_widget_host && |
| 1293 delegate_->EmbedsFullscreenWidget() && |
| 1294 render_widget_host->GetView() == GetFullscreenRenderWidgetHostView()) |
| 1295 delegate_->WebContentsFocused(this); |
| 1296 } |
| 1297 |
| 1289 bool WebContentsImpl::PreHandleKeyboardEvent( | 1298 bool WebContentsImpl::PreHandleKeyboardEvent( |
| 1290 const NativeWebKeyboardEvent& event, | 1299 const NativeWebKeyboardEvent& event, |
| 1291 bool* is_keyboard_shortcut) { | 1300 bool* is_keyboard_shortcut) { |
| 1292 return delegate_ && | 1301 return delegate_ && |
| 1293 delegate_->PreHandleKeyboardEvent(this, event, is_keyboard_shortcut); | 1302 delegate_->PreHandleKeyboardEvent(this, event, is_keyboard_shortcut); |
| 1294 } | 1303 } |
| 1295 | 1304 |
| 1296 void WebContentsImpl::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 1305 void WebContentsImpl::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { |
| 1297 if (browser_plugin_embedder_ && | 1306 if (browser_plugin_embedder_ && |
| 1298 browser_plugin_embedder_->HandleKeyboardEvent(event)) { | 1307 browser_plugin_embedder_->HandleKeyboardEvent(event)) { |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2093 gfx::Rect rv; | 2102 gfx::Rect rv; |
| 2094 view_->GetContainerBounds(&rv); | 2103 view_->GetContainerBounds(&rv); |
| 2095 return rv; | 2104 return rv; |
| 2096 } | 2105 } |
| 2097 | 2106 |
| 2098 DropData* WebContentsImpl::GetDropData() { | 2107 DropData* WebContentsImpl::GetDropData() { |
| 2099 return view_->GetDropData(); | 2108 return view_->GetDropData(); |
| 2100 } | 2109 } |
| 2101 | 2110 |
| 2102 void WebContentsImpl::Focus() { | 2111 void WebContentsImpl::Focus() { |
| 2103 RenderWidgetHostView* const fullscreen_view = | 2112 view_->Focus(); |
| 2104 GetFullscreenRenderWidgetHostView(); | |
| 2105 if (fullscreen_view) | |
| 2106 fullscreen_view->Focus(); | |
| 2107 else | |
| 2108 view_->Focus(); | |
| 2109 } | 2113 } |
| 2110 | 2114 |
| 2111 void WebContentsImpl::SetInitialFocus() { | 2115 void WebContentsImpl::SetInitialFocus() { |
| 2112 RenderWidgetHostView* const fullscreen_view = | 2116 view_->SetInitialFocus(); |
| 2113 GetFullscreenRenderWidgetHostView(); | |
| 2114 if (fullscreen_view) | |
| 2115 fullscreen_view->Focus(); | |
| 2116 else | |
| 2117 view_->SetInitialFocus(); | |
| 2118 } | 2117 } |
| 2119 | 2118 |
| 2120 void WebContentsImpl::StoreFocus() { | 2119 void WebContentsImpl::StoreFocus() { |
| 2121 if (!GetFullscreenRenderWidgetHostView()) | 2120 view_->StoreFocus(); |
| 2122 view_->StoreFocus(); | |
| 2123 } | 2121 } |
| 2124 | 2122 |
| 2125 void WebContentsImpl::RestoreFocus() { | 2123 void WebContentsImpl::RestoreFocus() { |
| 2126 RenderWidgetHostView* const fullscreen_view = | 2124 view_->RestoreFocus(); |
| 2127 GetFullscreenRenderWidgetHostView(); | |
| 2128 if (fullscreen_view) | |
| 2129 fullscreen_view->Focus(); | |
| 2130 else | |
| 2131 view_->RestoreFocus(); | |
| 2132 } | 2125 } |
| 2133 | 2126 |
| 2134 void WebContentsImpl::FocusThroughTabTraversal(bool reverse) { | 2127 void WebContentsImpl::FocusThroughTabTraversal(bool reverse) { |
| 2135 if (ShowingInterstitialPage()) { | 2128 if (ShowingInterstitialPage()) { |
| 2136 GetRenderManager()->interstitial_page()->FocusThroughTabTraversal(reverse); | 2129 GetRenderManager()->interstitial_page()->FocusThroughTabTraversal(reverse); |
| 2137 return; | 2130 return; |
| 2138 } | 2131 } |
| 2139 RenderWidgetHostView* const fullscreen_view = | 2132 RenderWidgetHostView* const fullscreen_view = |
| 2140 GetFullscreenRenderWidgetHostView(); | 2133 GetFullscreenRenderWidgetHostView(); |
| 2141 if (fullscreen_view) { | 2134 if (fullscreen_view) { |
| (...skipping 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4325 node->render_manager()->ResumeResponseDeferredAtStart(); | 4318 node->render_manager()->ResumeResponseDeferredAtStart(); |
| 4326 } | 4319 } |
| 4327 | 4320 |
| 4328 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4321 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4329 force_disable_overscroll_content_ = force_disable; | 4322 force_disable_overscroll_content_ = force_disable; |
| 4330 if (view_) | 4323 if (view_) |
| 4331 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4324 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4332 } | 4325 } |
| 4333 | 4326 |
| 4334 } // namespace content | 4327 } // namespace content |
| OLD | NEW |