| 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 #import "ui/views/controls/menu/menu_runner_impl_cocoa.h" | 5 #import "ui/views/controls/menu/menu_runner_impl_cocoa.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 } | 28 } |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 class Delegate : public ui::SimpleMenuModel::Delegate { | 31 class Delegate : public ui::SimpleMenuModel::Delegate { |
| 32 public: | 32 public: |
| 33 explicit Delegate(TestModel* model) : model_(model) {} | 33 explicit Delegate(TestModel* model) : model_(model) {} |
| 34 bool IsCommandIdChecked(int command_id) const override { | 34 bool IsCommandIdChecked(int command_id) const override { |
| 35 return command_id == model_->checked_command_; | 35 return command_id == model_->checked_command_; |
| 36 } | 36 } |
| 37 bool IsCommandIdEnabled(int command_id) const override { return true; } | 37 bool IsCommandIdEnabled(int command_id) const override { return true; } |
| 38 bool GetAcceleratorForCommandId(int command_id, | 38 bool GetAcceleratorForCommandId( |
| 39 ui::Accelerator* accelerator) override { | 39 int command_id, |
| 40 ui::Accelerator* accelerator) const override { |
| 40 return false; | 41 return false; |
| 41 } | 42 } |
| 42 void ExecuteCommand(int command_id, int event_flags) override {} | 43 void ExecuteCommand(int command_id, int event_flags) override {} |
| 43 | 44 |
| 44 void MenuWillShow(SimpleMenuModel* source) override { | 45 void MenuWillShow(SimpleMenuModel* source) override { |
| 45 model_->menu_open_callback_.Run(); | 46 model_->menu_open_callback_.Run(); |
| 46 } | 47 } |
| 47 | 48 |
| 48 private: | 49 private: |
| 49 TestModel* model_; | 50 TestModel* model_; |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 // In RTL, Cocoa messes up the positioning unless the anchor rectangle is | 258 // In RTL, Cocoa messes up the positioning unless the anchor rectangle is |
| 258 // offset to the right of the view. The offset for the checkmark is also | 259 // offset to the right of the view. The offset for the checkmark is also |
| 259 // skipped, to give a better match to native behavior. | 260 // skipped, to give a better match to native behavior. |
| 260 base::i18n::SetICUDefaultLocale("he"); | 261 base::i18n::SetICUDefaultLocale("he"); |
| 261 RunMenuAt(anchor_rect); | 262 RunMenuAt(anchor_rect); |
| 262 EXPECT_EQ(combobox_rect.right(), last_anchor_frame_.origin.x); | 263 EXPECT_EQ(combobox_rect.right(), last_anchor_frame_.origin.x); |
| 263 } | 264 } |
| 264 | 265 |
| 265 } // namespace test | 266 } // namespace test |
| 266 } // namespace views | 267 } // namespace views |
| OLD | NEW |