OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WM_FOREIGN_WINDOW_CLIENT_VIEW_H_ |
| 6 #define WM_FOREIGN_WINDOW_CLIENT_VIEW_H_ |
| 7 |
| 8 #include "ui/views/window/client_view.h" |
| 9 #include "wm/gpu/foreign_window_texture_factory.h" |
| 10 |
| 11 namespace wm { |
| 12 |
| 13 class ForeignWindowClientView |
| 14 : public views::ClientView, |
| 15 public ForeignWindowTextureFactoryObserver, |
| 16 public base::SupportsWeakPtr<ForeignWindowClientView> { |
| 17 public: |
| 18 ForeignWindowClientView(gfx::PluginWindowHandle window_handle, |
| 19 gfx::Size preferred_size); |
| 20 virtual ~ForeignWindowClientView(); |
| 21 |
| 22 // Overridden from views::View: |
| 23 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 24 virtual gfx::Size GetMinimumSize() OVERRIDE; |
| 25 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; |
| 26 |
| 27 // Overridden from wm::ForeignWindowTextureFactoryObserver: |
| 28 virtual void OnLostResources() OVERRIDE; |
| 29 |
| 30 // Returns the native view. |
| 31 gfx::NativeView GetNativeView() const; |
| 32 |
| 33 // Called when foreign window contents have changed. |
| 34 void OnWindowContentsChanged(); |
| 35 |
| 36 // Called when foreign window size has changed. |
| 37 void OnWindowSizeChanged(const gfx::Size& size); |
| 38 |
| 39 // Called when foreign window visibility has changed. |
| 40 void OnWindowVisibilityChanged(bool visible); |
| 41 |
| 42 // Called when foreign window has been destroyed. |
| 43 void OnWindowDestroyed(); |
| 44 |
| 45 private: |
| 46 void CreateTexture(); |
| 47 void OnTextureCreated(scoped_refptr<ForeignWindowTexture> texture); |
| 48 |
| 49 scoped_ptr<views::View> contents_view_; |
| 50 scoped_ptr<aura::Window> window_; |
| 51 gfx::PluginWindowHandle window_handle_; |
| 52 gfx::Size preferred_size_; |
| 53 gfx::Size window_size_; |
| 54 bool window_visible_; |
| 55 bool window_destroyed_; |
| 56 scoped_refptr<ForeignWindowTexture> texture_; |
| 57 int pending_texture_created_count_; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(ForeignWindowClientView); |
| 60 }; |
| 61 |
| 62 } // namespace wm |
| 63 |
| 64 #endif // WM_FOREIGN_WINDOW_CLIENT_VIEW_H_ |
OLD | NEW |