| 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/base_event_utils.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 MenuRunnerImplCocoa::MenuRunnerImplCocoa( | 97 MenuRunnerImplCocoa::MenuRunnerImplCocoa( |
| 98 ui::MenuModel* menu, | 98 ui::MenuModel* menu, |
| 99 const base::Closure& on_menu_closed_callback) | 99 const base::Closure& on_menu_closed_callback) |
| 100 : running_(false), | 100 : running_(false), |
| 101 delete_after_run_(false), | 101 delete_after_run_(false), |
| 102 closing_event_time_(base::TimeTicks()), | 102 closing_event_time_(base::TimeTicks()), |
| 103 on_menu_closed_callback_(on_menu_closed_callback) { | 103 on_menu_closed_callback_(on_menu_closed_callback) { |
| 104 menu_controller_.reset( | 104 menu_controller_.reset( |
| 105 [[MenuController alloc] initWithModel:menu useWithPopUpButtonCell:NO]); | 105 [[MenuController alloc] initWithModel:menu useWithPopUpButtonCell:NO]); |
| 106 [menu_controller_ setPostItemSelectedAsTask:YES]; |
| 106 } | 107 } |
| 107 | 108 |
| 108 bool MenuRunnerImplCocoa::IsRunning() const { | 109 bool MenuRunnerImplCocoa::IsRunning() const { |
| 109 return running_; | 110 return running_; |
| 110 } | 111 } |
| 111 | 112 |
| 112 void MenuRunnerImplCocoa::Release() { | 113 void MenuRunnerImplCocoa::Release() { |
| 113 if (IsRunning()) { | 114 if (IsRunning()) { |
| 114 if (delete_after_run_) | 115 if (delete_after_run_) |
| 115 return; // We already canceled. | 116 return; // We already canceled. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 171 |
| 171 base::TimeTicks MenuRunnerImplCocoa::GetClosingEventTime() const { | 172 base::TimeTicks MenuRunnerImplCocoa::GetClosingEventTime() const { |
| 172 return closing_event_time_; | 173 return closing_event_time_; |
| 173 } | 174 } |
| 174 | 175 |
| 175 MenuRunnerImplCocoa::~MenuRunnerImplCocoa() { | 176 MenuRunnerImplCocoa::~MenuRunnerImplCocoa() { |
| 176 } | 177 } |
| 177 | 178 |
| 178 } // namespace internal | 179 } // namespace internal |
| 179 } // namespace views | 180 } // namespace views |
| OLD | NEW |