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

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

Issue 11418244: Order the GL overlays above windows if possible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: oops, null check Created 8 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) 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 WebContentsViewDelegate* delegate, 72 WebContentsViewDelegate* delegate,
73 RenderViewHostDelegateView** render_view_host_delegate_view) { 73 RenderViewHostDelegateView** render_view_host_delegate_view) {
74 WebContentsViewMac* rv = new WebContentsViewMac(web_contents, delegate); 74 WebContentsViewMac* rv = new WebContentsViewMac(web_contents, delegate);
75 *render_view_host_delegate_view = rv; 75 *render_view_host_delegate_view = rv;
76 return rv; 76 return rv;
77 } 77 }
78 78
79 WebContentsViewMac::WebContentsViewMac(WebContentsImpl* web_contents, 79 WebContentsViewMac::WebContentsViewMac(WebContentsImpl* web_contents,
80 WebContentsViewDelegate* delegate) 80 WebContentsViewDelegate* delegate)
81 : web_contents_(web_contents), 81 : web_contents_(web_contents),
82 delegate_(delegate) { 82 delegate_(delegate),
83 allow_overlapping_views_(false) {
83 } 84 }
84 85
85 WebContentsViewMac::~WebContentsViewMac() { 86 WebContentsViewMac::~WebContentsViewMac() {
86 // This handles the case where a renderer close call was deferred 87 // This handles the case where a renderer close call was deferred
87 // while the user was operating a UI control which resulted in a 88 // while the user was operating a UI control which resulted in a
88 // close. In that case, the Cocoa view outlives the 89 // close. In that case, the Cocoa view outlives the
89 // WebContentsViewMac instance due to Cocoa retain count. 90 // WebContentsViewMac instance due to Cocoa retain count.
90 [cocoa_view_ cancelDeferredClose]; 91 [cocoa_view_ cancelDeferredClose];
91 [cocoa_view_ clearWebContentsView]; 92 [cocoa_view_ clearWebContentsView];
92 } 93 }
(...skipping 16 matching lines...) Expand all
109 return render_widget_host->GetView(); 110 return render_widget_host->GetView();
110 } 111 }
111 112
112 RenderWidgetHostViewMac* view = static_cast<RenderWidgetHostViewMac*>( 113 RenderWidgetHostViewMac* view = static_cast<RenderWidgetHostViewMac*>(
113 RenderWidgetHostView::CreateViewForWidget(render_widget_host)); 114 RenderWidgetHostView::CreateViewForWidget(render_widget_host));
114 if (delegate()) { 115 if (delegate()) {
115 NSObject<RenderWidgetHostViewMacDelegate>* rw_delegate = 116 NSObject<RenderWidgetHostViewMacDelegate>* rw_delegate =
116 delegate()->CreateRenderWidgetHostViewDelegate(render_widget_host); 117 delegate()->CreateRenderWidgetHostViewDelegate(render_widget_host);
117 view->SetDelegate(rw_delegate); 118 view->SetDelegate(rw_delegate);
118 } 119 }
120 view->SetAllowOverlappingViews(allow_overlapping_views_);
119 121
120 // Fancy layout comes later; for now just make it our size and resize it 122 // Fancy layout comes later; for now just make it our size and resize it
121 // with us. In case there are other siblings of the content area, we want 123 // with us. In case there are other siblings of the content area, we want
122 // to make sure the content area is on the bottom so other things draw over 124 // to make sure the content area is on the bottom so other things draw over
123 // it. 125 // it.
124 NSView* view_view = view->GetNativeView(); 126 NSView* view_view = view->GetNativeView();
125 [view_view setFrame:[cocoa_view_.get() bounds]]; 127 [view_view setFrame:[cocoa_view_.get() bounds]];
126 [view_view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; 128 [view_view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
127 // Add the new view below all other views; this also keeps it below any 129 // Add the new view below all other views; this also keeps it below any
128 // overlay view installed. 130 // overlay view installed.
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 withObject:nil 329 withObject:nil
328 afterDelay:0.0]; 330 afterDelay:0.0];
329 } 331 }
330 332
331 gfx::Rect WebContentsViewMac::GetViewBounds() const { 333 gfx::Rect WebContentsViewMac::GetViewBounds() const {
332 // This method is not currently used on mac. 334 // This method is not currently used on mac.
333 NOTIMPLEMENTED(); 335 NOTIMPLEMENTED();
334 return gfx::Rect(); 336 return gfx::Rect();
335 } 337 }
336 338
339 void WebContentsViewMac::SetAllowOverlappingViews(bool overlapping) {
340 if (allow_overlapping_views_ == overlapping)
341 return;
342
343 allow_overlapping_views_ = overlapping;
344 RenderWidgetHostViewMac* view = static_cast<RenderWidgetHostViewMac*>(
345 web_contents_->GetRenderWidgetHostView());
346 if (view)
347 view->SetAllowOverlappingViews(allow_overlapping_views_);
348 }
349
337 void WebContentsViewMac::CloseTab() { 350 void WebContentsViewMac::CloseTab() {
338 web_contents_->Close(web_contents_->GetRenderViewHost()); 351 web_contents_->Close(web_contents_->GetRenderViewHost());
339 } 352 }
340 353
341 } // namespace content 354 } // namespace content
342 355
343 @implementation WebContentsViewCocoa 356 @implementation WebContentsViewCocoa
344 357
345 - (id)initWithWebContentsViewMac:(WebContentsViewMac*)w { 358 - (id)initWithWebContentsViewMac:(WebContentsViewMac*)w {
346 self = [super initWithFrame:NSZeroRect]; 359 self = [super initWithFrame:NSZeroRect];
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 [[[notification userInfo] objectForKey:kSelectionDirection] 549 [[[notification userInfo] objectForKey:kSelectionDirection]
537 unsignedIntegerValue]; 550 unsignedIntegerValue];
538 if (direction == NSDirectSelection) 551 if (direction == NSDirectSelection)
539 return; 552 return;
540 553
541 [self webContents]-> 554 [self webContents]->
542 FocusThroughTabTraversal(direction == NSSelectingPrevious); 555 FocusThroughTabTraversal(direction == NSSelectingPrevious);
543 } 556 }
544 557
545 @end 558 @end
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_view_mac.h ('k') | content/public/browser/web_contents_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698