OLD | NEW |
---|---|
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 |
11 #import "base/mac/scoped_sending_event.h" | 11 #import "base/mac/scoped_sending_event.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #import "base/message_loop/message_pump_mac.h" | 13 #import "base/message_loop/message_pump_mac.h" |
14 #include "content/browser/frame_host/popup_menu_helper_mac.h" | 14 #include "content/browser/frame_host/popup_menu_helper_mac.h" |
15 #include "content/browser/renderer_host/render_view_host_factory.h" | 15 #include "content/browser/renderer_host/render_view_host_factory.h" |
16 #include "content/browser/renderer_host/render_view_host_impl.h" | 16 #include "content/browser/renderer_host/render_view_host_impl.h" |
17 #include "content/browser/renderer_host/render_widget_host_view_mac.h" | 17 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
18 #include "content/browser/web_contents/web_contents_impl.h" | 18 #include "content/browser/web_contents/web_contents_impl.h" |
19 #import "content/browser/web_contents/web_drag_dest_mac.h" | 19 #import "content/browser/web_contents/web_drag_dest_mac.h" |
20 #import "content/browser/web_contents/web_drag_source_mac.h" | 20 #import "content/browser/web_contents/web_drag_source_mac.h" |
21 #include "content/common/view_messages.h" | 21 #include "content/common/view_messages.h" |
22 #include "content/public/browser/web_contents_delegate.h" | 22 #include "content/public/browser/web_contents_delegate.h" |
23 #include "content/public/browser/web_contents_view_delegate.h" | 23 #import "content/public/browser/web_contents_view_delegate_mac.h" |
24 #include "skia/ext/skia_utils_mac.h" | 24 #include "skia/ext/skia_utils_mac.h" |
25 #import "third_party/mozilla/NSPasteboard+Utils.h" | 25 #import "third_party/mozilla/NSPasteboard+Utils.h" |
26 #include "ui/base/clipboard/custom_data_helper.h" | 26 #include "ui/base/clipboard/custom_data_helper.h" |
27 #import "ui/base/cocoa/focus_tracker.h" | 27 #import "ui/base/cocoa/focus_tracker.h" |
28 #include "ui/base/dragdrop/cocoa_dnd_util.h" | 28 #include "ui/base/dragdrop/cocoa_dnd_util.h" |
29 #include "ui/gfx/image/image_skia_util_mac.h" | 29 #include "ui/gfx/image/image_skia_util_mac.h" |
30 | 30 |
31 using blink::WebDragOperation; | 31 using blink::WebDragOperation; |
32 using blink::WebDragOperationsMask; | 32 using blink::WebDragOperationsMask; |
33 using content::DropData; | 33 using content::DropData; |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
292 // view twice), we check for the RVH Factory, which will be set when we're | 292 // view twice), we check for the RVH Factory, which will be set when we're |
293 // making special ones (which go along with the special views). | 293 // making special ones (which go along with the special views). |
294 DCHECK(RenderViewHostFactory::has_factory()); | 294 DCHECK(RenderViewHostFactory::has_factory()); |
295 return static_cast<RenderWidgetHostViewBase*>( | 295 return static_cast<RenderWidgetHostViewBase*>( |
296 render_widget_host->GetView()); | 296 render_widget_host->GetView()); |
297 } | 297 } |
298 | 298 |
299 RenderWidgetHostViewMac* view = new RenderWidgetHostViewMac( | 299 RenderWidgetHostViewMac* view = new RenderWidgetHostViewMac( |
300 render_widget_host); | 300 render_widget_host); |
301 if (delegate()) { | 301 if (delegate()) { |
302 WebContentsViewDelegateMac* delegate_mac = | |
303 delegate()->AsWebContentsViewDelegateMac(); | |
302 base::scoped_nsobject<NSObject<RenderWidgetHostViewMacDelegate> > | 304 base::scoped_nsobject<NSObject<RenderWidgetHostViewMacDelegate> > |
303 rw_delegate( | 305 rw_delegate(delegate_mac |
304 delegate()->CreateRenderWidgetHostViewDelegate(render_widget_host)); | 306 ? delegate_mac->CreateRenderWidgetHostViewDelegate( |
307 render_widget_host) | |
308 : nil); | |
tapted
2014/08/27 14:09:10
This is a bit simpler in patchset 3 - it can go ba
| |
305 | 309 |
306 view->SetDelegate(rw_delegate.get()); | 310 view->SetDelegate(rw_delegate.get()); |
307 } | 311 } |
308 view->SetAllowPauseForResizeOrRepaint(!allow_other_views_); | 312 view->SetAllowPauseForResizeOrRepaint(!allow_other_views_); |
309 | 313 |
310 // Fancy layout comes later; for now just make it our size and resize it | 314 // Fancy layout comes later; for now just make it our size and resize it |
311 // with us. In case there are other siblings of the content area, we want | 315 // with us. In case there are other siblings of the content area, we want |
312 // to make sure the content area is on the bottom so other things draw over | 316 // to make sure the content area is on the bottom so other things draw over |
313 // it. | 317 // it. |
314 NSView* view_view = view->GetNativeView(); | 318 NSView* view_view = view->GetNativeView(); |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
577 // When the subviews require a layout, their size should be reset to the size | 581 // When the subviews require a layout, their size should be reset to the size |
578 // of this view. (It is possible for the size to get out of sync as an | 582 // of this view. (It is possible for the size to get out of sync as an |
579 // optimization in preparation for an upcoming WebContentsView resize. | 583 // optimization in preparation for an upcoming WebContentsView resize. |
580 // http://crbug.com/264207) | 584 // http://crbug.com/264207) |
581 - (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize { | 585 - (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize { |
582 for (NSView* subview in self.subviews) | 586 for (NSView* subview in self.subviews) |
583 [subview setFrame:self.bounds]; | 587 [subview setFrame:self.bounds]; |
584 } | 588 } |
585 | 589 |
586 @end | 590 @end |
OLD | NEW |