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

Side by Side Diff: views/controls/menu/menu_item_view.cc

Issue 7067032: Add MenuModelAdapter to wrap ui::MenuModel with views::MenuDelegate interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Implemented reviewer recommendations. Created 9 years, 7 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
« no previous file with comments | « ui/base/models/menu_model.cc ('k') | views/controls/menu/menu_model_adapter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "views/controls/menu/menu_item_view.h" 5 #include "views/controls/menu/menu_item_view.h"
6 6
7 #include "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "base/stl_util-inl.h" 8 #include "base/stl_util-inl.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "grit/app_strings.h" 10 #include "grit/app_strings.h"
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 parent_menu_item_ = parent; 555 parent_menu_item_ = parent;
556 type_ = type; 556 type_ = type;
557 selected_ = false; 557 selected_ = false;
558 command_ = command; 558 command_ = command;
559 submenu_ = NULL; 559 submenu_ = NULL;
560 show_mnemonics_ = false; 560 show_mnemonics_ = false;
561 // Assign our ID, this allows SubmenuItemView to find MenuItemViews. 561 // Assign our ID, this allows SubmenuItemView to find MenuItemViews.
562 SetID(kMenuItemViewID); 562 SetID(kMenuItemViewID);
563 has_icons_ = false; 563 has_icons_ = false;
564 564
565 // Don't request enabled status from the root menu item as it is just
566 // a container for real items.
565 MenuDelegate* root_delegate = GetDelegate(); 567 MenuDelegate* root_delegate = GetDelegate();
566 if (root_delegate) 568 if (parent && root_delegate)
567 SetEnabled(root_delegate->IsCommandEnabled(command)); 569 SetEnabled(root_delegate->IsCommandEnabled(command));
568 } 570 }
569 571
570 void MenuItemView::DropMenuClosed(bool notify_delegate) { 572 void MenuItemView::DropMenuClosed(bool notify_delegate) {
571 DCHECK(controller_); 573 DCHECK(controller_);
572 DCHECK(!controller_->IsBlockingRun()); 574 DCHECK(!controller_->IsBlockingRun());
573 if (MenuController::GetActiveInstance() == controller_) 575 if (MenuController::GetActiveInstance() == controller_)
574 MenuController::SetActiveInstance(NULL); 576 MenuController::SetActiveInstance(NULL);
575 delete controller_; 577 delete controller_;
576 controller_ = NULL; 578 controller_ = NULL;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 } 740 }
739 741
740 string16 MenuItemView::GetAcceleratorText() { 742 string16 MenuItemView::GetAcceleratorText() {
741 Accelerator accelerator; 743 Accelerator accelerator;
742 return (GetDelegate() && 744 return (GetDelegate() &&
743 GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ? 745 GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ?
744 accelerator.GetShortcutText() : string16(); 746 accelerator.GetShortcutText() : string16();
745 } 747 }
746 748
747 } // namespace views 749 } // namespace views
OLDNEW
« no previous file with comments | « ui/base/models/menu_model.cc ('k') | views/controls/menu/menu_model_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698