| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 11 |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "content/public/browser/render_process_host_observer.h" | 13 #include "content/public/browser/render_process_host_observer.h" |
| 13 #include "content/public/browser/web_contents_delegate.h" | 14 #include "content/public/browser/web_contents_delegate.h" |
| 14 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
| 15 #include "ui/views/accessibility/native_view_accessibility.h" | 16 #include "ui/views/accessibility/native_view_accessibility.h" |
| 16 #include "ui/views/controls/webview/webview_export.h" | 17 #include "ui/views/controls/webview/webview_export.h" |
| 17 #include "ui/views/view.h" | 18 #include "ui/views/view.h" |
| 18 | 19 |
| 19 namespace views { | 20 namespace views { |
| 20 | 21 |
| 21 class NativeViewHost; | 22 class NativeViewHost; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 void SetPreferredSize(const gfx::Size& preferred_size); | 92 void SetPreferredSize(const gfx::Size& preferred_size); |
| 92 | 93 |
| 93 // Overridden from View: | 94 // Overridden from View: |
| 94 const char* GetClassName() const override; | 95 const char* GetClassName() const override; |
| 95 | 96 |
| 96 NativeViewHost* holder() { return holder_; } | 97 NativeViewHost* holder() { return holder_; } |
| 97 | 98 |
| 98 protected: | 99 protected: |
| 99 // Swaps the owned WebContents |wc_owner_| with |new_web_contents|. Returns | 100 // Swaps the owned WebContents |wc_owner_| with |new_web_contents|. Returns |
| 100 // the previously owned WebContents. | 101 // the previously owned WebContents. |
| 101 scoped_ptr<content::WebContents> SwapWebContents( | 102 std::unique_ptr<content::WebContents> SwapWebContents( |
| 102 scoped_ptr<content::WebContents> new_web_contents); | 103 std::unique_ptr<content::WebContents> new_web_contents); |
| 103 | 104 |
| 104 // Called when the web contents is successfully attached. | 105 // Called when the web contents is successfully attached. |
| 105 virtual void OnWebContentsAttached() {} | 106 virtual void OnWebContentsAttached() {} |
| 106 | 107 |
| 107 // Overridden from View: | 108 // Overridden from View: |
| 108 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; | 109 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; |
| 109 void ViewHierarchyChanged( | 110 void ViewHierarchyChanged( |
| 110 const ViewHierarchyChangedDetails& details) override; | 111 const ViewHierarchyChangedDetails& details) override; |
| 111 bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) override; | 112 bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) override; |
| 112 bool OnMousePressed(const ui::MouseEvent& event) override; | 113 bool OnMousePressed(const ui::MouseEvent& event) override; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 void ReattachForFullscreenChange(bool enter_fullscreen); | 153 void ReattachForFullscreenChange(bool enter_fullscreen); |
| 153 void NotifyAccessibilityWebContentsChanged(); | 154 void NotifyAccessibilityWebContentsChanged(); |
| 154 | 155 |
| 155 // Create a regular or test web contents (based on whether we're running | 156 // Create a regular or test web contents (based on whether we're running |
| 156 // in a unit test or not). | 157 // in a unit test or not). |
| 157 content::WebContents* CreateWebContents( | 158 content::WebContents* CreateWebContents( |
| 158 content::BrowserContext* browser_context); | 159 content::BrowserContext* browser_context); |
| 159 | 160 |
| 160 NativeViewHost* const holder_; | 161 NativeViewHost* const holder_; |
| 161 // Non-NULL if |web_contents()| was created and is owned by this WebView. | 162 // Non-NULL if |web_contents()| was created and is owned by this WebView. |
| 162 scoped_ptr<content::WebContents> wc_owner_; | 163 std::unique_ptr<content::WebContents> wc_owner_; |
| 163 // The RenderProcessHost to which this RenderProcessHostObserver is added. | 164 // The RenderProcessHost to which this RenderProcessHostObserver is added. |
| 164 // Since WebView::GetTextInputClient is relying on RWHV::GetTextInputClient, | 165 // Since WebView::GetTextInputClient is relying on RWHV::GetTextInputClient, |
| 165 // we have to observe the lifecycle of the underlying RWHV through | 166 // we have to observe the lifecycle of the underlying RWHV through |
| 166 // RenderProcessHostObserver. | 167 // RenderProcessHostObserver. |
| 167 content::RenderProcessHost* observing_render_process_host_; | 168 content::RenderProcessHost* observing_render_process_host_; |
| 168 // When true, WebView auto-embeds fullscreen widgets as a child view. | 169 // When true, WebView auto-embeds fullscreen widgets as a child view. |
| 169 bool embed_fullscreen_widget_mode_enabled_; | 170 bool embed_fullscreen_widget_mode_enabled_; |
| 170 // Set to true while WebView is embedding a fullscreen widget view as a child | 171 // Set to true while WebView is embedding a fullscreen widget view as a child |
| 171 // view instead of the normal WebContentsView render view. Note: This will be | 172 // view instead of the normal WebContentsView render view. Note: This will be |
| 172 // false in the case of non-Flash fullscreen. | 173 // false in the case of non-Flash fullscreen. |
| 173 bool is_embedding_fullscreen_widget_; | 174 bool is_embedding_fullscreen_widget_; |
| 174 content::BrowserContext* browser_context_; | 175 content::BrowserContext* browser_context_; |
| 175 bool allow_accelerators_; | 176 bool allow_accelerators_; |
| 176 gfx::Size preferred_size_; | 177 gfx::Size preferred_size_; |
| 177 | 178 |
| 178 DISALLOW_COPY_AND_ASSIGN(WebView); | 179 DISALLOW_COPY_AND_ASSIGN(WebView); |
| 179 }; | 180 }; |
| 180 | 181 |
| 181 } // namespace views | 182 } // namespace views |
| 182 | 183 |
| 183 #endif // UI_VIEWS_CONTROLS_WEBVIEW_WEBVIEW_H_ | 184 #endif // UI_VIEWS_CONTROLS_WEBVIEW_WEBVIEW_H_ |
| OLD | NEW |