| 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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 return menu_controller_->exit_type_; | 436 return menu_controller_->exit_type_; |
| 437 } | 437 } |
| 438 | 438 |
| 439 void AddButtonMenuItems() { | 439 void AddButtonMenuItems() { |
| 440 menu_item()->SetBounds(0, 0, 200, 300); | 440 menu_item()->SetBounds(0, 0, 200, 300); |
| 441 MenuItemView* item_view = | 441 MenuItemView* item_view = |
| 442 menu_item()->AppendMenuItemWithLabel(5, base::ASCIIToUTF16("Five")); | 442 menu_item()->AppendMenuItemWithLabel(5, base::ASCIIToUTF16("Five")); |
| 443 for (int i = 0; i < 3; ++i) { | 443 for (int i = 0; i < 3; ++i) { |
| 444 LabelButton* button = | 444 LabelButton* button = |
| 445 new LabelButton(nullptr, base::ASCIIToUTF16("Label")); | 445 new LabelButton(nullptr, base::ASCIIToUTF16("Label")); |
| 446 // This is an in-menu button. Hence it must be always focusable. |
| 446 button->SetFocusBehavior(View::FocusBehavior::ALWAYS); | 447 button->SetFocusBehavior(View::FocusBehavior::ALWAYS); |
| 447 item_view->AddChildView(button); | 448 item_view->AddChildView(button); |
| 448 } | 449 } |
| 449 menu_item()->GetSubmenu()->ShowAt(owner(), menu_item()->bounds(), false); | 450 menu_item()->GetSubmenu()->ShowAt(owner(), menu_item()->bounds(), false); |
| 450 } | 451 } |
| 451 | 452 |
| 452 CustomButton* GetHotButton() { | 453 CustomButton* GetHotButton() { |
| 453 return menu_controller_->hot_button_; | 454 return menu_controller_->hot_button_; |
| 454 } | 455 } |
| 455 | 456 |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 // This creates a nested message loop. | 1245 // This creates a nested message loop. |
| 1245 EXPECT_EQ(nullptr, menu_controller()->Run(owner(), nullptr, menu_item(), | 1246 EXPECT_EQ(nullptr, menu_controller()->Run(owner(), nullptr, menu_item(), |
| 1246 gfx::Rect(), MENU_ANCHOR_TOPLEFT, | 1247 gfx::Rect(), MENU_ANCHOR_TOPLEFT, |
| 1247 false, false, &result_event_flags)); | 1248 false, false, &result_event_flags)); |
| 1248 EXPECT_FALSE(menu_controller_delegate()->on_menu_closed_called()); | 1249 EXPECT_FALSE(menu_controller_delegate()->on_menu_closed_called()); |
| 1249 EXPECT_TRUE(nested_delegate->on_menu_closed_called()); | 1250 EXPECT_TRUE(nested_delegate->on_menu_closed_called()); |
| 1250 } | 1251 } |
| 1251 | 1252 |
| 1252 } // namespace test | 1253 } // namespace test |
| 1253 } // namespace views | 1254 } // namespace views |
| OLD | NEW |