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 "ui/views/accessibility/native_view_accessibility.h" | 13 #include "ui/views/accessibility/native_view_accessibility.h" |
14 #include "ui/views/controls/webview/webview_export.h" | 14 #include "ui/views/controls/webview/webview_export.h" |
15 #include "ui/views/view.h" | 15 #include "ui/views/view.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 class SiteInstance; | 18 class SiteInstance; |
19 } | 19 } |
20 | 20 |
21 namespace views { | 21 namespace views { |
22 | 22 |
23 class NativeViewHost; | 23 class NativeViewHost; |
24 | 24 |
25 class WEBVIEW_EXPORT WebView : public View, | 25 class WEBVIEW_EXPORT WebView : public View, |
26 public content::NotificationObserver, | 26 public content::NotificationObserver, |
27 public content::WebContentsDelegate, | 27 public content::WebContentsDelegate { |
28 public AccessibleWebView { | |
29 public: | 28 public: |
30 static const char kViewClassName[]; | 29 static const char kViewClassName[]; |
31 | 30 |
32 explicit WebView(content::BrowserContext* browser_context); | 31 explicit WebView(content::BrowserContext* browser_context); |
33 virtual ~WebView(); | 32 virtual ~WebView(); |
34 | 33 |
35 // This creates a WebContents if none is yet associated with this WebView. The | 34 // This creates a WebContents if none is yet associated with this WebView. The |
36 // WebView owns this implicitly created WebContents. | 35 // WebView owns this implicitly created WebContents. |
37 content::WebContents* GetWebContents(); | 36 content::WebContents* GetWebContents(); |
38 | 37 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 allow_accelerators_ = allow_accelerators; | 75 allow_accelerators_ = allow_accelerators; |
77 } | 76 } |
78 | 77 |
79 // Sets the preferred size. If empty, View's implementation of | 78 // Sets the preferred size. If empty, View's implementation of |
80 // GetPreferredSize() is used. | 79 // GetPreferredSize() is used. |
81 void SetPreferredSize(const gfx::Size& preferred_size); | 80 void SetPreferredSize(const gfx::Size& preferred_size); |
82 | 81 |
83 // Overridden from View: | 82 // Overridden from View: |
84 virtual const char* GetClassName() const OVERRIDE; | 83 virtual const char* GetClassName() const OVERRIDE; |
85 | 84 |
86 // Overridden from AccessibleWebView: | |
87 virtual gfx::NativeViewAccessible AccessibleObjectFromChildId( | |
88 long child_id) OVERRIDE; | |
89 virtual View* AsView() OVERRIDE; | |
90 | |
91 private: | 85 private: |
92 // Overridden from View: | 86 // Overridden from View: |
93 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; | 87 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; |
94 virtual void ViewHierarchyChanged( | 88 virtual void ViewHierarchyChanged( |
95 const ViewHierarchyChangedDetails& details) OVERRIDE; | 89 const ViewHierarchyChangedDetails& details) OVERRIDE; |
96 virtual bool SkipDefaultKeyEventProcessing( | 90 virtual bool SkipDefaultKeyEventProcessing( |
97 const ui::KeyEvent& event) OVERRIDE; | 91 const ui::KeyEvent& event) OVERRIDE; |
98 virtual bool IsFocusable() const OVERRIDE; | 92 virtual bool IsFocusable() const OVERRIDE; |
99 virtual void OnFocus() OVERRIDE; | 93 virtual void OnFocus() OVERRIDE; |
100 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; | 94 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; |
(...skipping 29 matching lines...) Expand all Loading... |
130 content::NotificationRegistrar registrar_; | 124 content::NotificationRegistrar registrar_; |
131 bool allow_accelerators_; | 125 bool allow_accelerators_; |
132 gfx::Size preferred_size_; | 126 gfx::Size preferred_size_; |
133 | 127 |
134 DISALLOW_COPY_AND_ASSIGN(WebView); | 128 DISALLOW_COPY_AND_ASSIGN(WebView); |
135 }; | 129 }; |
136 | 130 |
137 } // namespace views | 131 } // namespace views |
138 | 132 |
139 #endif // UI_VIEWS_CONTROLS_WEBVIEW_WEBVIEW_H_ | 133 #endif // UI_VIEWS_CONTROLS_WEBVIEW_WEBVIEW_H_ |
OLD | NEW |