| 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 "ui/base/accessibility/accessibility_types.h" | 15 #include "ui/base/accessibility/accessibility_types.h" |
| 16 #include "ui/base/accessibility/accessible_view_state.h" | 16 #include "ui/base/accessibility/accessible_view_state.h" |
| 17 #include "ui/events/event.h" | 17 #include "ui/events/event.h" |
| 18 #include "ui/views/accessibility/native_view_accessibility.h" | 18 #include "ui/views/accessibility/native_view_accessibility.h" |
| 19 #include "ui/views/controls/native/native_view_host.h" | |
| 20 #include "ui/views/focus/focus_manager.h" | 19 #include "ui/views/focus/focus_manager.h" |
| 21 #include "ui/views/views_delegate.h" | 20 #include "ui/views/views_delegate.h" |
| 22 | 21 |
| 23 namespace views { | 22 namespace views { |
| 24 | 23 |
| 25 // static | 24 // static |
| 26 const char WebView::kViewClassName[] = "WebView"; | 25 const char WebView::kViewClassName[] = "WebView"; |
| 27 | 26 |
| 28 //////////////////////////////////////////////////////////////////////////////// | 27 //////////////////////////////////////////////////////////////////////////////// |
| 29 // WebView, public: | 28 // WebView, public: |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 void WebView::LoadInitialURL(const GURL& url) { | 90 void WebView::LoadInitialURL(const GURL& url) { |
| 92 GetWebContents()->GetController().LoadURL( | 91 GetWebContents()->GetController().LoadURL( |
| 93 url, content::Referrer(), content::PAGE_TRANSITION_AUTO_TOPLEVEL, | 92 url, content::Referrer(), content::PAGE_TRANSITION_AUTO_TOPLEVEL, |
| 94 std::string()); | 93 std::string()); |
| 95 } | 94 } |
| 96 | 95 |
| 97 void WebView::SetFastResize(bool fast_resize) { | 96 void WebView::SetFastResize(bool fast_resize) { |
| 98 wcv_holder_->set_fast_resize(fast_resize); | 97 wcv_holder_->set_fast_resize(fast_resize); |
| 99 } | 98 } |
| 100 | 99 |
| 100 void WebView::SetFastResizeGravity(NativeViewHost::Gravity gravity) { |
| 101 wcv_holder_->set_fast_resize_gravity(gravity); |
| 102 } |
| 103 |
| 101 void WebView::OnWebContentsFocused(content::WebContents* web_contents) { | 104 void WebView::OnWebContentsFocused(content::WebContents* web_contents) { |
| 102 FocusManager* focus_manager = GetFocusManager(); | 105 FocusManager* focus_manager = GetFocusManager(); |
| 103 if (focus_manager) | 106 if (focus_manager) |
| 104 focus_manager->SetFocusedView(this); | 107 focus_manager->SetFocusedView(this); |
| 105 } | 108 } |
| 106 | 109 |
| 107 void WebView::SetPreferredSize(const gfx::Size& preferred_size) { | 110 void WebView::SetPreferredSize(const gfx::Size& preferred_size) { |
| 108 preferred_size_ = preferred_size; | 111 preferred_size_ = preferred_size; |
| 109 PreferredSizeChanged(); | 112 PreferredSizeChanged(); |
| 110 } | 113 } |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 if (!contents) { | 303 if (!contents) { |
| 301 content::WebContents::CreateParams create_params( | 304 content::WebContents::CreateParams create_params( |
| 302 browser_context, site_instance); | 305 browser_context, site_instance); |
| 303 return content::WebContents::Create(create_params); | 306 return content::WebContents::Create(create_params); |
| 304 } | 307 } |
| 305 | 308 |
| 306 return contents; | 309 return contents; |
| 307 } | 310 } |
| 308 | 311 |
| 309 } // namespace views | 312 } // namespace views |
| OLD | NEW |