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

Side by Side Diff: ui/views/cocoa/bridged_native_widget.mm

Issue 1579813002: PoC: Using the toolkit-views fullscreen access bubble on Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refine Created 4 years, 11 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
« no previous file with comments | « chrome/chrome_nibs.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/views/cocoa/bridged_native_widget.h" 5 #import "ui/views/cocoa/bridged_native_widget.h"
6 6
7 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 Widget* widget = native_widget_mac_->GetWidget(); 421 Widget* widget = native_widget_mac_->GetWidget();
422 // -[NSWindow contentMinSize] is only checked by Cocoa for user-initiated 422 // -[NSWindow contentMinSize] is only checked by Cocoa for user-initiated
423 // resizes. This is not what toolkit-views expects, so clamp. Note there is 423 // resizes. This is not what toolkit-views expects, so clamp. Note there is
424 // no check for maximum size (consistent with aura::Window::SetBounds()). 424 // no check for maximum size (consistent with aura::Window::SetBounds()).
425 gfx::Size clamped_content_size = 425 gfx::Size clamped_content_size =
426 GetClientSizeForWindowSize(window_, new_bounds.size()); 426 GetClientSizeForWindowSize(window_, new_bounds.size());
427 clamped_content_size.SetToMax(widget->GetMinimumSize()); 427 clamped_content_size.SetToMax(widget->GetMinimumSize());
428 428
429 // A contentRect with zero width or height is a banned practice in ChromeMac, 429 // A contentRect with zero width or height is a banned practice in ChromeMac,
430 // due to unpredictable OSX treatment. 430 // due to unpredictable OSX treatment.
431 DCHECK(!clamped_content_size.IsEmpty()) 431 // DCHECK(!clamped_content_size.IsEmpty())
432 << "Zero-sized windows not supported on Mac"; 432 // << "Zero-sized windows not supported on Mac";
433 433
434 if (!window_visible_ && native_widget_mac_->IsWindowModalSheet()) { 434 if (!window_visible_ && native_widget_mac_->IsWindowModalSheet()) {
435 // Window-Modal dialogs (i.e. sheets) are positioned by Cocoa when shown for 435 // Window-Modal dialogs (i.e. sheets) are positioned by Cocoa when shown for
436 // the first time. They also have no frame, so just update the content size. 436 // the first time. They also have no frame, so just update the content size.
437 [window_ setContentSize:NSMakeSize(clamped_content_size.width(), 437 [window_ setContentSize:NSMakeSize(clamped_content_size.width(),
438 clamped_content_size.height())]; 438 clamped_content_size.height())];
439 return; 439 return;
440 } 440 }
441 gfx::Rect actual_new_bounds( 441 gfx::Rect actual_new_bounds(
442 new_bounds.origin(), 442 new_bounds.origin(),
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 [bridged_view_ setMouseDownCanMoveWindow:draggable]; 1211 [bridged_view_ setMouseDownCanMoveWindow:draggable];
1212 // AppKit will not update its cache of mouseDownCanMoveWindow unless something 1212 // AppKit will not update its cache of mouseDownCanMoveWindow unless something
1213 // changes. Previously we tried adding an NSView and removing it, but for some 1213 // changes. Previously we tried adding an NSView and removing it, but for some
1214 // reason it required reposting the mouse-down event, and didn't always work. 1214 // reason it required reposting the mouse-down event, and didn't always work.
1215 // Calling the below seems to be an effective solution. 1215 // Calling the below seems to be an effective solution.
1216 [window_ setMovableByWindowBackground:NO]; 1216 [window_ setMovableByWindowBackground:NO];
1217 [window_ setMovableByWindowBackground:YES]; 1217 [window_ setMovableByWindowBackground:YES];
1218 } 1218 }
1219 1219
1220 } // namespace views 1220 } // namespace views
OLDNEW
« no previous file with comments | « chrome/chrome_nibs.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698