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

Side by Side Diff: chrome/browser/ui/views/extensions/extension_view_views.h

Issue 10913243: extensions: Add ExtensionView interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: instantiate android and mac too Created 8 years, 3 months 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) 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_VIEWS_EXTENSIONS_EXTENSION_VIEW_VIEWS_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_VIEW_VIEWS_H_
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_VIEW_VIEWS_H_ 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_VIEW_VIEWS_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "chrome/browser/extensions/extension_view.h"
10 #include "third_party/skia/include/core/SkBitmap.h" 11 #include "third_party/skia/include/core/SkBitmap.h"
11 #include "ui/views/controls/native/native_view_host.h" 12 #include "ui/views/controls/native/native_view_host.h"
12 13
13 class Browser;
14
15 namespace content { 14 namespace content {
16 class RenderViewHost; 15 class RenderViewHost;
17 } 16 }
18 17
19 namespace extensions { 18 namespace extensions {
20 class Extension; 19 class Extension;
21 class ExtensionHost; 20 class ExtensionHost;
22 } 21 }
23 22
24 // This handles the display portion of an ExtensionHost. 23 // This handles the display portion of an ExtensionHost.
25 class ExtensionViewViews : public views::NativeViewHost { 24 class ExtensionViewViews : public ExtensionView,
25 public views::NativeViewHost {
tfarina 2012/09/14 01:56:29 Looks like we will need to have a ExtensionViewHos
26 public: 26 public:
27 ExtensionViewViews(extensions::ExtensionHost* host, Browser* browser); 27 ExtensionViewViews(extensions::ExtensionHost* host, Browser* browser);
28 virtual ~ExtensionViewViews(); 28 virtual ~ExtensionViewViews();
29 29
30 // A class that represents the container that this view is in. 30 // A class that represents the container that this view is in.
31 // (bottom shelf, side bar, etc.) 31 // (bottom shelf, side bar, etc.)
32 class Container { 32 class Container {
33 public: 33 public:
34 virtual ~Container() {} 34 virtual ~Container() {}
35 virtual void OnExtensionSizeChanged(ExtensionViewViews* view) {} 35 virtual void OnExtensionSizeChanged(ExtensionViewViews* view) {}
36 virtual void OnViewWasResized() {} 36 virtual void OnViewWasResized() {}
37 }; 37 };
38 38
39 // Sets the container for this view.
40 void SetContainer(Container* container) { container_ = container; }
41
39 extensions::ExtensionHost* host() const { return host_; } 42 extensions::ExtensionHost* host() const { return host_; }
40 Browser* browser() const { return browser_; }
41 const extensions::Extension* extension() const; 43 const extensions::Extension* extension() const;
42 content::RenderViewHost* render_view_host() const; 44 content::RenderViewHost* render_view_host() const;
43 void DidStopLoading(); 45
44 void SetIsClipped(bool is_clipped); 46 void SetIsClipped(bool is_clipped);
45 47
46 // Notification from ExtensionHost.
47 void ResizeDueToAutoResize(const gfx::Size& new_size);
48
49 // Method for the ExtensionHost to notify us when the RenderViewHost has a
50 // connection.
51 void RenderViewCreated();
52
53 // Set a custom background for the view. The background will be tiled. 48 // Set a custom background for the view. The background will be tiled.
54 void SetBackground(const SkBitmap& background); 49 void SetBackground(const SkBitmap& background);
55 50
56 // Sets the container for this view.
57 void SetContainer(Container* container) { container_ = container; }
58
59 // Overridden from views::NativeViewHost: 51 // Overridden from views::NativeViewHost:
60 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE; 52 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE;
61 virtual void SetVisible(bool is_visible) OVERRIDE; 53 virtual void SetVisible(bool is_visible) OVERRIDE;
62 virtual void ViewHierarchyChanged(bool is_add, 54 virtual void ViewHierarchyChanged(bool is_add,
63 views::View* parent, 55 views::View* parent,
64 views::View* child) OVERRIDE; 56 views::View* child) OVERRIDE;
65 57
66 protected: 58 protected:
67 // Overridden from views::View. 59 // Overridden from views::View.
68 virtual void PreferredSizeChanged() OVERRIDE; 60 virtual void PreferredSizeChanged() OVERRIDE;
69 virtual bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& e) OVERRIDE; 61 virtual bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& e) OVERRIDE;
70 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; 62 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
71 63
72 private: 64 private:
73 friend class extensions::ExtensionHost; 65 friend class extensions::ExtensionHost;
74 66
67 // Overridden from ExtensionView:
68 virtual Browser* GetBrowser() OVERRIDE;
69 virtual void ResizeDueToAutoResize(const gfx::Size& new_size) OVERRIDE;
70 virtual void RenderViewCreated() OVERRIDE;
71 virtual void DidStopLoading() OVERRIDE;
72
75 // Initializes the RenderWidgetHostView for this object. 73 // Initializes the RenderWidgetHostView for this object.
76 void CreateWidgetHostView(); 74 void CreateWidgetHostView();
77 75
78 // We wait to show the ExtensionViewViews until several things have loaded. 76 // We wait to show the ExtensionViewViews until several things have loaded.
79 void ShowIfCompletelyLoaded(); 77 void ShowIfCompletelyLoaded();
80 78
81 // Restore object to initial state. Called on shutdown or after a renderer 79 // Restore object to initial state. Called on shutdown or after a renderer
82 // crash. 80 // crash.
83 void CleanUp(); 81 void CleanUp();
84 82
(...skipping 19 matching lines...) Expand all
104 // Note: the view does not own its container. 102 // Note: the view does not own its container.
105 Container* container_; 103 Container* container_;
106 104
107 // Whether this extension view is clipped. 105 // Whether this extension view is clipped.
108 bool is_clipped_; 106 bool is_clipped_;
109 107
110 DISALLOW_COPY_AND_ASSIGN(ExtensionViewViews); 108 DISALLOW_COPY_AND_ASSIGN(ExtensionViewViews);
111 }; 109 };
112 110
113 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_VIEW_VIEWS_H_ 111 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_VIEW_VIEWS_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/extensions/extension_popup.cc ('k') | chrome/browser/ui/views/extensions/extension_view_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698