| 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 CHROME_BROWSER_UI_GTK_EXTENSIONS_EXTENSION_VIEW_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_EXTENSIONS_EXTENSION_VIEW_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_EXTENSIONS_EXTENSION_VIEW_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_EXTENSIONS_EXTENSION_VIEW_GTK_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "chrome/browser/extensions/extension_view.h" |
| 9 #include "third_party/skia/include/core/SkBitmap.h" | 11 #include "third_party/skia/include/core/SkBitmap.h" |
| 10 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
| 11 #include "ui/gfx/size.h" | |
| 12 | |
| 13 class Browser; | |
| 14 class SkBitmap; | |
| 15 | 13 |
| 16 namespace content { | 14 namespace content { |
| 17 class RenderViewHost; | 15 class RenderViewHost; |
| 18 } | 16 } |
| 19 | 17 |
| 20 namespace extensions { | 18 namespace extensions { |
| 21 class ExtensionHost; | 19 class ExtensionHost; |
| 22 } | 20 } |
| 23 | 21 |
| 24 class ExtensionViewGtk { | 22 class ExtensionViewGtk : public ExtensionView { |
| 25 public: | 23 public: |
| 26 ExtensionViewGtk(extensions::ExtensionHost* extension_host, Browser* browser); | 24 ExtensionViewGtk(extensions::ExtensionHost* extension_host, Browser* browser); |
| 27 | 25 |
| 28 class Container { | 26 class Container { |
| 29 public: | 27 public: |
| 30 virtual ~Container() {} | 28 virtual ~Container() {} |
| 31 virtual void OnExtensionSizeChanged(ExtensionViewGtk* view, | 29 virtual void OnExtensionSizeChanged(ExtensionViewGtk* view, |
| 32 const gfx::Size& new_size) {} | 30 const gfx::Size& new_size) {} |
| 33 }; | 31 }; |
| 34 | 32 |
| 35 void Init(); | 33 void Init(); |
| 36 | 34 |
| 37 gfx::NativeView native_view(); | 35 void SetContainer(Container* container) { container_ = container; } |
| 38 Browser* browser() const { return browser_; } | |
| 39 | 36 |
| 40 void SetBackground(const SkBitmap& background); | 37 void SetBackground(const SkBitmap& background); |
| 41 | 38 |
| 42 // Sets the container for this view. | 39 gfx::NativeView native_view(); |
| 43 void SetContainer(Container* container) { container_ = container; } | |
| 44 | |
| 45 // Method for the ExtensionHost to notify us about the correct size for | |
| 46 // extension contents. | |
| 47 void ResizeDueToAutoResize(const gfx::Size& new_size); | |
| 48 | |
| 49 // Method for the ExtensionHost to notify us when the RenderViewHost has a | |
| 50 // connection. | |
| 51 void RenderViewCreated(); | |
| 52 | |
| 53 content::RenderViewHost* render_view_host() const; | 40 content::RenderViewHost* render_view_host() const; |
| 54 | 41 |
| 55 private: | 42 private: |
| 43 // Overridden from ExtensionView: |
| 44 virtual Browser* GetBrowser() OVERRIDE; |
| 45 virtual const Browser* GetBrowser() const OVERRIDE; |
| 46 virtual void ResizeDueToAutoResize(const gfx::Size& new_size) OVERRIDE; |
| 47 virtual void RenderViewCreated() OVERRIDE; |
| 48 virtual void DidStopLoading() OVERRIDE; |
| 49 |
| 56 void CreateWidgetHostView(); | 50 void CreateWidgetHostView(); |
| 57 | 51 |
| 58 Browser* browser_; | 52 Browser* browser_; |
| 59 | 53 |
| 60 extensions::ExtensionHost* extension_host_; | 54 extensions::ExtensionHost* extension_host_; |
| 61 | 55 |
| 62 // The background the view should have once it is initialized. This is set | 56 // The background the view should have once it is initialized. This is set |
| 63 // when the view has a custom background, but hasn't been initialized yet. | 57 // when the view has a custom background, but hasn't been initialized yet. |
| 64 SkBitmap pending_background_; | 58 SkBitmap pending_background_; |
| 65 | 59 |
| 66 // This view's container. | 60 // This view's container. |
| 67 Container* container_; | 61 Container* container_; |
| 68 | 62 |
| 69 DISALLOW_COPY_AND_ASSIGN(ExtensionViewGtk); | 63 DISALLOW_COPY_AND_ASSIGN(ExtensionViewGtk); |
| 70 }; | 64 }; |
| 71 | 65 |
| 72 #endif // CHROME_BROWSER_UI_GTK_EXTENSIONS_EXTENSION_VIEW_GTK_H_ | 66 #endif // CHROME_BROWSER_UI_GTK_EXTENSIONS_EXTENSION_VIEW_GTK_H_ |
| OLD | NEW |