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

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

Issue 549212: Merge 37417 - [Mac] Prevent scriptinitiated tab close while a content select ... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/307/src/
Patch Set: Created 10 years, 10 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 | no next file » | 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 #import "base/chrome_application_mac.h"
7 #include "base/histogram.h" 8 #include "base/histogram.h"
8 #import "base/scoped_nsobject.h" 9 #import "base/scoped_nsobject.h"
9 #include "base/string_util.h" 10 #include "base/string_util.h"
10 #include "base/sys_string_conversions.h" 11 #include "base/sys_string_conversions.h"
11 #include "chrome/browser/browser_trial.h" 12 #include "chrome/browser/browser_trial.h"
12 #import "chrome/browser/cocoa/rwhvm_editcommand_helper.h" 13 #import "chrome/browser/cocoa/rwhvm_editcommand_helper.h"
13 #include "chrome/browser/plugin_process_host.h" 14 #include "chrome/browser/plugin_process_host.h"
14 #include "chrome/browser/renderer_host/backing_store_mac.h" 15 #include "chrome/browser/renderer_host/backing_store_mac.h"
15 #include "chrome/browser/renderer_host/render_process_host.h" 16 #include "chrome/browser/renderer_host/render_process_host.h"
16 #include "chrome/browser/renderer_host/render_widget_host.h" 17 #include "chrome/browser/renderer_host/render_widget_host.h"
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 NSRect position = NSMakeRect(bounds.x(), parent_rect.size.height - y_offset, 408 NSRect position = NSMakeRect(bounds.x(), parent_rect.size.height - y_offset,
408 bounds.width(), bounds.height()); 409 bounds.width(), bounds.height());
409 410
410 // Display the menu. 411 // Display the menu.
411 scoped_nsobject<WebMenuRunner> menu_runner; 412 scoped_nsobject<WebMenuRunner> menu_runner;
412 menu_runner.reset([[WebMenuRunner alloc] initWithItems:items]); 413 menu_runner.reset([[WebMenuRunner alloc] initWithItems:items]);
413 414
414 { 415 {
415 // Make sure events can be pumped while the menu is up. 416 // Make sure events can be pumped while the menu is up.
416 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); 417 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
418
419 // One of the events that could be pumped is |window.close()|.
420 // User-initiated event-tracking loops protect against this by
421 // setting flags in -[CrApplication sendEvent:], but since
422 // web-content menus are initiated by IPC message the setup has to
423 // be done manually.
424 chrome_application_mac::ScopedSendingEvent sendingEventScoper;
425
417 // Now run a SYNCHRONOUS NESTED EVENT LOOP until the pop-up is finished. 426 // Now run a SYNCHRONOUS NESTED EVENT LOOP until the pop-up is finished.
418 [menu_runner runMenuInView:parent_view_ 427 [menu_runner runMenuInView:parent_view_
419 withBounds:position 428 withBounds:position
420 initialIndex:selected_item]; 429 initialIndex:selected_item];
421 } 430 }
422 431
423 if (!render_widget_host_) { 432 if (!render_widget_host_) {
424 // Bad news -- my Destroy() was called while I was off running the menu. 433 // Bad news -- my Destroy() was called while I was off running the menu.
425 // Return ASAP, and the release of retainedCocoaView will dealloc my NSView, 434 // Return ASAP, and the release of retainedCocoaView will dealloc my NSView,
426 // which will delete me (whew). 435 // which will delete me (whew).
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
1409 event.skip_in_browser = true; 1418 event.skip_in_browser = true;
1410 renderWidgetHostView_->render_widget_host_->ForwardKeyboardEvent(event); 1419 renderWidgetHostView_->render_widget_host_->ForwardKeyboardEvent(event);
1411 } else { 1420 } else {
1412 renderWidgetHostView_->render_widget_host_->ImeConfirmComposition( 1421 renderWidgetHostView_->render_widget_host_->ImeConfirmComposition(
1413 UTF8ToUTF16([im_text UTF8String])); 1422 UTF8ToUTF16([im_text UTF8String]));
1414 } 1423 }
1415 renderWidgetHostView_->im_composing_ = false; 1424 renderWidgetHostView_->im_composing_ = false;
1416 } 1425 }
1417 1426
1418 @end 1427 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698