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

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

Issue 3129003: remove toolstrips (Closed)
Patch Set: merge Created 10 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
« no previous file with comments | « chrome/browser/view_ids.h ('k') | chrome/browser/views/extensions/extension_shelf.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_SHELF_H_
6 #define CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_SHELF_H_
7 #pragma once
8
9 #include "app/slide_animation.h"
10 #include "base/task.h"
11 #include "chrome/browser/extensions/extension_shelf_model.h"
12 #include "chrome/browser/extensions/extensions_service.h"
13 #include "chrome/browser/views/browser_bubble.h"
14 #include "chrome/browser/views/detachable_toolbar_view.h"
15 #include "gfx/canvas.h"
16 #include "views/view.h"
17
18 class Browser;
19 namespace views {
20 class Label;
21 class MouseEvent;
22 }
23
24 // A shelf that contains Extension toolstrips.
25 class ExtensionShelf : public DetachableToolbarView,
26 public ExtensionView::Container,
27 public ExtensionShelfModelObserver,
28 public AnimationDelegate,
29 public NotificationObserver {
30 public:
31 explicit ExtensionShelf(Browser* browser);
32 virtual ~ExtensionShelf();
33
34 // Get the current model.
35 ExtensionShelfModel* model() { return model_; }
36
37 // Toggles a preference for whether to always show the extension shelf.
38 static void ToggleWhenExtensionShelfVisible(Profile* profile);
39
40 int top_margin() { return top_margin_; }
41
42 // DetachableToolbarView methods:
43 virtual bool IsDetached() const;
44 virtual double GetAnimationValue() const {
45 return size_animation_->GetCurrentValue();
46 }
47
48 // View methods:
49 virtual void PaintChildren(gfx::Canvas* canvas);
50 virtual gfx::Size GetPreferredSize();
51 virtual void Layout();
52 virtual void OnMouseExited(const views::MouseEvent& event);
53 virtual void OnMouseEntered(const views::MouseEvent& event);
54 virtual bool GetAccessibleRole(AccessibilityTypes::Role* role);
55 virtual void OnThemeChanged();
56
57 // ExtensionContainer methods:
58 virtual void OnExtensionMouseMove(ExtensionView* view);
59 virtual void OnExtensionMouseLeave(ExtensionView* view);
60
61 // ExtensionShelfModelObserver methods:
62 virtual void ToolstripInsertedAt(ExtensionHost* toolstrip, int index);
63 virtual void ToolstripRemovingAt(ExtensionHost* toolstrip, int index);
64 virtual void ToolstripDraggingFrom(ExtensionHost* toolstrip, int index);
65 virtual void ToolstripMoved(ExtensionHost* toolstrip,
66 int from_index,
67 int to_index);
68 virtual void ToolstripChanged(ExtensionShelfModel::iterator toolstrip);
69 virtual void ExtensionShelfEmpty();
70 virtual void ShelfModelReloaded();
71 virtual void ShelfModelDeleting();
72
73 // AnimationDelegate methods:
74 virtual void AnimationProgressed(const Animation* animation);
75 virtual void AnimationEnded(const Animation* animation);
76
77 // NotificationObserver methods:
78 virtual void Observe(NotificationType type,
79 const NotificationSource& source,
80 const NotificationDetails& details);
81
82 // Toggle fullscreen mode.
83 void OnFullscreenToggled(bool fullscreen);
84
85 protected:
86 // View methods:
87 virtual void ChildPreferredSizeChanged(View* child);
88
89 private:
90 class Toolstrip;
91 friend class Toolstrip;
92 class PlaceholderView;
93
94 // Dragging toolstrips
95 void DropExtension(Toolstrip* handle, const gfx::Point& pt, bool cancel);
96
97 // Expand the specified toolstrip, navigating to |url| if non-empty,
98 // and setting the |height|.
99 void ExpandToolstrip(ExtensionHost* host, const GURL& url, int height);
100
101 // Collapse the specified toolstrip, navigating to |url| if non-empty.
102 void CollapseToolstrip(ExtensionHost* host, const GURL& url);
103
104 // Initializes the background bitmaps for all views.
105 void InitBackground(gfx::Canvas* canvas);
106
107 // Returns the Toolstrip at |x| coordinate. If |x| is out of bounds, returns
108 // NULL.
109 Toolstrip* ToolstripAtX(int x);
110
111 // Returns the Toolstrip at |index|.
112 Toolstrip* ToolstripAtIndex(int index);
113
114 // Returns the toolstrip associated with |view|.
115 Toolstrip* ToolstripForView(ExtensionView* view);
116
117 // Loads initial state from |model_|.
118 void LoadFromModel();
119
120 // This method computes the bounds for the extension shelf items. If
121 // |compute_bounds_only| = TRUE, the bounds for the items are just computed,
122 // but are not set. This mode is used by GetPreferredSize() to obtain the
123 // desired bounds. If |compute_bounds_only| = FALSE, the bounds are set.
124 gfx::Size LayoutItems(bool compute_bounds_only);
125
126 // Returns whether the extension shelf always shown (checks pref value).
127 bool IsAlwaysShown() const;
128
129 // Returns whether the extension shelf is being displayed over the new tab
130 // page.
131 bool OnNewTabPage() const;
132
133 int top_margin_;
134
135 NotificationRegistrar registrar_;
136
137 // Background bitmap to draw under extension views.
138 bool background_needs_repaint_;
139
140 // The browser this extension shelf belongs to.
141 Browser* browser_;
142
143 // The model representing the toolstrips on the shelf.
144 ExtensionShelfModel* model_;
145
146 // Animation controlling showing and hiding of the shelf.
147 scoped_ptr<SlideAnimation> size_animation_;
148
149 // Are we in fullscreen mode or not.
150 bool fullscreen_;
151
152 DISALLOW_COPY_AND_ASSIGN(ExtensionShelf);
153 };
154
155 #endif // CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_SHELF_H_
OLDNEW
« no previous file with comments | « chrome/browser/view_ids.h ('k') | chrome/browser/views/extensions/extension_shelf.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698