OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/views/controls/menu/menu_controller.h" | 5 #include "ui/views/controls/menu/menu_controller.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 return menu_controller_->exit_type_; | 450 return menu_controller_->exit_type_; |
451 } | 451 } |
452 | 452 |
453 void AddButtonMenuItems() { | 453 void AddButtonMenuItems() { |
454 menu_item()->SetBounds(0, 0, 200, 300); | 454 menu_item()->SetBounds(0, 0, 200, 300); |
455 MenuItemView* item_view = | 455 MenuItemView* item_view = |
456 menu_item()->AppendMenuItemWithLabel(5, base::ASCIIToUTF16("Five")); | 456 menu_item()->AppendMenuItemWithLabel(5, base::ASCIIToUTF16("Five")); |
457 for (int i = 0; i < 3; ++i) { | 457 for (int i = 0; i < 3; ++i) { |
458 LabelButton* button = | 458 LabelButton* button = |
459 new LabelButton(nullptr, base::ASCIIToUTF16("Label")); | 459 new LabelButton(nullptr, base::ASCIIToUTF16("Label")); |
460 button->SetFocusable(true); | 460 // This is an in-menu button. Hence it must be always focusable. |
| 461 button->SetFocusBehavior(View::FocusBehavior::ALWAYS); |
461 item_view->AddChildView(button); | 462 item_view->AddChildView(button); |
462 } | 463 } |
463 menu_item()->GetSubmenu()->ShowAt(owner(), menu_item()->bounds(), false); | 464 menu_item()->GetSubmenu()->ShowAt(owner(), menu_item()->bounds(), false); |
464 } | 465 } |
465 | 466 |
466 CustomButton* GetHotButton() { | 467 CustomButton* GetHotButton() { |
467 return menu_controller_->hot_button_; | 468 return menu_controller_->hot_button_; |
468 } | 469 } |
469 | 470 |
470 void SetHotTrackedButton(CustomButton* hot_button) { | 471 void SetHotTrackedButton(CustomButton* hot_button) { |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1235 DestroyMenuControllerOnMenuClosed(nested_delegate.get()); | 1236 DestroyMenuControllerOnMenuClosed(nested_delegate.get()); |
1236 controller->OnGestureEvent(sub_menu, &event); | 1237 controller->OnGestureEvent(sub_menu, &event); |
1237 | 1238 |
1238 // Close to remove observers before test TearDown | 1239 // Close to remove observers before test TearDown |
1239 sub_menu->Close(); | 1240 sub_menu->Close(); |
1240 EXPECT_EQ(1, nested_delegate->on_menu_closed_called()); | 1241 EXPECT_EQ(1, nested_delegate->on_menu_closed_called()); |
1241 } | 1242 } |
1242 | 1243 |
1243 } // namespace test | 1244 } // namespace test |
1244 } // namespace views | 1245 } // namespace views |
OLD | NEW |