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 #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 // This class represents extension views. An extension view internally contains | 22 // This class represents extension views. An extension view internally contains |
23 // a bridge to an extension process, which draws to the extension view's | 23 // a bridge to an extension process, which draws to the extension view's |
24 // native view object through IPC. | 24 // native view object through IPC. |
25 class ExtensionViewMac { | 25 class ExtensionViewMac { |
26 public: | 26 public: |
27 class Container { | 27 class Container { |
28 public: | 28 public: |
29 virtual ~Container() {} | 29 virtual ~Container() {} |
30 virtual void OnExtensionPreferredSizeChanged(ExtensionViewMac* view, | 30 virtual void OnExtensionSizeChanged(ExtensionViewMac* view, |
31 const gfx::Size& new_size) {} | 31 const gfx::Size& new_size) {} |
32 virtual void OnExtensionViewDidShow(ExtensionViewMac* view) {}; | 32 virtual void OnExtensionViewDidShow(ExtensionViewMac* view) {}; |
33 }; | 33 }; |
34 | 34 |
35 ExtensionViewMac(ExtensionHost* extension_host, Browser* browser); | 35 ExtensionViewMac(ExtensionHost* extension_host, Browser* browser); |
36 ~ExtensionViewMac(); | 36 ~ExtensionViewMac(); |
37 | 37 |
38 // Starts the extension process and creates the native view. You must call | 38 // Starts the extension process and creates the native view. You must call |
39 // this method before calling any of this class's other methods. | 39 // this method before calling any of this class's other methods. |
40 void Init(); | 40 void Init(); |
41 | 41 |
42 // Returns the extension's native view. | 42 // Returns the extension's native view. |
43 gfx::NativeView native_view(); | 43 gfx::NativeView native_view(); |
44 | 44 |
45 // Returns the browser the extension belongs to. | 45 // Returns the browser the extension belongs to. |
46 Browser* browser() const { return browser_; } | 46 Browser* browser() const { return browser_; } |
47 | 47 |
48 // Method for the ExtensionHost to notify us that the extension page is | 48 // Method for the ExtensionHost to notify us that the extension page is |
49 // loaded. | 49 // loaded. |
50 void DidStopLoading(); | 50 void DidStopLoading(); |
51 | 51 |
52 // Sets the extensions's background image. | 52 // Sets the extensions's background image. |
53 void SetBackground(const SkBitmap& background); | 53 void SetBackground(const SkBitmap& background); |
54 | 54 |
55 // Sets the container for this view. | 55 // Sets the container for this view. |
56 void set_container(Container* container) { container_ = container; } | 56 void set_container(Container* container) { container_ = container; } |
57 | 57 |
58 // Method for the ExtensionHost to notify us about the correct size for | 58 // Method for the ExtensionHost to notify us about the correct size for |
59 // extension contents. | 59 // extension contents. |
60 void UpdatePreferredSize(const gfx::Size& new_size); | 60 void ResizeDueToAutoResize(const gfx::Size& new_size); |
61 | 61 |
62 // Method for the ExtensionHost to notify us when the RenderViewHost has a | 62 // Method for the ExtensionHost to notify us when the RenderViewHost has a |
63 // connection. | 63 // connection. |
64 void RenderViewCreated(); | 64 void RenderViewCreated(); |
65 | 65 |
66 // Informs the view that its containing window's frame changed. | 66 // Informs the view that its containing window's frame changed. |
67 void WindowFrameChanged(); | 67 void WindowFrameChanged(); |
68 | 68 |
69 // The minimum/maximum dimensions of the popup. | 69 // The minimum/maximum dimensions of the popup. |
70 // The minimum is just a little larger than the size of the button itself. | 70 // The minimum is just a little larger than the size of the button itself. |
(...skipping 23 matching lines...) Expand all Loading... |
94 // What we should set the preferred width to once the ExtensionView has | 94 // What we should set the preferred width to once the ExtensionView has |
95 // loaded. | 95 // loaded. |
96 gfx::Size pending_preferred_size_; | 96 gfx::Size pending_preferred_size_; |
97 | 97 |
98 Container* container_; | 98 Container* container_; |
99 | 99 |
100 DISALLOW_COPY_AND_ASSIGN(ExtensionViewMac); | 100 DISALLOW_COPY_AND_ASSIGN(ExtensionViewMac); |
101 }; | 101 }; |
102 | 102 |
103 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_VIEW_MAC_H_ | 103 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_VIEW_MAC_H_ |
OLD | NEW |