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

Side by Side Diff: content/browser/web_contents/web_contents_view_mac.mm

Issue 10966023: Fix the crash that could occur when the window is closed while web contents drag is in progress. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch to land Created 8 years, 2 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
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 <Carbon/Carbon.h> 5 #import <Carbon/Carbon.h>
6 6
7 #import "content/browser/web_contents/web_contents_view_mac.h" 7 #import "content/browser/web_contents/web_contents_view_mac.h"
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 // TODO(shess): If location-bar gets focus by default, this will 243 // TODO(shess): If location-bar gets focus by default, this will
244 // select-all in the field. If there was a specific selection in 244 // select-all in the field. If there was a specific selection in
245 // the field when we navigated away from it, we should restore 245 // the field when we navigated away from it, we should restore
246 // that selection. 246 // that selection.
247 SetInitialFocus(); 247 SetInitialFocus();
248 } 248 }
249 249
250 focus_tracker_.reset(nil); 250 focus_tracker_.reset(nil);
251 } 251 }
252 252
253 bool WebContentsViewMac::IsDoingDrag() const {
254 return false;
255 }
256
257 void WebContentsViewMac::CancelDragAndCloseTab() {
258 }
259
260 WebDropData* WebContentsViewMac::GetDropData() const { 253 WebDropData* WebContentsViewMac::GetDropData() const {
261 return [cocoa_view_ dropData]; 254 return [cocoa_view_ dropData];
262 } 255 }
263 256
264 void WebContentsViewMac::UpdateDragCursor(WebDragOperation operation) { 257 void WebContentsViewMac::UpdateDragCursor(WebDragOperation operation) {
265 [cocoa_view_ setCurrentDragOperation: operation]; 258 [cocoa_view_ setCurrentDragOperation: operation];
266 } 259 }
267 260
268 void WebContentsViewMac::GotFocus() { 261 void WebContentsViewMac::GotFocus() {
269 // This is only used in the views FocusManager stuff but it bleeds through 262 // This is only used in the views FocusManager stuff but it bleeds through
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 501
509 - (void)cancelDeferredClose { 502 - (void)cancelDeferredClose {
510 SEL aSel = @selector(closeTabAfterEvent); 503 SEL aSel = @selector(closeTabAfterEvent);
511 [NSObject cancelPreviousPerformRequestsWithTarget:self 504 [NSObject cancelPreviousPerformRequestsWithTarget:self
512 selector:aSel 505 selector:aSel
513 object:nil]; 506 object:nil];
514 } 507 }
515 508
516 - (void)clearWebContentsView { 509 - (void)clearWebContentsView {
517 webContentsView_ = NULL; 510 webContentsView_ = NULL;
511 [dragSource_ clearWebContentsView];
518 } 512 }
519 513
520 - (void)closeTabAfterEvent { 514 - (void)closeTabAfterEvent {
521 webContentsView_->CloseTab(); 515 webContentsView_->CloseTab();
522 } 516 }
523 517
524 - (void)viewDidBecomeFirstResponder:(NSNotification*)notification { 518 - (void)viewDidBecomeFirstResponder:(NSNotification*)notification {
525 NSView* view = [notification object]; 519 NSView* view = [notification object];
526 if (![[self subviews] containsObject:view]) 520 if (![[self subviews] containsObject:view])
527 return; 521 return;
528 522
529 NSSelectionDirection direction = 523 NSSelectionDirection direction =
530 [[[notification userInfo] objectForKey:kSelectionDirection] 524 [[[notification userInfo] objectForKey:kSelectionDirection]
531 unsignedIntegerValue]; 525 unsignedIntegerValue];
532 if (direction == NSDirectSelection) 526 if (direction == NSDirectSelection)
533 return; 527 return;
534 528
535 [self webContents]-> 529 [self webContents]->
536 FocusThroughTabTraversal(direction == NSSelectingPrevious); 530 FocusThroughTabTraversal(direction == NSSelectingPrevious);
537 } 531 }
538 532
539 @end 533 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698