| 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 #include "base/mac/sdk_forward_declarations.h" | 7 #include "base/mac/sdk_forward_declarations.h" |
| 8 #import "ui/base/cocoa/menu_controller.h" | 8 #import "ui/base/cocoa/menu_controller.h" |
| 9 #include "ui/base/models/menu_model.h" | 9 #include "ui/base/models/menu_model.h" |
| 10 #include "ui/events/base_event_utils.h" |
| 10 #include "ui/events/event_utils.h" | 11 #include "ui/events/event_utils.h" |
| 11 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
| 12 #include "ui/gfx/mac/coordinate_conversion.h" | 13 #include "ui/gfx/mac/coordinate_conversion.h" |
| 13 #include "ui/views/controls/menu/menu_runner_impl_adapter.h" | 14 #include "ui/views/controls/menu/menu_runner_impl_adapter.h" |
| 14 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
| 15 | 16 |
| 16 namespace views { | 17 namespace views { |
| 17 namespace internal { | 18 namespace internal { |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 NSMenu* menu = [menu_controller_ menu]; | 139 NSMenu* menu = [menu_controller_ menu]; |
| 139 [menu setMinimumWidth:bounds.width() + kNativeCheckmarkWidth]; | 140 [menu setMinimumWidth:bounds.width() + kNativeCheckmarkWidth]; |
| 140 [menu popUpMenuPositioningItem:checked_item | 141 [menu popUpMenuPositioningItem:checked_item |
| 141 atLocation:NSZeroPoint | 142 atLocation:NSZeroPoint |
| 142 inView:anchor_view]; | 143 inView:anchor_view]; |
| 143 [anchor_view removeFromSuperview]; | 144 [anchor_view removeFromSuperview]; |
| 144 } else { | 145 } else { |
| 145 NOTREACHED(); | 146 NOTREACHED(); |
| 146 } | 147 } |
| 147 | 148 |
| 148 closing_event_time_ = base::TimeTicks::Now(); | 149 closing_event_time_ = ui::EventTimeForNow(); |
| 149 running_ = false; | 150 running_ = false; |
| 150 | 151 |
| 151 if (delete_after_run_) { | 152 if (delete_after_run_) { |
| 152 delete this; | 153 delete this; |
| 153 return MenuRunner::MENU_DELETED; | 154 return MenuRunner::MENU_DELETED; |
| 154 } | 155 } |
| 155 | 156 |
| 156 return MenuRunner::NORMAL_EXIT; | 157 return MenuRunner::NORMAL_EXIT; |
| 157 } | 158 } |
| 158 | 159 |
| 159 void MenuRunnerImplCocoa::Cancel() { | 160 void MenuRunnerImplCocoa::Cancel() { |
| 160 [menu_controller_ cancel]; | 161 [menu_controller_ cancel]; |
| 161 } | 162 } |
| 162 | 163 |
| 163 base::TimeTicks MenuRunnerImplCocoa::GetClosingEventTime() const { | 164 base::TimeTicks MenuRunnerImplCocoa::GetClosingEventTime() const { |
| 164 return closing_event_time_; | 165 return closing_event_time_; |
| 165 } | 166 } |
| 166 | 167 |
| 167 MenuRunnerImplCocoa::~MenuRunnerImplCocoa() { | 168 MenuRunnerImplCocoa::~MenuRunnerImplCocoa() { |
| 168 } | 169 } |
| 169 | 170 |
| 170 } // namespace internal | 171 } // namespace internal |
| 171 } // namespace views | 172 } // namespace views |
| OLD | NEW |