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

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

Issue 7720012: Moves ownership of MenuItemView to MenuRunner as well as responbility (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit test Created 9 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 | 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 #include "chrome/browser/ui/views/toolbar_view.h" 5 #include "chrome/browser/ui/views/toolbar_view.h"
6 6
7 #include "base/i18n/number_formatting.h" 7 #include "base/i18n/number_formatting.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 bool ToolbarView::GetAcceleratorInfo(int id, ui::Accelerator* accel) { 321 bool ToolbarView::GetAcceleratorInfo(int id, ui::Accelerator* accel) {
322 return GetWidget()->GetAccelerator(id, accel); 322 return GetWidget()->GetAccelerator(id, accel);
323 } 323 }
324 324
325 //////////////////////////////////////////////////////////////////////////////// 325 ////////////////////////////////////////////////////////////////////////////////
326 // ToolbarView, views::MenuDelegate implementation: 326 // ToolbarView, views::MenuDelegate implementation:
327 327
328 void ToolbarView::RunMenu(views::View* source, const gfx::Point& /* pt */) { 328 void ToolbarView::RunMenu(views::View* source, const gfx::Point& /* pt */) {
329 DCHECK_EQ(VIEW_ID_APP_MENU, source->id()); 329 DCHECK_EQ(VIEW_ID_APP_MENU, source->id());
330 330
331 wrench_menu_ = new WrenchMenu(browser_); 331 wrench_menu_.reset(new WrenchMenu(browser_));
332 wrench_menu_->Init(wrench_menu_model_.get()); 332 wrench_menu_->Init(wrench_menu_model_.get());
333 333
334 for (size_t i = 0; i < menu_listeners_.size(); ++i) 334 for (size_t i = 0; i < menu_listeners_.size(); ++i)
335 menu_listeners_[i]->OnMenuOpened(); 335 menu_listeners_[i]->OnMenuOpened();
336 336
337 wrench_menu_->RunMenu(app_menu_); 337 wrench_menu_->RunMenu(app_menu_);
338 } 338 }
339 339
340 //////////////////////////////////////////////////////////////////////////////// 340 ////////////////////////////////////////////////////////////////////////////////
341 // ToolbarView, LocationBarView::Delegate implementation: 341 // ToolbarView, LocationBarView::Delegate implementation:
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); 688 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT));
689 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); 689 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED));
690 } 690 }
691 691
692 void ToolbarView::UpdateAppMenuBadge() { 692 void ToolbarView::UpdateAppMenuBadge() {
693 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); 693 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL));
694 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); 694 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT));
695 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); 695 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED));
696 SchedulePaint(); 696 SchedulePaint();
697 } 697 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698