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

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

Issue 7520037: [cros] Network dropdown button in WebUI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move handle click 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 "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.h" 8 #include "base/stl_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "grit/ui_strings.h" 10 #include "grit/ui_strings.h"
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 SubmenuView* MenuItemView::CreateSubmenu() { 348 SubmenuView* MenuItemView::CreateSubmenu() {
349 if (!submenu_) 349 if (!submenu_)
350 submenu_ = new SubmenuView(this); 350 submenu_ = new SubmenuView(this);
351 return submenu_; 351 return submenu_;
352 } 352 }
353 353
354 bool MenuItemView::HasSubmenu() const { 354 bool MenuItemView::HasSubmenu() const {
355 return (submenu_ != NULL); 355 return (submenu_ != NULL);
356 } 356 }
357 357
358 void MenuItemView::ClearSubmenu() {
359 if (HasSubmenu()) {
360 const int old_count = GetSubmenu()->child_count();
361 for (int i = 0; i < old_count; ++i)
362 RemoveMenuItemAt(0);
363 }
364 }
365
358 SubmenuView* MenuItemView::GetSubmenu() const { 366 SubmenuView* MenuItemView::GetSubmenu() const {
359 return submenu_; 367 return submenu_;
360 } 368 }
361 369
362 void MenuItemView::SetTitle(const std::wstring& title) { 370 void MenuItemView::SetTitle(const std::wstring& title) {
363 title_ = WideToUTF16Hack(title); 371 title_ = WideToUTF16Hack(title);
364 accessible_name_ = GetAccessibleNameForMenuItem(title_, GetAcceleratorText()); 372 accessible_name_ = GetAccessibleNameForMenuItem(title_, GetAcceleratorText());
365 pref_size_.SetSize(0, 0); // Triggers preferred size recalculation. 373 pref_size_.SetSize(0, 0); // Triggers preferred size recalculation.
366 } 374 }
367 375
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 return string16(); 774 return string16();
767 } 775 }
768 776
769 Accelerator accelerator; 777 Accelerator accelerator;
770 return (GetDelegate() && 778 return (GetDelegate() &&
771 GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ? 779 GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ?
772 accelerator.GetShortcutText() : string16(); 780 accelerator.GetShortcutText() : string16();
773 } 781 }
774 782
775 } // namespace views 783 } // namespace views
OLDNEW
« views/controls/menu/menu_item_view.h ('K') | « views/controls/menu/menu_item_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698