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

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

Issue 468193005: Remove SetAllowOverlappingView from RWHVMac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_ca_flag
Patch Set: Created 6 years, 4 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
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 RenderViewHostDelegateView** render_view_host_delegate_view) { 74 RenderViewHostDelegateView** render_view_host_delegate_view) {
75 WebContentsViewMac* rv = new WebContentsViewMac(web_contents, delegate); 75 WebContentsViewMac* rv = new WebContentsViewMac(web_contents, delegate);
76 *render_view_host_delegate_view = rv; 76 *render_view_host_delegate_view = rv;
77 return rv; 77 return rv;
78 } 78 }
79 79
80 WebContentsViewMac::WebContentsViewMac(WebContentsImpl* web_contents, 80 WebContentsViewMac::WebContentsViewMac(WebContentsImpl* web_contents,
81 WebContentsViewDelegate* delegate) 81 WebContentsViewDelegate* delegate)
82 : web_contents_(web_contents), 82 : web_contents_(web_contents),
83 delegate_(delegate), 83 delegate_(delegate),
84 allow_overlapping_views_(false),
85 allow_other_views_(false) { 84 allow_other_views_(false) {
86 } 85 }
87 86
88 WebContentsViewMac::~WebContentsViewMac() { 87 WebContentsViewMac::~WebContentsViewMac() {
89 // This handles the case where a renderer close call was deferred 88 // This handles the case where a renderer close call was deferred
90 // while the user was operating a UI control which resulted in a 89 // while the user was operating a UI control which resulted in a
91 // close. In that case, the Cocoa view outlives the 90 // close. In that case, the Cocoa view outlives the
92 // WebContentsViewMac instance due to Cocoa retain count. 91 // WebContentsViewMac instance due to Cocoa retain count.
93 [cocoa_view_ cancelDeferredClose]; 92 [cocoa_view_ cancelDeferredClose];
94 [cocoa_view_ clearWebContentsView]; 93 [cocoa_view_ clearWebContentsView];
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 if (popup_menu_helper_) 254 if (popup_menu_helper_)
256 popup_menu_helper_->Hide(); 255 popup_menu_helper_->Hide();
257 } 256 }
258 257
259 gfx::Rect WebContentsViewMac::GetViewBounds() const { 258 gfx::Rect WebContentsViewMac::GetViewBounds() const {
260 // This method is not currently used on mac. 259 // This method is not currently used on mac.
261 NOTIMPLEMENTED(); 260 NOTIMPLEMENTED();
262 return gfx::Rect(); 261 return gfx::Rect();
263 } 262 }
264 263
265 void WebContentsViewMac::SetAllowOverlappingViews(bool overlapping) {
266 if (allow_overlapping_views_ == overlapping)
267 return;
268
269 allow_overlapping_views_ = overlapping;
270 RenderWidgetHostViewMac* view = static_cast<RenderWidgetHostViewMac*>(
271 web_contents_->GetRenderWidgetHostView());
272 if (view)
273 view->SetAllowOverlappingViews(allow_overlapping_views_);
274 }
275
276 bool WebContentsViewMac::GetAllowOverlappingViews() const {
277 return allow_overlapping_views_;
278 }
279
280 void WebContentsViewMac::SetAllowOtherViews(bool allow) { 264 void WebContentsViewMac::SetAllowOtherViews(bool allow) {
281 if (allow_other_views_ == allow) 265 if (allow_other_views_ == allow)
282 return; 266 return;
283 267
284 allow_other_views_ = allow; 268 allow_other_views_ = allow;
285 RenderWidgetHostViewMac* view = static_cast<RenderWidgetHostViewMac*>( 269 RenderWidgetHostViewMac* view = static_cast<RenderWidgetHostViewMac*>(
286 web_contents_->GetRenderWidgetHostView()); 270 web_contents_->GetRenderWidgetHostView());
287 if (view) 271 if (view)
288 view->SetAllowPauseForResizeOrRepaint(!allow_other_views_); 272 view->SetAllowPauseForResizeOrRepaint(!allow_other_views_);
289 } 273 }
(...skipping 24 matching lines...) Expand all
314 298
315 RenderWidgetHostViewMac* view = new RenderWidgetHostViewMac( 299 RenderWidgetHostViewMac* view = new RenderWidgetHostViewMac(
316 render_widget_host); 300 render_widget_host);
317 if (delegate()) { 301 if (delegate()) {
318 base::scoped_nsobject<NSObject<RenderWidgetHostViewMacDelegate> > 302 base::scoped_nsobject<NSObject<RenderWidgetHostViewMacDelegate> >
319 rw_delegate( 303 rw_delegate(
320 delegate()->CreateRenderWidgetHostViewDelegate(render_widget_host)); 304 delegate()->CreateRenderWidgetHostViewDelegate(render_widget_host));
321 305
322 view->SetDelegate(rw_delegate.get()); 306 view->SetDelegate(rw_delegate.get());
323 } 307 }
324 view->SetAllowOverlappingViews(allow_overlapping_views_);
325 view->SetAllowPauseForResizeOrRepaint(!allow_other_views_); 308 view->SetAllowPauseForResizeOrRepaint(!allow_other_views_);
326 309
327 // Fancy layout comes later; for now just make it our size and resize it 310 // Fancy layout comes later; for now just make it our size and resize it
328 // with us. In case there are other siblings of the content area, we want 311 // with us. In case there are other siblings of the content area, we want
329 // to make sure the content area is on the bottom so other things draw over 312 // to make sure the content area is on the bottom so other things draw over
330 // it. 313 // it.
331 NSView* view_view = view->GetNativeView(); 314 NSView* view_view = view->GetNativeView();
332 [view_view setFrame:[cocoa_view_.get() bounds]]; 315 [view_view setFrame:[cocoa_view_.get() bounds]];
333 [view_view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; 316 [view_view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
334 // Add the new view below all other views; this also keeps it below any 317 // Add the new view below all other views; this also keeps it below any
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 // When the subviews require a layout, their size should be reset to the size 577 // When the subviews require a layout, their size should be reset to the size
595 // of this view. (It is possible for the size to get out of sync as an 578 // of this view. (It is possible for the size to get out of sync as an
596 // optimization in preparation for an upcoming WebContentsView resize. 579 // optimization in preparation for an upcoming WebContentsView resize.
597 // http://crbug.com/264207) 580 // http://crbug.com/264207)
598 - (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize { 581 - (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize {
599 for (NSView* subview in self.subviews) 582 for (NSView* subview in self.subviews)
600 [subview setFrame:self.bounds]; 583 [subview setFrame:self.bounds];
601 } 584 }
602 585
603 @end 586 @end
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_view_mac.h ('k') | content/public/browser/web_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698