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 #ifndef UI_VIEWS_CONTROLS_WEBVIEW_WEBVIEW_H_ | 5 #ifndef UI_VIEWS_CONTROLS_WEBVIEW_WEBVIEW_H_ |
6 #define UI_VIEWS_CONTROLS_WEBVIEW_WEBVIEW_H_ | 6 #define UI_VIEWS_CONTROLS_WEBVIEW_WEBVIEW_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "content/public/browser/web_contents_delegate.h" | 10 #include "content/public/browser/web_contents_delegate.h" |
11 #include "content/public/browser/web_contents_observer.h" | 11 #include "content/public/browser/web_contents_observer.h" |
12 #include "ui/views/accessibility/native_view_accessibility.h" | 12 #include "ui/views/accessibility/native_view_accessibility.h" |
| 13 #include "ui/views/controls/native/native_view_host.h" |
13 #include "ui/views/controls/webview/webview_export.h" | 14 #include "ui/views/controls/webview/webview_export.h" |
14 #include "ui/views/view.h" | 15 #include "ui/views/view.h" |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 class SiteInstance; | 18 class SiteInstance; |
18 } | 19 } |
19 | 20 |
20 namespace views { | 21 namespace views { |
21 | 22 |
22 class NativeViewHost; | |
23 | |
24 class WEBVIEW_EXPORT WebView : public View, | 23 class WEBVIEW_EXPORT WebView : public View, |
25 public content::WebContentsDelegate, | 24 public content::WebContentsDelegate, |
26 public content::WebContentsObserver { | 25 public content::WebContentsObserver { |
27 public: | 26 public: |
28 static const char kViewClassName[]; | 27 static const char kViewClassName[]; |
29 | 28 |
30 explicit WebView(content::BrowserContext* browser_context); | 29 explicit WebView(content::BrowserContext* browser_context); |
31 virtual ~WebView(); | 30 virtual ~WebView(); |
32 | 31 |
33 // This creates a WebContents if none is yet associated with this WebView. The | 32 // This creates a WebContents if none is yet associated with this WebView. The |
(...skipping 27 matching lines...) Expand all Loading... |
61 | 60 |
62 // Controls how the attached WebContents is resized. | 61 // Controls how the attached WebContents is resized. |
63 // false = WebContents' views' bounds are updated continuously as the | 62 // false = WebContents' views' bounds are updated continuously as the |
64 // WebView's bounds change (default). | 63 // WebView's bounds change (default). |
65 // true = WebContents' views' position is updated continuously but its size | 64 // true = WebContents' views' position is updated continuously but its size |
66 // is not (which may result in some clipping or under-painting) until | 65 // is not (which may result in some clipping or under-painting) until |
67 // a continuous size operation completes. This allows for smoother | 66 // a continuous size operation completes. This allows for smoother |
68 // resizing performance during interactive resizes and animations. | 67 // resizing performance during interactive resizes and animations. |
69 void SetFastResize(bool fast_resize); | 68 void SetFastResize(bool fast_resize); |
70 | 69 |
| 70 // Controls how the clip is positioned relative to the contents when using |
| 71 // fast resize. Details of the meaning of the parameter can be found in |
| 72 // native_view_host.h |
| 73 void SetFastResizeGravity(NativeViewHost::Gravity gravity); |
| 74 |
71 // Called when the WebContents is focused. | 75 // Called when the WebContents is focused. |
72 // TODO(beng): This view should become a WebContentsViewObserver when a | 76 // TODO(beng): This view should become a WebContentsViewObserver when a |
73 // WebContents is attached, and not rely on the delegate to | 77 // WebContents is attached, and not rely on the delegate to |
74 // forward this notification. | 78 // forward this notification. |
75 void OnWebContentsFocused(content::WebContents* web_contents); | 79 void OnWebContentsFocused(content::WebContents* web_contents); |
76 | 80 |
77 // When used to host UI, we need to explicitly allow accelerators to be | 81 // When used to host UI, we need to explicitly allow accelerators to be |
78 // processed. Default is false. | 82 // processed. Default is false. |
79 void set_allow_accelerators(bool allow_accelerators) { | 83 void set_allow_accelerators(bool allow_accelerators) { |
80 allow_accelerators_ = allow_accelerators; | 84 allow_accelerators_ = allow_accelerators; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 content::BrowserContext* browser_context_; | 143 content::BrowserContext* browser_context_; |
140 bool allow_accelerators_; | 144 bool allow_accelerators_; |
141 gfx::Size preferred_size_; | 145 gfx::Size preferred_size_; |
142 | 146 |
143 DISALLOW_COPY_AND_ASSIGN(WebView); | 147 DISALLOW_COPY_AND_ASSIGN(WebView); |
144 }; | 148 }; |
145 | 149 |
146 } // namespace views | 150 } // namespace views |
147 | 151 |
148 #endif // UI_VIEWS_CONTROLS_WEBVIEW_WEBVIEW_H_ | 152 #endif // UI_VIEWS_CONTROLS_WEBVIEW_WEBVIEW_H_ |
OLD | NEW |