| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2009 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 CHROME_BROWSER_COCOA_EXTENSION_VIEW_MAC_H_ |
| 6 #define CHROME_BROWSER_COCOA_EXTENSION_VIEW_MAC_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/gfx/native_widget_types.h" |
| 10 |
| 11 class Browser; |
| 12 class ExtensionHost; |
| 13 class RenderViewHost; |
| 14 class RenderWidgetHostViewMac; |
| 15 class SkBitmap; |
| 16 |
| 17 // This class represents extension views. An extension view internally contains |
| 18 // a bridge to an extension process, which draws to the extension view's |
| 19 // native view object through IPC. |
| 20 class ExtensionViewMac { |
| 21 public: |
| 22 ExtensionViewMac(ExtensionHost* extension_host, Browser* browser); |
| 23 ~ExtensionViewMac(); |
| 24 |
| 25 // Starts the extension process and creates the native view. You must call |
| 26 // this method before calling any of this class's other methods. |
| 27 void Init(); |
| 28 |
| 29 // Returns the extension's native view. |
| 30 gfx::NativeView native_view(); |
| 31 |
| 32 // Returns the browser the extension belongs to. |
| 33 Browser* browser() const { return browser_; } |
| 34 |
| 35 // Does this extension live as a toolstrip in an extension shelf? |
| 36 bool is_toolstrip() const { return is_toolstrip_; } |
| 37 void set_is_toolstrip(bool is_toolstrip) { is_toolstrip_ = is_toolstrip; } |
| 38 |
| 39 // Sets the extensions's background image. |
| 40 void SetBackground(const SkBitmap& background); |
| 41 |
| 42 // Method for the ExtensionHost to notify us about the correct width for |
| 43 // extension contents. |
| 44 void UpdatePreferredWidth(int pref_width); |
| 45 |
| 46 private: |
| 47 RenderViewHost* render_view_host() const; |
| 48 |
| 49 void CreateWidgetHostView(); |
| 50 |
| 51 // True if the contents are being displayed inside the extension shelf. |
| 52 bool is_toolstrip_; |
| 53 |
| 54 Browser* browser_; // weak |
| 55 |
| 56 ExtensionHost* extension_host_; // weak |
| 57 |
| 58 // Created by us, but owned by its |native_view()|. We |release| the |
| 59 // rwhv's native view in our destructor, effectively freeing this. |
| 60 RenderWidgetHostViewMac* render_widget_host_view_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(ExtensionViewMac); |
| 63 }; |
| 64 |
| 65 #endif // CHROME_BROWSER_COCOA_EXTENSION_VIEW_MAC_H_ |
| OLD | NEW |