| OLD | NEW | 
|---|
| 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  Loading... | 
| 421         NativeWidgetMac::GetBridgeForNativeWindow([params.parent window]); | 421         NativeWidgetMac::GetBridgeForNativeWindow([params.parent window]); | 
| 422     // If the parent is another BridgedNativeWidget, just add to the collection | 422     // If the parent is another BridgedNativeWidget, just add to the collection | 
| 423     // of child windows it owns and manages. Otherwise, create an adapter to | 423     // of child windows it owns and manages. Otherwise, create an adapter to | 
| 424     // anchor the child widget and observe when the parent NSWindow is closed. | 424     // anchor the child widget and observe when the parent NSWindow is closed. | 
| 425     if (bridged_native_widget_parent) { | 425     if (bridged_native_widget_parent) { | 
| 426       parent_ = bridged_native_widget_parent; | 426       parent_ = bridged_native_widget_parent; | 
| 427       bridged_native_widget_parent->child_windows_.push_back(this); | 427       bridged_native_widget_parent->child_windows_.push_back(this); | 
| 428     } else { | 428     } else { | 
| 429       parent_ = new WidgetOwnerNSWindowAdapter(this, params.parent); | 429       parent_ = new WidgetOwnerNSWindowAdapter(this, params.parent); | 
| 430     } | 430     } | 
|  | 431     // crbug.com/697829: Widget::ShowInactive() could result in a Space switch | 
|  | 432     // when the widget has a parent, and we're calling -orderWindow:relativeTo:. | 
|  | 433     // Use Transient collection behaviour to prevent that. | 
|  | 434     [window_ setCollectionBehavior:[window_ collectionBehavior] | | 
|  | 435                                    NSWindowCollectionBehaviorTransient]; | 
| 431   } | 436   } | 
| 432 | 437 | 
| 433   // OSX likes to put shadows on most things. However, frameless windows (with | 438   // OSX likes to put shadows on most things. However, frameless windows (with | 
| 434   // styleMask = NSBorderlessWindowMask) default to no shadow. So change that. | 439   // styleMask = NSBorderlessWindowMask) default to no shadow. So change that. | 
| 435   // SHADOW_TYPE_DROP is used for Menus, which get the same shadow style on Mac. | 440   // SHADOW_TYPE_DROP is used for Menus, which get the same shadow style on Mac. | 
| 436   switch (params.shadow_type) { | 441   switch (params.shadow_type) { | 
| 437     case Widget::InitParams::SHADOW_TYPE_NONE: | 442     case Widget::InitParams::SHADOW_TYPE_NONE: | 
| 438       [window_ setHasShadow:NO]; | 443       [window_ setHasShadow:NO]; | 
| 439       break; | 444       break; | 
| 440     case Widget::InitParams::SHADOW_TYPE_DEFAULT: | 445     case Widget::InitParams::SHADOW_TYPE_DEFAULT: | 
| (...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1426   [bridged_view_ setMouseDownCanMoveWindow:draggable]; | 1431   [bridged_view_ setMouseDownCanMoveWindow:draggable]; | 
| 1427   // AppKit will not update its cache of mouseDownCanMoveWindow unless something | 1432   // AppKit will not update its cache of mouseDownCanMoveWindow unless something | 
| 1428   // changes. Previously we tried adding an NSView and removing it, but for some | 1433   // changes. Previously we tried adding an NSView and removing it, but for some | 
| 1429   // reason it required reposting the mouse-down event, and didn't always work. | 1434   // reason it required reposting the mouse-down event, and didn't always work. | 
| 1430   // Calling the below seems to be an effective solution. | 1435   // Calling the below seems to be an effective solution. | 
| 1431   [window_ setMovableByWindowBackground:NO]; | 1436   [window_ setMovableByWindowBackground:NO]; | 
| 1432   [window_ setMovableByWindowBackground:YES]; | 1437   [window_ setMovableByWindowBackground:YES]; | 
| 1433 } | 1438 } | 
| 1434 | 1439 | 
| 1435 }  // namespace views | 1440 }  // namespace views | 
| OLD | NEW | 
|---|