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

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

Issue 175017: Experiment with dislodging the Extension Shelf and having it only appear on t... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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) 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 "app/slide_animation.h"
9 #include "base/task.h" 10 #include "base/task.h"
10 #include "chrome/browser/extensions/extension_shelf_model.h" 11 #include "chrome/browser/extensions/extension_shelf_model.h"
11 #include "chrome/browser/extensions/extensions_service.h" 12 #include "chrome/browser/extensions/extensions_service.h"
12 #include "chrome/browser/views/browser_bubble.h" 13 #include "chrome/browser/views/browser_bubble.h"
13 #include "views/view.h" 14 #include "views/view.h"
14 15
15 class Browser; 16 class Browser;
16 namespace views { 17 namespace views {
17 class Label; 18 class Label;
18 class MouseEvent; 19 class MouseEvent;
19 } 20 }
20 21
21 // A shelf that contains Extension toolstrips. 22 // A shelf that contains Extension toolstrips.
22 class ExtensionShelf : public views::View, 23 class ExtensionShelf : public views::View,
23 public ExtensionContainer, 24 public ExtensionContainer,
24 public ExtensionShelfModelObserver { 25 public ExtensionShelfModelObserver,
26 public AnimationDelegate,
27 public NotificationObserver {
25 public: 28 public:
26 explicit ExtensionShelf(Browser* browser); 29 explicit ExtensionShelf(Browser* browser);
27 virtual ~ExtensionShelf(); 30 virtual ~ExtensionShelf();
28 31
29 // Get the current model. 32 // Get the current model.
30 ExtensionShelfModel* model() { return model_; } 33 ExtensionShelfModel* model() { return model_; }
31 34
35 // Returns whether the extension shelf is detached from the Chrome frame.
36 bool IsDetachedStyle();
37
38 // Toggles a preference for whether to always show the extension shelf.
39 static void ToggleWhenExtensionShelfVisible(Profile* profile);
40
32 // View 41 // View
33 virtual void Paint(gfx::Canvas* canvas); 42 virtual void Paint(gfx::Canvas* canvas);
34 virtual gfx::Size GetPreferredSize(); 43 virtual gfx::Size GetPreferredSize();
35 virtual void Layout(); 44 virtual void Layout();
36 virtual void OnMouseExited(const views::MouseEvent& event); 45 virtual void OnMouseExited(const views::MouseEvent& event);
37 virtual void OnMouseEntered(const views::MouseEvent& event); 46 virtual void OnMouseEntered(const views::MouseEvent& event);
38 virtual bool GetAccessibleName(std::wstring* name); 47 virtual bool GetAccessibleName(std::wstring* name);
39 virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); 48 virtual bool GetAccessibleRole(AccessibilityTypes::Role* role);
40 virtual void SetAccessibleName(const std::wstring& name); 49 virtual void SetAccessibleName(const std::wstring& name);
41 50
42 // ExtensionContainer 51 // ExtensionContainer
43 virtual void OnExtensionMouseEvent(ExtensionView* view); 52 virtual void OnExtensionMouseEvent(ExtensionView* view);
44 virtual void OnExtensionMouseLeave(ExtensionView* view); 53 virtual void OnExtensionMouseLeave(ExtensionView* view);
45 54
46 // ExtensionShelfModelObserver 55 // ExtensionShelfModelObserver
47 virtual void ToolstripInsertedAt(ExtensionHost* toolstrip, int index); 56 virtual void ToolstripInsertedAt(ExtensionHost* toolstrip, int index);
48 virtual void ToolstripRemovingAt(ExtensionHost* toolstrip, int index); 57 virtual void ToolstripRemovingAt(ExtensionHost* toolstrip, int index);
49 virtual void ToolstripDraggingFrom(ExtensionHost* toolstrip, int index); 58 virtual void ToolstripDraggingFrom(ExtensionHost* toolstrip, int index);
50 virtual void ToolstripMoved(ExtensionHost* toolstrip, 59 virtual void ToolstripMoved(ExtensionHost* toolstrip,
51 int from_index, 60 int from_index,
52 int to_index); 61 int to_index);
53 virtual void ToolstripChanged(ExtensionShelfModel::iterator toolstrip); 62 virtual void ToolstripChanged(ExtensionShelfModel::iterator toolstrip);
54 virtual void ExtensionShelfEmpty(); 63 virtual void ExtensionShelfEmpty();
55 virtual void ShelfModelReloaded(); 64 virtual void ShelfModelReloaded();
56 virtual void ShelfModelDeleting(); 65 virtual void ShelfModelDeleting();
57 66
67 // AnimationDelegate
68 virtual void AnimationProgressed(const Animation* animation);
69 virtual void AnimationEnded(const Animation* animation);
70
71 // NotificationObserver
72 virtual void Observe(NotificationType type,
73 const NotificationSource& source,
74 const NotificationDetails& details);
75
58 protected: 76 protected:
59 // View 77 // View
60 virtual void ChildPreferredSizeChanged(View* child); 78 virtual void ChildPreferredSizeChanged(View* child);
61 79
62 private: 80 private:
63 class Toolstrip; 81 class Toolstrip;
64 friend class Toolstrip; 82 friend class Toolstrip;
65 class PlaceholderView; 83 class PlaceholderView;
66 84
67 // Dragging toolstrips 85 // Dragging toolstrips
(...skipping 15 matching lines...) Expand all
83 101
84 // Returns the Toolstrip at |index|. 102 // Returns the Toolstrip at |index|.
85 Toolstrip* ToolstripAtIndex(int index); 103 Toolstrip* ToolstripAtIndex(int index);
86 104
87 // Returns the toolstrip associated with |view|. 105 // Returns the toolstrip associated with |view|.
88 Toolstrip* ToolstripForView(ExtensionView* view); 106 Toolstrip* ToolstripForView(ExtensionView* view);
89 107
90 // Loads initial state from |model_|. 108 // Loads initial state from |model_|.
91 void LoadFromModel(); 109 void LoadFromModel();
92 110
111 // Returns whether the extension shelf always shown (checks pref value).
112 bool IsAlwaysShown();
113
114 // Returns whether the extension shelf is being displayed over the new tab
115 // page.
116 bool OnNewTabPage();
117
118 NotificationRegistrar registrar_;
119
93 // Background bitmap to draw under extension views. 120 // Background bitmap to draw under extension views.
94 SkBitmap background_; 121 SkBitmap background_;
95 122
123 // The browser this extension shelf belongs to.
124 Browser* browser_;
125
96 // The model representing the toolstrips on the shelf. 126 // The model representing the toolstrips on the shelf.
97 ExtensionShelfModel* model_; 127 ExtensionShelfModel* model_;
98 128
99 // Storage of strings needed for accessibility. 129 // Storage of strings needed for accessibility.
100 std::wstring accessible_name_; 130 std::wstring accessible_name_;
101 131
132 // Animation controlling showing and hiding of the shelf.
133 scoped_ptr<SlideAnimation> size_animation_;
134
102 DISALLOW_COPY_AND_ASSIGN(ExtensionShelf); 135 DISALLOW_COPY_AND_ASSIGN(ExtensionShelf);
103 }; 136 };
104 137
105 #endif // CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_SHELF_H_ 138 #endif // CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_SHELF_H_
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.cc ('k') | chrome/browser/views/extensions/extension_shelf.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698