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