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" |
(...skipping 25 matching lines...) Expand all Loading... | |
36 content::WebContents* GetWebContents(); | 36 content::WebContents* GetWebContents(); |
37 | 37 |
38 // Creates a WebContents if none is yet assocaited with this WebView, with the | 38 // Creates a WebContents if none is yet assocaited with this WebView, with the |
39 // specified site instance. The WebView owns this WebContents. | 39 // specified site instance. The WebView owns this WebContents. |
40 void CreateWebContentsWithSiteInstance(content::SiteInstance* site_instance); | 40 void CreateWebContentsWithSiteInstance(content::SiteInstance* site_instance); |
41 | 41 |
42 // WebView does not assume ownership of WebContents set via this method, only | 42 // WebView does not assume ownership of WebContents set via this method, only |
43 // those it implicitly creates via GetWebContents() above. | 43 // those it implicitly creates via GetWebContents() above. |
44 void SetWebContents(content::WebContents* web_contents); | 44 void SetWebContents(content::WebContents* web_contents); |
45 | 45 |
46 // If |mode| is true, WebView will spawn a WebContentsObserver to switch | |
47 // between the WebContentsView and the fullscreen render widget. | |
48 void SetEmbedFullscreenWidgetMode(bool mode); | |
49 | |
46 content::WebContents* web_contents() { return web_contents_; } | 50 content::WebContents* web_contents() { return web_contents_; } |
47 | 51 |
48 content::BrowserContext* browser_context() { return browser_context_; } | 52 content::BrowserContext* browser_context() { return browser_context_; } |
49 | 53 |
50 // Loads the initial URL to display in the attached WebContents. Creates the | 54 // Loads the initial URL to display in the attached WebContents. Creates the |
51 // WebContents if none is attached yet. Note that this is intended as a | 55 // WebContents if none is attached yet. Note that this is intended as a |
52 // convenience for loading the initial URL, and so URLs are navigated with | 56 // convenience for loading the initial URL, and so URLs are navigated with |
53 // PAGE_TRANSITION_AUTO_TOPLEVEL, so this is not intended as a general purpose | 57 // PAGE_TRANSITION_AUTO_TOPLEVEL, so this is not intended as a general purpose |
54 // navigation method - use WebContents' API directly. | 58 // navigation method - use WebContents' API directly. |
55 void LoadInitialURL(const GURL& url); | 59 void LoadInitialURL(const GURL& url); |
(...skipping 20 matching lines...) Expand all Loading... | |
76 } | 80 } |
77 | 81 |
78 // Sets the preferred size. If empty, View's implementation of | 82 // Sets the preferred size. If empty, View's implementation of |
79 // GetPreferredSize() is used. | 83 // GetPreferredSize() is used. |
80 void SetPreferredSize(const gfx::Size& preferred_size); | 84 void SetPreferredSize(const gfx::Size& preferred_size); |
81 | 85 |
82 // Overridden from View: | 86 // Overridden from View: |
83 virtual const char* GetClassName() const OVERRIDE; | 87 virtual const char* GetClassName() const OVERRIDE; |
84 | 88 |
85 private: | 89 private: |
90 class FullscreenObserver; | |
91 | |
86 // Overridden from View: | 92 // Overridden from View: |
87 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; | 93 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; |
88 virtual void ViewHierarchyChanged( | 94 virtual void ViewHierarchyChanged( |
89 const ViewHierarchyChangedDetails& details) OVERRIDE; | 95 const ViewHierarchyChangedDetails& details) OVERRIDE; |
90 virtual bool SkipDefaultKeyEventProcessing( | 96 virtual bool SkipDefaultKeyEventProcessing( |
91 const ui::KeyEvent& event) OVERRIDE; | 97 const ui::KeyEvent& event) OVERRIDE; |
92 virtual bool IsFocusable() const OVERRIDE; | 98 virtual bool IsFocusable() const OVERRIDE; |
93 virtual void OnFocus() OVERRIDE; | 99 virtual void OnFocus() OVERRIDE; |
94 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; | 100 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; |
95 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 101 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
96 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; | 102 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; |
97 virtual gfx::Size GetPreferredSize() OVERRIDE; | 103 virtual gfx::Size GetPreferredSize() OVERRIDE; |
98 | 104 |
99 // Overridden from content::NotificationObserver: | 105 // Overridden from content::NotificationObserver: |
100 virtual void Observe(int type, | 106 virtual void Observe(int type, |
101 const content::NotificationSource& source, | 107 const content::NotificationSource& source, |
102 const content::NotificationDetails& details) OVERRIDE; | 108 const content::NotificationDetails& details) OVERRIDE; |
103 | 109 |
104 // Overridden from content::WebContentsDelegate: | 110 // Overridden from content::WebContentsDelegate: |
105 virtual void WebContentsFocused(content::WebContents* web_contents) OVERRIDE; | 111 virtual void WebContentsFocused(content::WebContents* web_contents) OVERRIDE; |
112 virtual bool EmbedsFullscreenWidget() const OVERRIDE; | |
106 | 113 |
107 void AttachWebContents(); | 114 void AttachWebContents(); |
108 void DetachWebContents(); | 115 void DetachWebContents(); |
116 void ReattachForFullscreenChange(bool enter_fullscreen); | |
109 | 117 |
110 void RenderViewHostChanged(content::RenderViewHost* old_host, | 118 void RenderViewHostChanged(content::RenderViewHost* old_host, |
111 content::RenderViewHost* new_host); | 119 content::RenderViewHost* new_host); |
112 void WebContentsDestroyed(content::WebContents* web_contents); | 120 void WebContentsDestroyed(content::WebContents* web_contents); |
113 | 121 |
114 // Create a regular or test web contents (based on whether we're running | 122 // Create a regular or test web contents (based on whether we're running |
115 // in a unit test or not). | 123 // in a unit test or not). |
116 content::WebContents* CreateWebContents( | 124 content::WebContents* CreateWebContents( |
117 content::BrowserContext* browser_context, | 125 content::BrowserContext* browser_context, |
118 content::SiteInstance* site_instance); | 126 content::SiteInstance* site_instance); |
119 | 127 |
120 NativeViewHost* wcv_holder_; | 128 NativeViewHost* wcv_holder_; |
121 scoped_ptr<content::WebContents> wc_owner_; | 129 scoped_ptr<content::WebContents> wc_owner_; |
122 content::WebContents* web_contents_; | 130 content::WebContents* web_contents_; |
131 scoped_ptr<FullscreenObserver> fullscreen_observer_; | |
132 bool is_embedding_fullscreen_widget_; | |
sky
2013/09/10 19:38:58
Add a description.
miu
2013/09/11 03:57:03
Done.
| |
123 content::BrowserContext* browser_context_; | 133 content::BrowserContext* browser_context_; |
124 content::NotificationRegistrar registrar_; | 134 content::NotificationRegistrar registrar_; |
125 bool allow_accelerators_; | 135 bool allow_accelerators_; |
126 gfx::Size preferred_size_; | 136 gfx::Size preferred_size_; |
127 | 137 |
128 DISALLOW_COPY_AND_ASSIGN(WebView); | 138 DISALLOW_COPY_AND_ASSIGN(WebView); |
129 }; | 139 }; |
130 | 140 |
131 } // namespace views | 141 } // namespace views |
132 | 142 |
133 #endif // UI_VIEWS_CONTROLS_WEBVIEW_WEBVIEW_H_ | 143 #endif // UI_VIEWS_CONTROLS_WEBVIEW_WEBVIEW_H_ |
OLD | NEW |