| 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 CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "content/browser/renderer_host/image_transport_factory.h" | 14 #include "content/browser/renderer_host/image_transport_factory.h" |
| 15 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 15 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "ui/aura/client/activation_delegate.h" | 17 #include "ui/aura/client/activation_delegate.h" |
| 18 #include "ui/aura/window_delegate.h" | 18 #include "ui/aura/window_delegate.h" |
| 19 #include "ui/base/ime/text_input_client.h" | 19 #include "ui/base/ime/text_input_client.h" |
| 20 #include "ui/compositor/compositor_observer.h" | 20 #include "ui/compositor/compositor_observer.h" |
| 21 #include "ui/gfx/rect.h" | 21 #include "ui/gfx/rect.h" |
| 22 #include "webkit/glue/webcursor.h" | 22 #include "webkit/glue/webcursor.h" |
| 23 | 23 |
| 24 namespace aura { | 24 namespace aura { |
| 25 class CompositorLock; | 25 class CompositorLock; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace content { | |
| 29 class RenderWidgetHostImpl; | |
| 30 class RenderWidgetHostView; | |
| 31 } | |
| 32 | |
| 33 namespace gfx { | 28 namespace gfx { |
| 34 class Canvas; | 29 class Canvas; |
| 35 } | 30 } |
| 36 | 31 |
| 37 namespace ui { | 32 namespace ui { |
| 38 class InputMethod; | 33 class InputMethod; |
| 39 class Texture; | 34 class Texture; |
| 40 } | 35 } |
| 41 | 36 |
| 42 namespace WebKit { | 37 namespace WebKit { |
| 43 class WebTouchEvent; | 38 class WebTouchEvent; |
| 44 } | 39 } |
| 45 | 40 |
| 41 namespace content { |
| 42 class RenderWidgetHostImpl; |
| 43 class RenderWidgetHostView; |
| 44 |
| 46 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. | 45 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. |
| 47 class RenderWidgetHostViewAura | 46 class RenderWidgetHostViewAura |
| 48 : public content::RenderWidgetHostViewBase, | 47 : public RenderWidgetHostViewBase, |
| 49 public ui::CompositorObserver, | 48 public ui::CompositorObserver, |
| 50 public ui::TextInputClient, | 49 public ui::TextInputClient, |
| 51 public aura::WindowDelegate, | 50 public aura::WindowDelegate, |
| 52 public aura::client::ActivationDelegate, | 51 public aura::client::ActivationDelegate, |
| 53 public ImageTransportFactoryObserver { | 52 public ImageTransportFactoryObserver { |
| 54 public: | 53 public: |
| 55 // RenderWidgetHostView implementation. | 54 // RenderWidgetHostView implementation. |
| 56 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; | 55 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; |
| 57 virtual content::RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; | 56 virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; |
| 58 virtual void SetSize(const gfx::Size& size) OVERRIDE; | 57 virtual void SetSize(const gfx::Size& size) OVERRIDE; |
| 59 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; | 58 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; |
| 60 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 59 virtual gfx::NativeView GetNativeView() const OVERRIDE; |
| 61 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; | 60 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; |
| 62 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; | 61 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; |
| 63 virtual bool HasFocus() const OVERRIDE; | 62 virtual bool HasFocus() const OVERRIDE; |
| 64 virtual bool IsSurfaceAvailableForCopy() const OVERRIDE; | 63 virtual bool IsSurfaceAvailableForCopy() const OVERRIDE; |
| 65 virtual void Show() OVERRIDE; | 64 virtual void Show() OVERRIDE; |
| 66 virtual void Hide() OVERRIDE; | 65 virtual void Hide() OVERRIDE; |
| 67 virtual bool IsShowing() OVERRIDE; | 66 virtual bool IsShowing() OVERRIDE; |
| 68 virtual gfx::Rect GetViewBounds() const OVERRIDE; | 67 virtual gfx::Rect GetViewBounds() const OVERRIDE; |
| 69 virtual void SetBackground(const SkBitmap& background) OVERRIDE; | 68 virtual void SetBackground(const SkBitmap& background) OVERRIDE; |
| 70 | 69 |
| 71 // Overridden from RenderWidgetHostViewPort: | 70 // Overridden from RenderWidgetHostViewPort: |
| 72 virtual void InitAsPopup(content::RenderWidgetHostView* parent_host_view, | 71 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, |
| 73 const gfx::Rect& pos) OVERRIDE; | 72 const gfx::Rect& pos) OVERRIDE; |
| 74 virtual void InitAsFullscreen( | 73 virtual void InitAsFullscreen( |
| 75 content::RenderWidgetHostView* reference_host_view) OVERRIDE; | 74 RenderWidgetHostView* reference_host_view) OVERRIDE; |
| 76 virtual void WasRestored() OVERRIDE; | 75 virtual void WasRestored() OVERRIDE; |
| 77 virtual void WasHidden() OVERRIDE; | 76 virtual void WasHidden() OVERRIDE; |
| 78 virtual void MovePluginWindows( | 77 virtual void MovePluginWindows( |
| 79 const std::vector<webkit::npapi::WebPluginGeometry>& moves) OVERRIDE; | 78 const std::vector<webkit::npapi::WebPluginGeometry>& moves) OVERRIDE; |
| 80 virtual void Focus() OVERRIDE; | 79 virtual void Focus() OVERRIDE; |
| 81 virtual void Blur() OVERRIDE; | 80 virtual void Blur() OVERRIDE; |
| 82 virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE; | 81 virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE; |
| 83 virtual void SetIsLoading(bool is_loading) OVERRIDE; | 82 virtual void SetIsLoading(bool is_loading) OVERRIDE; |
| 84 virtual void TextInputStateChanged(ui::TextInputType type, | 83 virtual void TextInputStateChanged(ui::TextInputType type, |
| 85 bool can_compose_inline) OVERRIDE; | 84 bool can_compose_inline) OVERRIDE; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE; | 174 virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE; |
| 176 virtual bool HasHitTestMask() const OVERRIDE; | 175 virtual bool HasHitTestMask() const OVERRIDE; |
| 177 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; | 176 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; |
| 178 | 177 |
| 179 // Overridden from aura::client::ActivationDelegate: | 178 // Overridden from aura::client::ActivationDelegate: |
| 180 virtual bool ShouldActivate(const aura::Event* event) OVERRIDE; | 179 virtual bool ShouldActivate(const aura::Event* event) OVERRIDE; |
| 181 virtual void OnActivated() OVERRIDE; | 180 virtual void OnActivated() OVERRIDE; |
| 182 virtual void OnLostActive() OVERRIDE; | 181 virtual void OnLostActive() OVERRIDE; |
| 183 | 182 |
| 184 protected: | 183 protected: |
| 185 friend class content::RenderWidgetHostView; | 184 friend class RenderWidgetHostView; |
| 186 | 185 |
| 187 // Should construct only via RenderWidgetHostView::CreateViewForWidget. | 186 // Should construct only via RenderWidgetHostView::CreateViewForWidget. |
| 188 explicit RenderWidgetHostViewAura(content::RenderWidgetHost* host); | 187 explicit RenderWidgetHostViewAura(RenderWidgetHost* host); |
| 189 | 188 |
| 190 private: | 189 private: |
| 191 class WindowObserver; | 190 class WindowObserver; |
| 192 friend class WindowObserver; | 191 friend class WindowObserver; |
| 193 | 192 |
| 194 // Overridden from ui::CompositorObserver: | 193 // Overridden from ui::CompositorObserver: |
| 195 virtual void OnCompositingDidCommit(ui::Compositor* compositor) OVERRIDE; | 194 virtual void OnCompositingDidCommit(ui::Compositor* compositor) OVERRIDE; |
| 196 virtual void OnCompositingWillStart(ui::Compositor* compositor) OVERRIDE; | 195 virtual void OnCompositingWillStart(ui::Compositor* compositor) OVERRIDE; |
| 197 virtual void OnCompositingStarted(ui::Compositor* compositor) OVERRIDE; | 196 virtual void OnCompositingStarted(ui::Compositor* compositor) OVERRIDE; |
| 198 virtual void OnCompositingEnded(ui::Compositor* compositor) OVERRIDE; | 197 virtual void OnCompositingEnded(ui::Compositor* compositor) OVERRIDE; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 240 |
| 242 ui::Compositor* GetCompositor(); | 241 ui::Compositor* GetCompositor(); |
| 243 | 242 |
| 244 // Detaches |this| from the input method object. | 243 // Detaches |this| from the input method object. |
| 245 void DetachFromInputMethod(); | 244 void DetachFromInputMethod(); |
| 246 | 245 |
| 247 // Converts |rect| from window coordinate to screen coordinate. | 246 // Converts |rect| from window coordinate to screen coordinate. |
| 248 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect); | 247 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect); |
| 249 | 248 |
| 250 // The model object. | 249 // The model object. |
| 251 content::RenderWidgetHostImpl* host_; | 250 RenderWidgetHostImpl* host_; |
| 252 | 251 |
| 253 aura::Window* window_; | 252 aura::Window* window_; |
| 254 | 253 |
| 255 scoped_ptr<WindowObserver> window_observer_; | 254 scoped_ptr<WindowObserver> window_observer_; |
| 256 | 255 |
| 257 // Are we in the process of closing? Tracked so fullscreen views can avoid | 256 // Are we in the process of closing? Tracked so fullscreen views can avoid |
| 258 // sending a second shutdown request to the host when they lose the focus | 257 // sending a second shutdown request to the host when they lose the focus |
| 259 // after requesting shutdown for another reason (e.g. Escape key). | 258 // after requesting shutdown for another reason (e.g. Escape key). |
| 260 bool in_shutdown_; | 259 bool in_shutdown_; |
| 261 | 260 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 std::vector<linked_ptr<ResizeLock> > resize_locks_; | 338 std::vector<linked_ptr<ResizeLock> > resize_locks_; |
| 340 // These locks are the ones waiting for a frame to be drawn. | 339 // These locks are the ones waiting for a frame to be drawn. |
| 341 std::vector<linked_ptr<ResizeLock> > locks_pending_draw_; | 340 std::vector<linked_ptr<ResizeLock> > locks_pending_draw_; |
| 342 | 341 |
| 343 // This lock is for waiting for a front surface to become available to draw. | 342 // This lock is for waiting for a front surface to become available to draw. |
| 344 scoped_refptr<aura::CompositorLock> released_front_lock_; | 343 scoped_refptr<aura::CompositorLock> released_front_lock_; |
| 345 | 344 |
| 346 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); | 345 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); |
| 347 }; | 346 }; |
| 348 | 347 |
| 348 } // namespace content |
| 349 |
| 349 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 350 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
| OLD | NEW |