| 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 "ui/views/controls/webview/webview.h" | 5 #include "ui/views/controls/webview/webview.h" |
| 6 | 6 |
| 7 #include "content/public/browser/browser_accessibility_state.h" | 7 #include "content/public/browser/browser_accessibility_state.h" |
| 8 #include "content/public/browser/browser_context.h" | 8 #include "content/public/browser/browser_context.h" |
| 9 #include "content/public/browser/navigation_controller.h" | 9 #include "content/public/browser/navigation_controller.h" |
| 10 #include "content/public/browser/render_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
| 11 #include "content/public/browser/render_widget_host_view.h" | 11 #include "content/public/browser/render_widget_host_view.h" |
| 12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 13 #include "content/public/browser/web_contents_view.h" | 13 #include "content/public/browser/web_contents_view.h" |
| 14 #include "ipc/ipc_message.h" | 14 #include "ipc/ipc_message.h" |
| 15 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 15 #include "ui/base/accessibility/accessibility_types.h" | 16 #include "ui/base/accessibility/accessibility_types.h" |
| 16 #include "ui/base/accessibility/accessible_view_state.h" | 17 #include "ui/base/accessibility/accessible_view_state.h" |
| 17 #include "ui/events/event.h" | 18 #include "ui/events/event.h" |
| 18 #include "ui/views/accessibility/native_view_accessibility.h" | 19 #include "ui/views/accessibility/native_view_accessibility.h" |
| 19 #include "ui/views/controls/native/native_view_host.h" | 20 #include "ui/views/controls/native/native_view_host.h" |
| 20 #include "ui/views/focus/focus_manager.h" | 21 #include "ui/views/focus/focus_manager.h" |
| 21 #include "ui/views/views_delegate.h" | 22 #include "ui/views/views_delegate.h" |
| 22 | 23 |
| 23 namespace views { | 24 namespace views { |
| 24 | 25 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 DCHECK(wc_owner_.get()); | 185 DCHECK(wc_owner_.get()); |
| 185 // The WebView is only the delegate of WebContentses it creates itself. | 186 // The WebView is only the delegate of WebContentses it creates itself. |
| 186 OnWebContentsFocused(wc_owner_.get()); | 187 OnWebContentsFocused(wc_owner_.get()); |
| 187 } | 188 } |
| 188 | 189 |
| 189 bool WebView::EmbedsFullscreenWidget() const { | 190 bool WebView::EmbedsFullscreenWidget() const { |
| 190 DCHECK(wc_owner_.get()); | 191 DCHECK(wc_owner_.get()); |
| 191 return embed_fullscreen_widget_mode_enabled_; | 192 return embed_fullscreen_widget_mode_enabled_; |
| 192 } | 193 } |
| 193 | 194 |
| 195 bool WebView::PreHandleGestureEvent( |
| 196 content::WebContents* source, |
| 197 const blink::WebGestureEvent& event) { |
| 198 // Disable pinch zooming. |
| 199 return event.type == blink::WebGestureEvent::GesturePinchBegin || |
| 200 event.type == blink::WebGestureEvent::GesturePinchUpdate || |
| 201 event.type == blink::WebGestureEvent::GesturePinchEnd; |
| 202 } |
| 203 |
| 194 //////////////////////////////////////////////////////////////////////////////// | 204 //////////////////////////////////////////////////////////////////////////////// |
| 195 // WebView, content::WebContentsObserver implementation: | 205 // WebView, content::WebContentsObserver implementation: |
| 196 | 206 |
| 197 void WebView::RenderViewHostChanged(content::RenderViewHost* old_host, | 207 void WebView::RenderViewHostChanged(content::RenderViewHost* old_host, |
| 198 content::RenderViewHost* new_host) { | 208 content::RenderViewHost* new_host) { |
| 199 FocusManager* const focus_manager = GetFocusManager(); | 209 FocusManager* const focus_manager = GetFocusManager(); |
| 200 if (focus_manager && focus_manager->GetFocusedView() == this) | 210 if (focus_manager && focus_manager->GetFocusedView() == this) |
| 201 OnFocus(); | 211 OnFocus(); |
| 202 } | 212 } |
| 203 | 213 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 if (!contents) { | 300 if (!contents) { |
| 291 content::WebContents::CreateParams create_params( | 301 content::WebContents::CreateParams create_params( |
| 292 browser_context, NULL); | 302 browser_context, NULL); |
| 293 return content::WebContents::Create(create_params); | 303 return content::WebContents::Create(create_params); |
| 294 } | 304 } |
| 295 | 305 |
| 296 return contents; | 306 return contents; |
| 297 } | 307 } |
| 298 | 308 |
| 299 } // namespace views | 309 } // namespace views |
| OLD | NEW |