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

Side by Side Diff: chrome/browser/tab_contents/tab_contents_view_mac.mm

Issue 8724004: [Mac] Move ScopedSendingEvent from content/common/mac to base/mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add CrAppControlProtocol support to CrDrtApplication Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" 7 #include "chrome/browser/tab_contents/tab_contents_view_mac.h"
8 8
9 #include <string> 9 #include <string>
10 10
11 #import "base/mac/scoped_sending_event.h"
11 #import "chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegat e.h" 12 #import "chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegat e.h"
12 #include "chrome/browser/tab_contents/render_view_context_menu_mac.h" 13 #include "chrome/browser/tab_contents/render_view_context_menu_mac.h"
13 #include "chrome/browser/tab_contents/web_drag_bookmark_handler_mac.h" 14 #include "chrome/browser/tab_contents/web_drag_bookmark_handler_mac.h"
14 #import "chrome/browser/ui/cocoa/focus_tracker.h" 15 #import "chrome/browser/ui/cocoa/focus_tracker.h"
15 #import "chrome/browser/ui/cocoa/view_id_util.h" 16 #import "chrome/browser/ui/cocoa/view_id_util.h"
16 #include "content/browser/renderer_host/render_view_host.h" 17 #include "content/browser/renderer_host/render_view_host.h"
17 #include "content/browser/renderer_host/render_view_host_factory.h" 18 #include "content/browser/renderer_host/render_view_host_factory.h"
18 #include "content/browser/renderer_host/render_widget_host.h" 19 #include "content/browser/renderer_host/render_widget_host.h"
19 #include "content/browser/renderer_host/render_widget_host_view_mac.h" 20 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
20 #include "content/browser/tab_contents/popup_menu_helper_mac.h" 21 #include "content/browser/tab_contents/popup_menu_helper_mac.h"
21 #include "content/browser/tab_contents/tab_contents.h" 22 #include "content/browser/tab_contents/tab_contents.h"
22 #include "content/browser/tab_contents/tab_contents_delegate.h" 23 #include "content/browser/tab_contents/tab_contents_delegate.h"
23 #import "content/browser/tab_contents/web_drag_dest_mac.h" 24 #import "content/browser/tab_contents/web_drag_dest_mac.h"
24 #import "content/browser/tab_contents/web_drag_source_mac.h" 25 #import "content/browser/tab_contents/web_drag_source_mac.h"
25 #import "content/common/chrome_application_mac.h" 26 #import "content/common/chrome_application_mac.h"
26 #import "content/common/mac/scoped_sending_event.h"
27 #include "content/common/view_messages.h" 27 #include "content/common/view_messages.h"
28 #include "skia/ext/skia_utils_mac.h" 28 #include "skia/ext/skia_utils_mac.h"
29 #import "third_party/mozilla/NSPasteboard+Utils.h" 29 #import "third_party/mozilla/NSPasteboard+Utils.h"
30 30
31 using WebKit::WebDragOperation; 31 using WebKit::WebDragOperation;
32 using WebKit::WebDragOperationsMask; 32 using WebKit::WebDragOperationsMask;
33 33
34 // Ensure that the WebKit::WebDragOperation enum values stay in sync with 34 // Ensure that the WebKit::WebDragOperation enum values stay in sync with
35 // NSDragOperation constants, since the code below static_casts between 'em. 35 // NSDragOperation constants, since the code below static_casts between 'em.
36 #define COMPILE_ASSERT_MATCHING_ENUM(name) \ 36 #define COMPILE_ASSERT_MATCHING_ENUM(name) \
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 void TabContentsViewMac::StartDragging( 165 void TabContentsViewMac::StartDragging(
166 const WebDropData& drop_data, 166 const WebDropData& drop_data,
167 WebDragOperationsMask allowed_operations, 167 WebDragOperationsMask allowed_operations,
168 const SkBitmap& image, 168 const SkBitmap& image,
169 const gfx::Point& image_offset) { 169 const gfx::Point& image_offset) {
170 // By allowing nested tasks, the code below also allows Close(), 170 // By allowing nested tasks, the code below also allows Close(),
171 // which would deallocate |this|. The same problem can occur while 171 // which would deallocate |this|. The same problem can occur while
172 // processing -sendEvent:, so Close() is deferred in that case. 172 // processing -sendEvent:, so Close() is deferred in that case.
173 // Drags from web content do not come via -sendEvent:, this sets the 173 // Drags from web content do not come via -sendEvent:, this sets the
174 // same flag -sendEvent: would. 174 // same flag -sendEvent: would.
175 content::mac::ScopedSendingEvent sending_event_scoper; 175 base::mac::ScopedSendingEvent sending_event_scoper;
176 176
177 // The drag invokes a nested event loop, arrange to continue 177 // The drag invokes a nested event loop, arrange to continue
178 // processing events. 178 // processing events.
179 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); 179 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
180 NSDragOperation mask = static_cast<NSDragOperation>(allowed_operations); 180 NSDragOperation mask = static_cast<NSDragOperation>(allowed_operations);
181 NSPoint offset = NSPointFromCGPoint(image_offset.ToCGPoint()); 181 NSPoint offset = NSPointFromCGPoint(image_offset.ToCGPoint());
182 [cocoa_view_ startDragWithDropData:drop_data 182 [cocoa_view_ startDragWithDropData:drop_data
183 dragOperationMask:mask 183 dragOperationMask:mask
184 image:gfx::SkBitmapToNSImage(image) 184 image:gfx::SkBitmapToNSImage(image)
185 offset:offset]; 185 offset:offset];
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 [[[notification userInfo] objectForKey:kSelectionDirection] 606 [[[notification userInfo] objectForKey:kSelectionDirection]
607 unsignedIntegerValue]; 607 unsignedIntegerValue];
608 if (direction == NSDirectSelection) 608 if (direction == NSDirectSelection)
609 return; 609 return;
610 610
611 [self tabContents]-> 611 [self tabContents]->
612 FocusThroughTabTraversal(direction == NSSelectingPrevious); 612 FocusThroughTabTraversal(direction == NSSelectingPrevious);
613 } 613 }
614 614
615 @end 615 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698