Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: chrome/browser/ui/cocoa/extensions/extension_view_mac.h

Issue 8587001: Have ExtensionHost use TabContents instead of RenderViewHost. Try #3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 RenderViewHost; 16 class RenderViewHost;
17 class RenderWidgetHostViewMac;
18 class SkBitmap; 17 class SkBitmap;
19 18
20 // This class represents extension views. An extension view internally contains 19 // This class represents extension views. An extension view internally contains
21 // a bridge to an extension process, which draws to the extension view's 20 // a bridge to an extension process, which draws to the extension view's
22 // native view object through IPC. 21 // native view object through IPC.
23 class ExtensionViewMac { 22 class ExtensionViewMac {
24 public: 23 public:
25 ExtensionViewMac(ExtensionHost* extension_host, Browser* browser); 24 ExtensionViewMac(ExtensionHost* extension_host, Browser* browser);
26 ~ExtensionViewMac(); 25 ~ExtensionViewMac();
27 26
28 // Starts the extension process and creates the native view. You must call 27 // Starts the extension process and creates the native view. You must call
29 // this method before calling any of this class's other methods. 28 // this method before calling any of this class's other methods.
30 void Init(); 29 void Init();
31 30
32 // Returns the extension's native view. 31 // Returns the extension's native view.
33 gfx::NativeView native_view(); 32 gfx::NativeView native_view();
34 33
35 // Returns the browser the extension belongs to. 34 // Returns the browser the extension belongs to.
36 Browser* browser() const { return browser_; } 35 Browser* browser() const { return browser_; }
37 36
37 // Method for the ExtensionHost to notify us that the extension page is
38 // loaded.
39 void DidStopLoading();
40
38 // Sets the extensions's background image. 41 // Sets the extensions's background image.
39 void SetBackground(const SkBitmap& background); 42 void SetBackground(const SkBitmap& background);
40 43
41 // Method for the ExtensionHost to notify us about the correct size for 44 // Method for the ExtensionHost to notify us about the correct size for
42 // extension contents. 45 // extension contents.
43 void UpdatePreferredSize(const gfx::Size& new_size); 46 void UpdatePreferredSize(const gfx::Size& new_size);
44 47
45 // Method for the ExtensionHost to notify us when the RenderViewHost has a 48 // Method for the ExtensionHost to notify us when the RenderViewHost has a
46 // connection. 49 // connection.
47 void RenderViewCreated(); 50 void RenderViewCreated();
48 51
49 // Informs the view that its containing window's frame changed. 52 // Informs the view that its containing window's frame changed.
50 void WindowFrameChanged(); 53 void WindowFrameChanged();
51 54
52 // The minimum/maximum dimensions of the popup. 55 // The minimum/maximum dimensions of the popup.
53 // The minimum is just a little larger than the size of the button itself. 56 // The minimum is just a little larger than the size of the button itself.
54 // The maximum is an arbitrary number that should be smaller than most 57 // The maximum is an arbitrary number that should be smaller than most
55 // screens. 58 // screens.
56 static const CGFloat kMinWidth; 59 static const CGFloat kMinWidth;
57 static const CGFloat kMinHeight; 60 static const CGFloat kMinHeight;
58 static const CGFloat kMaxWidth; 61 static const CGFloat kMaxWidth;
59 static const CGFloat kMaxHeight; 62 static const CGFloat kMaxHeight;
60 63
61 private: 64 private:
62 RenderViewHost* render_view_host() const; 65 RenderViewHost* render_view_host() const;
63 66
64 void CreateWidgetHostView(); 67 void CreateWidgetHostView();
65 68
69 // We wait to show the ExtensionView until several things have loaded.
70 void ShowIfCompletelyLoaded();
71
66 Browser* browser_; // weak 72 Browser* browser_; // weak
67 73
68 ExtensionHost* extension_host_; // weak 74 ExtensionHost* extension_host_; // weak
69 75
70 // Created by us, but owned by its |native_view()|. We |release| the
71 // rwhv's native view in our destructor, effectively freeing this.
72 RenderWidgetHostViewMac* render_widget_host_view_;
73
74 // The background the view should have once it is initialized. This is set 76 // The background the view should have once it is initialized. This is set
75 // when the view has a custom background, but hasn't been initialized yet. 77 // when the view has a custom background, but hasn't been initialized yet.
76 SkBitmap pending_background_; 78 SkBitmap pending_background_;
77 79
80 // What we should set the preferred width to once the ExtensionView has
81 // loaded.
82 gfx::Size pending_preferred_size_;
83
78 DISALLOW_COPY_AND_ASSIGN(ExtensionViewMac); 84 DISALLOW_COPY_AND_ASSIGN(ExtensionViewMac);
79 }; 85 };
80 86
81 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_VIEW_MAC_H_ 87 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_VIEW_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698