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_COCOA_EXTENSIONS_EXTENSION_VIEW_MAC_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_VIEW_MAC_H_ |
6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_VIEW_MAC_H_ | 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_VIEW_MAC_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "third_party/skia/include/core/SkBitmap.h" | 9 #include "third_party/skia/include/core/SkBitmap.h" |
10 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
11 #include "ui/gfx/size.h" | 11 #include "ui/gfx/size.h" |
12 | 12 |
13 class Browser; | 13 class Browser; |
14 class ExtensionHost; | |
15 class SkBitmap; | 14 class SkBitmap; |
16 | 15 |
17 namespace content { | 16 namespace content { |
18 class RenderViewHost; | 17 class RenderViewHost; |
19 } | 18 } |
20 | 19 |
| 20 namespace extensions { |
| 21 class ExtensionHost; |
| 22 } |
| 23 |
21 // This class represents extension views. An extension view internally contains | 24 // This class represents extension views. An extension view internally contains |
22 // a bridge to an extension process, which draws to the extension view's | 25 // a bridge to an extension process, which draws to the extension view's |
23 // native view object through IPC. | 26 // native view object through IPC. |
24 class ExtensionViewMac { | 27 class ExtensionViewMac { |
25 public: | 28 public: |
26 class Container { | 29 class Container { |
27 public: | 30 public: |
28 virtual ~Container() {} | 31 virtual ~Container() {} |
29 virtual void OnExtensionSizeChanged(ExtensionViewMac* view, | 32 virtual void OnExtensionSizeChanged(ExtensionViewMac* view, |
30 const gfx::Size& new_size) {} | 33 const gfx::Size& new_size) {} |
31 virtual void OnExtensionViewDidShow(ExtensionViewMac* view) {}; | 34 virtual void OnExtensionViewDidShow(ExtensionViewMac* view) {}; |
32 }; | 35 }; |
33 | 36 |
34 ExtensionViewMac(ExtensionHost* extension_host, Browser* browser); | 37 ExtensionViewMac(extensions::ExtensionHost* extension_host, Browser* browser); |
35 ~ExtensionViewMac(); | 38 ~ExtensionViewMac(); |
36 | 39 |
37 // Starts the extension process and creates the native view. You must call | 40 // Starts the extension process and creates the native view. You must call |
38 // this method before calling any of this class's other methods. | 41 // this method before calling any of this class's other methods. |
39 void Init(); | 42 void Init(); |
40 | 43 |
41 // Returns the extension's native view. | 44 // Returns the extension's native view. |
42 gfx::NativeView native_view(); | 45 gfx::NativeView native_view(); |
43 | 46 |
44 // Returns the browser the extension belongs to. | 47 // Returns the browser the extension belongs to. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 private: | 80 private: |
78 content::RenderViewHost* render_view_host() const; | 81 content::RenderViewHost* render_view_host() const; |
79 | 82 |
80 void CreateWidgetHostView(); | 83 void CreateWidgetHostView(); |
81 | 84 |
82 // We wait to show the ExtensionView until several things have loaded. | 85 // We wait to show the ExtensionView until several things have loaded. |
83 void ShowIfCompletelyLoaded(); | 86 void ShowIfCompletelyLoaded(); |
84 | 87 |
85 Browser* browser_; // weak | 88 Browser* browser_; // weak |
86 | 89 |
87 ExtensionHost* extension_host_; // weak | 90 extensions::ExtensionHost* extension_host_; // weak |
88 | 91 |
89 // The background the view should have once it is initialized. This is set | 92 // The background the view should have once it is initialized. This is set |
90 // when the view has a custom background, but hasn't been initialized yet. | 93 // when the view has a custom background, but hasn't been initialized yet. |
91 SkBitmap pending_background_; | 94 SkBitmap pending_background_; |
92 | 95 |
93 // What we should set the preferred width to once the ExtensionView has | 96 // What we should set the preferred width to once the ExtensionView has |
94 // loaded. | 97 // loaded. |
95 gfx::Size pending_preferred_size_; | 98 gfx::Size pending_preferred_size_; |
96 | 99 |
97 Container* container_; | 100 Container* container_; |
98 | 101 |
99 DISALLOW_COPY_AND_ASSIGN(ExtensionViewMac); | 102 DISALLOW_COPY_AND_ASSIGN(ExtensionViewMac); |
100 }; | 103 }; |
101 | 104 |
102 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_VIEW_MAC_H_ | 105 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_VIEW_MAC_H_ |
OLD | NEW |