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

Side by Side Diff: chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.mm

Issue 44543002: Enable touch for autofill popup view (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Improved comments Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h" 5 #import "chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" 9 #include "chrome/browser/ui/autofill/autofill_popup_controller.h"
10 #include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h" 10 #include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 - (void)mouseUp:(NSEvent*)theEvent { 152 - (void)mouseUp:(NSEvent*)theEvent {
153 // If the view is in the process of being destroyed, abort. 153 // If the view is in the process of being destroyed, abort.
154 if (!controller_) 154 if (!controller_)
155 return; 155 return;
156 156
157 NSPoint location = [self convertPoint:[theEvent locationInWindow] 157 NSPoint location = [self convertPoint:[theEvent locationInWindow]
158 fromView:nil]; 158 fromView:nil];
159 159
160 if (NSPointInRect(location, [self bounds])) { 160 if (NSPointInRect(location, [self bounds])) {
161 controller_->MouseClicked(static_cast<int>(location.x), 161 controller_->LineAcceptedAtPoint(static_cast<int>(location.x),
162 static_cast<int>(location.y)); 162 static_cast<int>(location.y));
163 } 163 }
164 } 164 }
165 165
166 - (void)mouseMoved:(NSEvent*)theEvent { 166 - (void)mouseMoved:(NSEvent*)theEvent {
167 // If the view is in the process of being destroyed, abort. 167 // If the view is in the process of being destroyed, abort.
168 if (!controller_) 168 if (!controller_)
169 return; 169 return;
170 170
171 NSPoint location = [self convertPoint:[theEvent locationInWindow] 171 NSPoint location = [self convertPoint:[theEvent locationInWindow]
172 fromView:nil]; 172 fromView:nil];
173 173
174 controller_->MouseHovered(static_cast<int>(location.x), 174 controller_->LineSelectedAtPoint(static_cast<int>(location.x),
175 static_cast<int>(location.y)); 175 static_cast<int>(location.y));
176 } 176 }
177 177
178 - (void)mouseDragged:(NSEvent*)theEvent { 178 - (void)mouseDragged:(NSEvent*)theEvent {
179 [self mouseMoved:theEvent]; 179 [self mouseMoved:theEvent];
180 } 180 }
181 181
182 - (void)mouseExited:(NSEvent*)theEvent { 182 - (void)mouseExited:(NSEvent*)theEvent {
183 // If the view is in the process of being destroyed, abort. 183 // If the view is in the process of being destroyed, abort.
184 if (!controller_) 184 if (!controller_)
185 return; 185 return;
186 186
187 controller_->MouseExitedPopup(); 187 controller_->SelectionCleared();
188 } 188 }
189 189
190 #pragma mark - 190 #pragma mark -
191 #pragma mark Public API: 191 #pragma mark Public API:
192 192
193 - (void)controllerDestroyed { 193 - (void)controllerDestroyed {
194 // Since the |controller_| either already has been destroyed or is about to 194 // Since the |controller_| either already has been destroyed or is about to
195 // be, about the only thing we can safely do with it is to null it out. 195 // be, about the only thing we can safely do with it is to null it out.
196 controller_ = NULL; 196 controller_ = NULL;
197 } 197 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 return nil; 275 return nil;
276 276
277 int iconId = controller_->GetIconResourceID(controller_->icons()[index]); 277 int iconId = controller_->GetIconResourceID(controller_->icons()[index]);
278 DCHECK_NE(-1, iconId); 278 DCHECK_NE(-1, iconId);
279 279
280 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 280 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
281 return rb.GetNativeImageNamed(iconId).ToNSImage(); 281 return rb.GetNativeImageNamed(iconId).ToNSImage();
282 } 282 }
283 283
284 @end 284 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698