Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: ui/views/controls/menu/menu_runner_impl_cocoa.mm

Issue 1975533002: Change ui::Event::time_stamp from TimeDelta to TimeTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge master Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/event_utils.h" 10 #include "ui/events/event_utils.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 (run_types & MenuRunner::IS_NESTED) == 0) { 88 (run_types & MenuRunner::IS_NESTED) == 0) {
89 return new MenuRunnerImplCocoa(menu_model); 89 return new MenuRunnerImplCocoa(menu_model);
90 } 90 }
91 91
92 return new MenuRunnerImplAdapter(menu_model); 92 return new MenuRunnerImplAdapter(menu_model);
93 } 93 }
94 94
95 MenuRunnerImplCocoa::MenuRunnerImplCocoa(ui::MenuModel* menu) 95 MenuRunnerImplCocoa::MenuRunnerImplCocoa(ui::MenuModel* menu)
96 : running_(false), 96 : running_(false),
97 delete_after_run_(false), 97 delete_after_run_(false),
98 closing_event_time_(base::TimeDelta()) { 98 closing_event_time_(base::TimeDelta()) {
sky 2016/05/27 15:56:03 Change to TimeTicks?
majidvp 2016/05/27 16:49:22 I have a TODO in menu_controller.h to do this in a
99 menu_controller_.reset( 99 menu_controller_.reset(
100 [[MenuController alloc] initWithModel:menu useWithPopUpButtonCell:NO]); 100 [[MenuController alloc] initWithModel:menu useWithPopUpButtonCell:NO]);
101 } 101 }
102 102
103 bool MenuRunnerImplCocoa::IsRunning() const { 103 bool MenuRunnerImplCocoa::IsRunning() const {
104 return running_; 104 return running_;
105 } 105 }
106 106
107 void MenuRunnerImplCocoa::Release() { 107 void MenuRunnerImplCocoa::Release() {
108 if (IsRunning()) { 108 if (IsRunning()) {
(...skipping 29 matching lines...) Expand all
138 NSMenu* menu = [menu_controller_ menu]; 138 NSMenu* menu = [menu_controller_ menu];
139 [menu setMinimumWidth:bounds.width() + kNativeCheckmarkWidth]; 139 [menu setMinimumWidth:bounds.width() + kNativeCheckmarkWidth];
140 [menu popUpMenuPositioningItem:checked_item 140 [menu popUpMenuPositioningItem:checked_item
141 atLocation:NSZeroPoint 141 atLocation:NSZeroPoint
142 inView:anchor_view]; 142 inView:anchor_view];
143 [anchor_view removeFromSuperview]; 143 [anchor_view removeFromSuperview];
144 } else { 144 } else {
145 NOTREACHED(); 145 NOTREACHED();
146 } 146 }
147 147
148 closing_event_time_ = ui::EventTimeForNow(); 148 closing_event_time_ = (base::TimeTicks::Now() - base::TimeTicks());
149 running_ = false; 149 running_ = false;
150 150
151 if (delete_after_run_) { 151 if (delete_after_run_) {
152 delete this; 152 delete this;
153 return MenuRunner::MENU_DELETED; 153 return MenuRunner::MENU_DELETED;
154 } 154 }
155 155
156 return MenuRunner::NORMAL_EXIT; 156 return MenuRunner::NORMAL_EXIT;
157 } 157 }
158 158
159 void MenuRunnerImplCocoa::Cancel() { 159 void MenuRunnerImplCocoa::Cancel() {
160 [menu_controller_ cancel]; 160 [menu_controller_ cancel];
161 } 161 }
162 162
163 base::TimeDelta MenuRunnerImplCocoa::GetClosingEventTime() const { 163 base::TimeDelta MenuRunnerImplCocoa::GetClosingEventTime() const {
164 return closing_event_time_; 164 return closing_event_time_;
165 } 165 }
166 166
167 MenuRunnerImplCocoa::~MenuRunnerImplCocoa() { 167 MenuRunnerImplCocoa::~MenuRunnerImplCocoa() {
168 } 168 }
169 169
170 } // namespace internal 170 } // namespace internal
171 } // namespace views 171 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_runner_cocoa_unittest.mm ('k') | ui/views/controls/table/table_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698