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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 void WebView::LoadInitialURL(const GURL& url) { | 92 void WebView::LoadInitialURL(const GURL& url) { |
94 GetWebContents()->GetController().LoadURL( | 93 GetWebContents()->GetController().LoadURL( |
95 url, content::Referrer(), content::PAGE_TRANSITION_AUTO_TOPLEVEL, | 94 url, content::Referrer(), content::PAGE_TRANSITION_AUTO_TOPLEVEL, |
96 std::string()); | 95 std::string()); |
97 } | 96 } |
98 | 97 |
99 void WebView::SetFastResize(bool fast_resize) { | 98 void WebView::SetFastResize(bool fast_resize) { |
100 wcv_holder_->set_fast_resize(fast_resize); | 99 wcv_holder_->set_fast_resize(fast_resize); |
101 } | 100 } |
102 | 101 |
| 102 void WebView::SetFastResizeGravity(NativeViewHost::Gravity gravity) { |
| 103 wcv_holder_->set_fast_resize_gravity(gravity); |
| 104 } |
| 105 |
103 void WebView::OnWebContentsFocused(content::WebContents* web_contents) { | 106 void WebView::OnWebContentsFocused(content::WebContents* web_contents) { |
104 FocusManager* focus_manager = GetFocusManager(); | 107 FocusManager* focus_manager = GetFocusManager(); |
105 if (focus_manager) | 108 if (focus_manager) |
106 focus_manager->SetFocusedView(this); | 109 focus_manager->SetFocusedView(this); |
107 } | 110 } |
108 | 111 |
109 void WebView::SetPreferredSize(const gfx::Size& preferred_size) { | 112 void WebView::SetPreferredSize(const gfx::Size& preferred_size) { |
110 preferred_size_ = preferred_size; | 113 preferred_size_ = preferred_size; |
111 PreferredSizeChanged(); | 114 PreferredSizeChanged(); |
112 } | 115 } |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 if (!contents) { | 305 if (!contents) { |
303 content::WebContents::CreateParams create_params( | 306 content::WebContents::CreateParams create_params( |
304 browser_context, site_instance); | 307 browser_context, site_instance); |
305 return content::WebContents::Create(create_params); | 308 return content::WebContents::Create(create_params); |
306 } | 309 } |
307 | 310 |
308 return contents; | 311 return contents; |
309 } | 312 } |
310 | 313 |
311 } // namespace views | 314 } // namespace views |
OLD | NEW |