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

Side by Side Diff: chrome/browser/views/toolbar_view.cc

Issue 126092: Begin to upgrade BackForwardMenuModelViews to use new menu API.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #include "chrome/browser/views/toolbar_view.h" 5 #include "chrome/browser/views/toolbar_view.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "app/drag_drop_types.h" 9 #include "app/drag_drop_types.h"
10 #include "app/gfx/canvas.h" 10 #include "app/gfx/canvas.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 browser_(browser), 172 browser_(browser),
173 tab_(NULL), 173 tab_(NULL),
174 profiles_menu_contents_(NULL), 174 profiles_menu_contents_(NULL),
175 ALLOW_THIS_IN_INITIALIZER_LIST( 175 ALLOW_THIS_IN_INITIALIZER_LIST(
176 profiles_helper_(new GetProfilesHelper(this))) { 176 profiles_helper_(new GetProfilesHelper(this))) {
177 browser_->command_updater()->AddCommandObserver(IDC_BACK, this); 177 browser_->command_updater()->AddCommandObserver(IDC_BACK, this);
178 browser_->command_updater()->AddCommandObserver(IDC_FORWARD, this); 178 browser_->command_updater()->AddCommandObserver(IDC_FORWARD, this);
179 browser_->command_updater()->AddCommandObserver(IDC_RELOAD, this); 179 browser_->command_updater()->AddCommandObserver(IDC_RELOAD, this);
180 browser_->command_updater()->AddCommandObserver(IDC_HOME, this); 180 browser_->command_updater()->AddCommandObserver(IDC_HOME, this);
181 browser_->command_updater()->AddCommandObserver(IDC_STAR, this); 181 browser_->command_updater()->AddCommandObserver(IDC_STAR, this);
182 back_menu_model_.reset(new BackForwardMenuModelViews(
183 browser, BackForwardMenuModel::BACKWARD_MENU_DELEGATE));
184 forward_menu_model_.reset(new BackForwardMenuModelViews(
185 browser, BackForwardMenuModel::FORWARD_MENU_DELEGATE));
186 if (browser->type() == Browser::TYPE_NORMAL) 182 if (browser->type() == Browser::TYPE_NORMAL)
187 display_mode_ = DISPLAYMODE_NORMAL; 183 display_mode_ = DISPLAYMODE_NORMAL;
188 else 184 else
189 display_mode_ = DISPLAYMODE_LOCATION; 185 display_mode_ = DISPLAYMODE_LOCATION;
190 186
191 if (!kPopupBackgroundEdge) { 187 if (!kPopupBackgroundEdge) {
192 kPopupBackgroundEdge = ResourceBundle::GetSharedInstance().GetBitmapNamed( 188 kPopupBackgroundEdge = ResourceBundle::GetSharedInstance().GetBitmapNamed(
193 IDR_LOCATIONBG_POPUPMODE_EDGE); 189 IDR_LOCATIONBG_POPUPMODE_EDGE);
194 } 190 }
195 } 191 }
196 192
197 ToolbarView::~ToolbarView() { 193 ToolbarView::~ToolbarView() {
198 profiles_helper_->OnDelegateDeleted(); 194 profiles_helper_->OnDelegateDeleted();
199 } 195 }
200 196
201 void ToolbarView::Init(Profile* profile) { 197 void ToolbarView::Init(Profile* profile) {
198 back_menu_model_.reset(new BackForwardMenuModelViews(
199 browser_, BackForwardMenuModel::BACKWARD_MENU, GetWidget()));
200 forward_menu_model_.reset(new BackForwardMenuModelViews(
201 browser_, BackForwardMenuModel::FORWARD_MENU, GetWidget()));
202
202 // Create all the individual Views in the Toolbar. 203 // Create all the individual Views in the Toolbar.
203 CreateLeftSideControls(); 204 CreateLeftSideControls();
204 CreateCenterStack(profile); 205 CreateCenterStack(profile);
205 CreateRightSideControls(profile); 206 CreateRightSideControls(profile);
206 207
207 show_home_button_.Init(prefs::kShowHomeButton, profile->GetPrefs(), this); 208 show_home_button_.Init(prefs::kShowHomeButton, profile->GetPrefs(), this);
208 209
209 SetProfile(profile); 210 SetProfile(profile);
210 } 211 }
211 212
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 app_menu_contents_->AddItem(IDC_ABOUT, 1096 app_menu_contents_->AddItem(IDC_ABOUT,
1096 l10n_util::GetStringF( 1097 l10n_util::GetStringF(
1097 IDS_ABOUT, 1098 IDS_ABOUT,
1098 l10n_util::GetString(IDS_PRODUCT_NAME))); 1099 l10n_util::GetString(IDS_PRODUCT_NAME)));
1099 app_menu_contents_->AddItemWithStringId(IDC_HELP_PAGE, IDS_HELP_PAGE); 1100 app_menu_contents_->AddItemWithStringId(IDC_HELP_PAGE, IDS_HELP_PAGE);
1100 app_menu_contents_->AddSeparator(); 1101 app_menu_contents_->AddSeparator();
1101 app_menu_contents_->AddItemWithStringId(IDC_EXIT, IDS_EXIT); 1102 app_menu_contents_->AddItemWithStringId(IDC_EXIT, IDS_EXIT);
1102 1103
1103 app_menu_menu_.reset(new views::Menu2(app_menu_contents_.get())); 1104 app_menu_menu_.reset(new views::Menu2(app_menu_contents_.get()));
1104 } 1105 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698