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

Side by Side Diff: chrome/browser/views/extensions/extension_shelf.h

Issue 160276: mole expand/collapse API (Closed)
Patch Set: fixed a couple of crashers Created 11 years, 4 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 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 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_VIEWS_EXTENSIONS_EXTENSION_SHELF_H_ 5 #ifndef CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_SHELF_H_
6 #define CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_SHELF_H_ 6 #define CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_SHELF_H_
7 7
8 #include "app/gfx/canvas.h" 8 #include "app/gfx/canvas.h"
9 #include "base/task.h" 9 #include "base/task.h"
10 #include "chrome/browser/extensions/extension_shelf_model.h" 10 #include "chrome/browser/extensions/extension_shelf_model.h"
11 #include "chrome/browser/extensions/extensions_service.h" 11 #include "chrome/browser/extensions/extensions_service.h"
12 #include "chrome/browser/views/browser_bubble.h" 12 #include "chrome/browser/views/browser_bubble.h"
13 #include "views/view.h" 13 #include "views/view.h"
14 14
15 class Browser; 15 class Browser;
16 namespace views { 16 namespace views {
17 class Label; 17 class Label;
18 class MouseEvent; 18 class MouseEvent;
19 } 19 }
20 20
21 // A shelf that contains Extension toolstrips. 21 // A shelf that contains Extension toolstrips.
22 class ExtensionShelf : public views::View, 22 class ExtensionShelf : public views::View,
23 public ExtensionContainer, 23 public ExtensionContainer,
24 public ExtensionShelfModelObserver { 24 public ExtensionShelfModelObserver {
25 public: 25 public:
26 explicit ExtensionShelf(Browser* browser); 26 explicit ExtensionShelf(Browser* browser);
27 virtual ~ExtensionShelf(); 27 virtual ~ExtensionShelf();
28 28
29 // Get the current model. 29 // Get the current model.
30 ExtensionShelfModel* model() { return model_.get(); } 30 ExtensionShelfModel* model() { return model_; }
31 31
32 // View 32 // View
33 virtual void Paint(gfx::Canvas* canvas); 33 virtual void Paint(gfx::Canvas* canvas);
34 virtual gfx::Size GetPreferredSize(); 34 virtual gfx::Size GetPreferredSize();
35 virtual void Layout(); 35 virtual void Layout();
36 virtual void OnMouseExited(const views::MouseEvent& event); 36 virtual void OnMouseExited(const views::MouseEvent& event);
37 virtual void OnMouseEntered(const views::MouseEvent& event); 37 virtual void OnMouseEntered(const views::MouseEvent& event);
38 virtual bool GetAccessibleName(std::wstring* name); 38 virtual bool GetAccessibleName(std::wstring* name);
39 virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); 39 virtual bool GetAccessibleRole(AccessibilityTypes::Role* role);
40 virtual void SetAccessibleName(const std::wstring& name); 40 virtual void SetAccessibleName(const std::wstring& name);
41 41
42 // ExtensionContainer 42 // ExtensionContainer
43 virtual void OnExtensionMouseEvent(ExtensionView* view); 43 virtual void OnExtensionMouseEvent(ExtensionView* view);
44 virtual void OnExtensionMouseLeave(ExtensionView* view); 44 virtual void OnExtensionMouseLeave(ExtensionView* view);
45 45
46 // ExtensionShelfModelObserver 46 // ExtensionShelfModelObserver
47 virtual void ToolstripInsertedAt(ExtensionHost* toolstrip, int index); 47 virtual void ToolstripInsertedAt(ExtensionHost* toolstrip, int index);
48 virtual void ToolstripRemovingAt(ExtensionHost* toolstrip, int index); 48 virtual void ToolstripRemovingAt(ExtensionHost* toolstrip, int index);
49 virtual void ToolstripDraggingFrom(ExtensionHost* toolstrip, int index); 49 virtual void ToolstripDraggingFrom(ExtensionHost* toolstrip, int index);
50 virtual void ToolstripMoved(ExtensionHost* toolstrip, 50 virtual void ToolstripMoved(ExtensionHost* toolstrip,
51 int from_index, 51 int from_index,
52 int to_index); 52 int to_index);
53 virtual void ToolstripChangedAt(ExtensionHost* toolstrip, int index); 53 virtual void ToolstripChanged(ExtensionShelfModel::iterator toolstrip);
54 virtual void ExtensionShelfEmpty(); 54 virtual void ExtensionShelfEmpty();
55 virtual void ShelfModelReloaded(); 55 virtual void ShelfModelReloaded();
56 virtual void ShelfModelDeleting();
56 57
57 protected: 58 protected:
58 // View 59 // View
59 virtual void ChildPreferredSizeChanged(View* child); 60 virtual void ChildPreferredSizeChanged(View* child);
60 61
61 private: 62 private:
62 class Toolstrip; 63 class Toolstrip;
63 friend class Toolstrip; 64 friend class Toolstrip;
64 class PlaceholderView; 65 class PlaceholderView;
65 66
66 // Dragging toolstrips 67 // Dragging toolstrips
67 void DropExtension(Toolstrip* handle, const gfx::Point& pt, bool cancel); 68 void DropExtension(Toolstrip* handle, const gfx::Point& pt, bool cancel);
68 69
70 // Expand the specified toolstrip, navigating to |url| if non-empty,
71 // and setting the |height|.
72 void ExpandToolstrip(ExtensionHost* host, const GURL& url, int height);
73
74 // Collapse the specified toolstrip, navigating to |url| if non-empty.
75 void CollapseToolstrip(ExtensionHost* host, const GURL& url);
76
69 // Inits the background bitmap. 77 // Inits the background bitmap.
70 void InitBackground(gfx::Canvas* canvas, const SkRect& subset); 78 void InitBackground(gfx::Canvas* canvas, const SkRect& subset);
71 79
72 // Returns the Toolstrip at |x| coordinate. If |x| is out of bounds, returns 80 // Returns the Toolstrip at |x| coordinate. If |x| is out of bounds, returns
73 // NULL. 81 // NULL.
74 Toolstrip* ToolstripAtX(int x); 82 Toolstrip* ToolstripAtX(int x);
75 83
76 // Returns the Toolstrip at |index|. 84 // Returns the Toolstrip at |index|.
77 Toolstrip* ToolstripAtIndex(int index); 85 Toolstrip* ToolstripAtIndex(int index);
78 86
79 // Returns the toolstrip associated with |view|. 87 // Returns the toolstrip associated with |view|.
80 Toolstrip* ToolstripForView(ExtensionView* view); 88 Toolstrip* ToolstripForView(ExtensionView* view);
81 89
82 // Loads initial state from |model_|. 90 // Loads initial state from |model_|.
83 void LoadFromModel(); 91 void LoadFromModel();
84 92
85 // Background bitmap to draw under extension views. 93 // Background bitmap to draw under extension views.
86 SkBitmap background_; 94 SkBitmap background_;
87 95
88 // The model representing the toolstrips on the shelf. 96 // The model representing the toolstrips on the shelf.
89 scoped_ptr<ExtensionShelfModel> model_; 97 ExtensionShelfModel* model_;
90 98
91 // Storage of strings needed for accessibility. 99 // Storage of strings needed for accessibility.
92 std::wstring accessible_name_; 100 std::wstring accessible_name_;
93 101
94 DISALLOW_COPY_AND_ASSIGN(ExtensionShelf); 102 DISALLOW_COPY_AND_ASSIGN(ExtensionShelf);
95 }; 103 };
96 104
97 #endif // CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_SHELF_H_ 105 #endif // CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_SHELF_H_
OLDNEW
« no previous file with comments | « chrome/browser/gtk/extension_shelf_gtk.cc ('k') | chrome/browser/views/extensions/extension_shelf.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698