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