| 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" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 void set_allow_accelerators(bool allow_accelerators) { | 87 void set_allow_accelerators(bool allow_accelerators) { |
| 88 allow_accelerators_ = allow_accelerators; | 88 allow_accelerators_ = allow_accelerators; |
| 89 } | 89 } |
| 90 | 90 |
| 91 // Sets the preferred size. If empty, View's implementation of | 91 // Sets the preferred size. If empty, View's implementation of |
| 92 // GetPreferredSize() is used. | 92 // GetPreferredSize() is used. |
| 93 void SetPreferredSize(const gfx::Size& preferred_size); | 93 void SetPreferredSize(const gfx::Size& preferred_size); |
| 94 | 94 |
| 95 // Overridden from View: | 95 // Overridden from View: |
| 96 virtual const char* GetClassName() const OVERRIDE; | 96 virtual const char* GetClassName() const OVERRIDE; |
| 97 virtual ui::TextInputClient* GetTextInputClient() OVERRIDE; |
| 97 | 98 |
| 98 protected: | 99 protected: |
| 99 // Overridden from View: | 100 // Overridden from View: |
| 100 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; | 101 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; |
| 101 virtual void ViewHierarchyChanged( | 102 virtual void ViewHierarchyChanged( |
| 102 const ViewHierarchyChangedDetails& details) OVERRIDE; | 103 const ViewHierarchyChangedDetails& details) OVERRIDE; |
| 103 virtual bool SkipDefaultKeyEventProcessing( | 104 virtual bool SkipDefaultKeyEventProcessing( |
| 104 const ui::KeyEvent& event) OVERRIDE; | 105 const ui::KeyEvent& event) OVERRIDE; |
| 105 virtual bool IsFocusable() const OVERRIDE; | 106 virtual bool IsFocusable() const OVERRIDE; |
| 106 virtual void OnFocus() OVERRIDE; | 107 virtual void OnFocus() OVERRIDE; |
| 107 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; | 108 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; |
| 108 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 109 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; |
| 109 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; | 110 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; |
| 110 virtual gfx::Size GetPreferredSize() OVERRIDE; | 111 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 111 | 112 |
| 112 // Overridden from content::WebContentsDelegate: | 113 // Overridden from content::WebContentsDelegate: |
| 113 virtual void WebContentsFocused(content::WebContents* web_contents) OVERRIDE; | 114 virtual void WebContentsFocused(content::WebContents* web_contents) OVERRIDE; |
| 114 virtual bool EmbedsFullscreenWidget() const OVERRIDE; | 115 virtual bool EmbedsFullscreenWidget() const OVERRIDE; |
| 115 | 116 |
| 116 // Overridden from content::WebContentsObserver: | 117 // Overridden from content::WebContentsObserver: |
| 118 virtual void RenderViewDeleted( |
| 119 content::RenderViewHost* render_view_host) OVERRIDE; |
| 117 virtual void RenderViewHostChanged( | 120 virtual void RenderViewHostChanged( |
| 118 content::RenderViewHost* old_host, | 121 content::RenderViewHost* old_host, |
| 119 content::RenderViewHost* new_host) OVERRIDE; | 122 content::RenderViewHost* new_host) OVERRIDE; |
| 120 virtual void DidShowFullscreenWidget(int routing_id) OVERRIDE; | 123 virtual void DidShowFullscreenWidget(int routing_id) OVERRIDE; |
| 121 virtual void DidDestroyFullscreenWidget(int routing_id) OVERRIDE; | 124 virtual void DidDestroyFullscreenWidget(int routing_id) OVERRIDE; |
| 122 virtual void DidToggleFullscreenModeForTab(bool entered_fullscreen) OVERRIDE; | 125 virtual void DidToggleFullscreenModeForTab(bool entered_fullscreen) OVERRIDE; |
| 123 // Workaround for MSVC++ linker bug/feature that requires | 126 // Workaround for MSVC++ linker bug/feature that requires |
| 124 // instantiation of the inline IPC::Listener methods in all translation units. | 127 // instantiation of the inline IPC::Listener methods in all translation units. |
| 125 virtual void OnChannelConnected(int32 peer_id) OVERRIDE {} | 128 virtual void OnChannelConnected(int32 peer_id) OVERRIDE {} |
| 126 virtual void OnChannelError() OVERRIDE {} | 129 virtual void OnChannelError() OVERRIDE {} |
| 127 | 130 |
| 128 private: | 131 private: |
| 129 void AttachWebContents(); | 132 void AttachWebContents(); |
| 130 void DetachWebContents(); | 133 void DetachWebContents(); |
| 131 void ReattachForFullscreenChange(bool enter_fullscreen); | 134 void ReattachForFullscreenChange(bool enter_fullscreen); |
| 135 void NotifyMaybeTextInputClientChanged(); |
| 132 | 136 |
| 133 // Create a regular or test web contents (based on whether we're running | 137 // Create a regular or test web contents (based on whether we're running |
| 134 // in a unit test or not). | 138 // in a unit test or not). |
| 135 content::WebContents* CreateWebContents( | 139 content::WebContents* CreateWebContents( |
| 136 content::BrowserContext* browser_context); | 140 content::BrowserContext* browser_context); |
| 137 | 141 |
| 138 NativeViewHost* const holder_; | 142 NativeViewHost* const holder_; |
| 139 // Non-NULL if |web_contents()| was created and is owned by this WebView. | 143 // Non-NULL if |web_contents()| was created and is owned by this WebView. |
| 140 scoped_ptr<content::WebContents> wc_owner_; | 144 scoped_ptr<content::WebContents> wc_owner_; |
| 141 // When true, WebView auto-embeds fullscreen widgets as a child view. | 145 // When true, WebView auto-embeds fullscreen widgets as a child view. |
| 142 bool embed_fullscreen_widget_mode_enabled_; | 146 bool embed_fullscreen_widget_mode_enabled_; |
| 143 // Set to true while WebView is embedding a fullscreen widget view as a child | 147 // Set to true while WebView is embedding a fullscreen widget view as a child |
| 144 // view instead of the normal WebContentsView render view. Note: This will be | 148 // view instead of the normal WebContentsView render view. Note: This will be |
| 145 // false in the case of non-Flash fullscreen. | 149 // false in the case of non-Flash fullscreen. |
| 146 bool is_embedding_fullscreen_widget_; | 150 bool is_embedding_fullscreen_widget_; |
| 147 content::BrowserContext* browser_context_; | 151 content::BrowserContext* browser_context_; |
| 148 bool allow_accelerators_; | 152 bool allow_accelerators_; |
| 149 gfx::Size preferred_size_; | 153 gfx::Size preferred_size_; |
| 150 | 154 |
| 151 DISALLOW_COPY_AND_ASSIGN(WebView); | 155 DISALLOW_COPY_AND_ASSIGN(WebView); |
| 152 }; | 156 }; |
| 153 | 157 |
| 154 } // namespace views | 158 } // namespace views |
| 155 | 159 |
| 156 #endif // UI_VIEWS_CONTROLS_WEBVIEW_WEBVIEW_H_ | 160 #endif // UI_VIEWS_CONTROLS_WEBVIEW_WEBVIEW_H_ |
| OLD | NEW |