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

Side by Side Diff: chrome/browser/ui/toolbar/wrench_menu_model.h

Issue 8286018: Reland r105450: Linux: add basic bookmark menu support. More features can be added later. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 2 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) 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_TOOLBAR_WRENCH_MENU_MODEL_H_ 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_
6 #define CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ 6 #define CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/tabs/tab_strip_model_observer.h" 11 #include "chrome/browser/tabs/tab_strip_model_observer.h"
12 #include "chrome/browser/ui/toolbar/bookmark_sub_menu_model.h"
12 #include "content/common/notification_observer.h" 13 #include "content/common/notification_observer.h"
13 #include "content/common/notification_registrar.h" 14 #include "content/common/notification_registrar.h"
14 #include "ui/base/models/accelerator.h" 15 #include "ui/base/models/accelerator.h"
15 #include "ui/base/models/button_menu_item_model.h" 16 #include "ui/base/models/button_menu_item_model.h"
16 #include "ui/base/models/simple_menu_model.h" 17 #include "ui/base/models/simple_menu_model.h"
17 18
18 class Browser; 19 class Browser;
19 class TabStripModel; 20 class TabStripModel;
20 21
21 namespace { 22 namespace {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 virtual ~ToolsMenuModel(); 64 virtual ~ToolsMenuModel();
64 65
65 private: 66 private:
66 void Build(Browser* browser); 67 void Build(Browser* browser);
67 68
68 scoped_ptr<EncodingMenuModel> encoding_menu_model_; 69 scoped_ptr<EncodingMenuModel> encoding_menu_model_;
69 70
70 DISALLOW_COPY_AND_ASSIGN(ToolsMenuModel); 71 DISALLOW_COPY_AND_ASSIGN(ToolsMenuModel);
71 }; 72 };
72 73
73 class BookmarkSubMenuModel : public ui::SimpleMenuModel {
74 public:
75 BookmarkSubMenuModel(ui::SimpleMenuModel::Delegate* delegate,
76 Browser* browser);
77 virtual ~BookmarkSubMenuModel();
78
79 private:
80 void Build(Browser* browser);
81
82 DISALLOW_COPY_AND_ASSIGN(BookmarkSubMenuModel);
83 };
84
85 // A menu model that builds the contents of the wrench menu. 74 // A menu model that builds the contents of the wrench menu.
86 class WrenchMenuModel : public ui::SimpleMenuModel, 75 class WrenchMenuModel : public ui::SimpleMenuModel,
87 public ui::SimpleMenuModel::Delegate, 76 public ui::SimpleMenuModel::Delegate,
88 public ui::ButtonMenuItemModel::Delegate, 77 public ui::ButtonMenuItemModel::Delegate,
89 public TabStripModelObserver, 78 public TabStripModelObserver,
90 public NotificationObserver { 79 public NotificationObserver {
91 public: 80 public:
92 WrenchMenuModel(ui::AcceleratorProvider* provider, Browser* browser); 81 WrenchMenuModel(ui::AcceleratorProvider* provider, Browser* browser);
93 virtual ~WrenchMenuModel(); 82 virtual ~WrenchMenuModel();
94 83
(...skipping 25 matching lines...) Expand all
120 virtual void TabStripModelDeleted() OVERRIDE; 109 virtual void TabStripModelDeleted() OVERRIDE;
121 110
122 // Overridden from NotificationObserver: 111 // Overridden from NotificationObserver:
123 virtual void Observe(int type, 112 virtual void Observe(int type,
124 const NotificationSource& source, 113 const NotificationSource& source,
125 const NotificationDetails& details) OVERRIDE; 114 const NotificationDetails& details) OVERRIDE;
126 115
127 // Getters. 116 // Getters.
128 Browser* browser() const { return browser_; } 117 Browser* browser() const { return browser_; }
129 118
119 BookmarkSubMenuModel* bookmark_sub_menu_model() const {
120 return bookmark_sub_menu_model_.get();
121 }
122
130 // Calculates |zoom_label_| in response to a zoom change. 123 // Calculates |zoom_label_| in response to a zoom change.
131 void UpdateZoomControls(); 124 void UpdateZoomControls();
132 125
133 private: 126 private:
134 // Testing constructor used for mocking. 127 // Testing constructor used for mocking.
135 friend class ::MockWrenchMenuModel; 128 friend class ::MockWrenchMenuModel;
136 WrenchMenuModel(); 129 WrenchMenuModel();
137 130
138 void Build(); 131 void Build();
139 132
(...skipping 23 matching lines...) Expand all
163 156
164 Browser* browser_; // weak 157 Browser* browser_; // weak
165 TabStripModel* tabstrip_model_; // weak 158 TabStripModel* tabstrip_model_; // weak
166 159
167 NotificationRegistrar registrar_; 160 NotificationRegistrar registrar_;
168 161
169 DISALLOW_COPY_AND_ASSIGN(WrenchMenuModel); 162 DISALLOW_COPY_AND_ASSIGN(WrenchMenuModel);
170 }; 163 };
171 164
172 #endif // CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ 165 #endif // CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/bookmark_sub_menu_model.cc ('k') | chrome/browser/ui/toolbar/wrench_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698