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

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_mac.mm

Issue 99088: Style fixes for previous review (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/glue/webmenurunner_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" 5 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #include "base/histogram.h" 7 #include "base/histogram.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "chrome/browser/browser_trial.h" 9 #include "chrome/browser/browser_trial.h"
10 #include "chrome/browser/renderer_host/backing_store.h" 10 #include "chrome/browser/renderer_host/backing_store.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 int item_height, 275 int item_height,
276 int selected_item, 276 int selected_item,
277 const std::vector<WebMenuItem>& items) { 277 const std::vector<WebMenuItem>& items) {
278 NSRect view_rect = [cocoa_view_ bounds]; 278 NSRect view_rect = [cocoa_view_ bounds];
279 NSRect parent_rect = [parent_view_ bounds]; 279 NSRect parent_rect = [parent_view_ bounds];
280 int y_offset = bounds.y() + bounds.height(); 280 int y_offset = bounds.y() + bounds.height();
281 NSRect position = NSMakeRect(bounds.x(), parent_rect.size.height - y_offset, 281 NSRect position = NSMakeRect(bounds.x(), parent_rect.size.height - y_offset,
282 bounds.width(), bounds.height()); 282 bounds.width(), bounds.height());
283 283
284 // Display the menu. 284 // Display the menu.
285 WebMenuRunner* menu_runner = 285 scoped_nsobject<WebMenuRunner> menu_runner;
286 [[[WebMenuRunner alloc] initWithItems:items] autorelease]; 286 menu_runner.reset([[WebMenuRunner alloc] initWithItems:items]);
287 287
288 [menu_runner runMenuInView:parent_view_ 288 [menu_runner runMenuInView:parent_view_
289 withBounds:position 289 withBounds:position
290 initialIndex:selected_item]; 290 initialIndex:selected_item];
291 291
292 int window_num = [[parent_view_ window] windowNumber]; 292 int window_num = [[parent_view_ window] windowNumber];
293 NSEvent* event = CreateEventForMenuAction([menu_runner menuItemWasChosen], 293 NSEvent* event =
294 window_num, item_height, 294 webkit_glue::EventWithMenuAction([menu_runner menuItemWasChosen],
295 [menu_runner indexOfSelectedItem], 295 window_num, item_height,
296 position, view_rect); 296 [menu_runner indexOfSelectedItem],
297 position, view_rect);
297 298
298 if ([menu_runner menuItemWasChosen]) { 299 if ([menu_runner menuItemWasChosen]) {
299 // Simulate a menu selection event. 300 // Simulate a menu selection event.
300 const WebMouseEvent& mouse_event = 301 const WebMouseEvent& mouse_event =
301 WebInputEventFactory::mouseEvent(event, cocoa_view_); 302 WebInputEventFactory::mouseEvent(event, cocoa_view_);
302 render_widget_host_->ForwardMouseEvent(mouse_event); 303 render_widget_host_->ForwardMouseEvent(mouse_event);
303 } else { 304 } else {
304 // Simulate a menu dismiss event. 305 // Simulate a menu dismiss event.
305 NativeWebKeyboardEvent keyboard_event(event); 306 NativeWebKeyboardEvent keyboard_event(event);
306 render_widget_host_->ForwardKeyboardEvent(keyboard_event); 307 render_widget_host_->ForwardKeyboardEvent(keyboard_event);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 - (BOOL)resignFirstResponder { 462 - (BOOL)resignFirstResponder {
462 if (closeOnDeactivate_) 463 if (closeOnDeactivate_)
463 renderWidgetHostView_->KillSelf(); 464 renderWidgetHostView_->KillSelf();
464 465
465 renderWidgetHostView_->render_widget_host_->Blur(); 466 renderWidgetHostView_->render_widget_host_->Blur();
466 467
467 return YES; 468 return YES;
468 } 469 }
469 470
470 @end 471 @end
OLDNEW
« no previous file with comments | « no previous file | webkit/glue/webmenurunner_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698