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

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

Issue 1853373002: Revert of Temporarily disable all calls of CGS private APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « ui/base/cocoa/constrained_window/constrained_window_animation.mm ('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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 - (void)setCurrentProgress:(NSAnimationProgress)progress { 78 - (void)setCurrentProgress:(NSAnimationProgress)progress {
79 [super setCurrentProgress:progress]; 79 [super setCurrentProgress:progress];
80 [window_ invalidateShadow]; 80 [window_ invalidateShadow];
81 } 81 }
82 @end 82 @end
83 83
84 namespace { 84 namespace {
85 85
86 const CGFloat kMavericksMenuOpacity = 251.0 / 255.0; 86 const CGFloat kMavericksMenuOpacity = 251.0 / 255.0;
87 const CGFloat kYosemiteMenuOpacity = 194.0 / 255.0; 87 const CGFloat kYosemiteMenuOpacity = 194.0 / 255.0;
88 // const int kYosemiteMenuBlur = 80; 88 const int kYosemiteMenuBlur = 80;
89 89
90 // Margin at edge and corners of the window that trigger resizing. These match 90 // Margin at edge and corners of the window that trigger resizing. These match
91 // actual Cocoa resize margins. 91 // actual Cocoa resize margins.
92 const int kResizeAreaEdgeSize = 3; 92 const int kResizeAreaEdgeSize = 3;
93 const int kResizeAreaCornerSize = 12; 93 const int kResizeAreaCornerSize = 12;
94 94
95 int kWindowPropertiesKey; 95 int kWindowPropertiesKey;
96 96
97 float GetDeviceScaleFactorFromView(NSView* view) { 97 float GetDeviceScaleFactorFromView(NSView* view) {
98 gfx::Display display = 98 gfx::Display display =
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 1138
1139 base::scoped_nsobject<CALayer> background_layer([[CALayer alloc] init]); 1139 base::scoped_nsobject<CALayer> background_layer([[CALayer alloc] init]);
1140 [background_layer 1140 [background_layer
1141 setAutoresizingMask:kCALayerWidthSizable | kCALayerHeightSizable]; 1141 setAutoresizingMask:kCALayerWidthSizable | kCALayerHeightSizable];
1142 1142
1143 if (widget_type_ == Widget::InitParams::TYPE_MENU) { 1143 if (widget_type_ == Widget::InitParams::TYPE_MENU) {
1144 // Giving the canvas opacity messes up subpixel font rendering, so use a 1144 // Giving the canvas opacity messes up subpixel font rendering, so use a
1145 // solid background, but make the CALayer transparent. 1145 // solid background, but make the CALayer transparent.
1146 if (base::mac::IsOSYosemiteOrLater()) { 1146 if (base::mac::IsOSYosemiteOrLater()) {
1147 [background_layer setOpacity:kYosemiteMenuOpacity]; 1147 [background_layer setOpacity:kYosemiteMenuOpacity];
1148 1148 CGSSetWindowBackgroundBlurRadius(
1149 // TODO(erikchen): Temporarily disabled. https://crbug.com/515627. 1149 _CGSDefaultConnection(), [window_ windowNumber], kYosemiteMenuBlur);
1150 // CGSSetWindowBackgroundBlurRadius(
1151 // _CGSDefaultConnection(), [window_ windowNumber],
1152 // kYosemiteMenuBlur);
1153 // The blur effect does not occur with a fully transparent (or fully 1150 // The blur effect does not occur with a fully transparent (or fully
1154 // layer-backed) window. Setting a window background will use square 1151 // layer-backed) window. Setting a window background will use square
1155 // corners, so ask the contentView to draw one instead. 1152 // corners, so ask the contentView to draw one instead.
1156 [bridged_view_ setDrawMenuBackgroundForBlur:YES]; 1153 [bridged_view_ setDrawMenuBackgroundForBlur:YES];
1157 } else { 1154 } else {
1158 [background_layer setOpacity:kMavericksMenuOpacity]; 1155 [background_layer setOpacity:kMavericksMenuOpacity];
1159 } 1156 }
1160 } 1157 }
1161 1158
1162 // Set the layer first to create a layer-hosting view (not layer-backed). 1159 // Set the layer first to create a layer-hosting view (not layer-backed).
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 [bridged_view_ setMouseDownCanMoveWindow:draggable]; 1238 [bridged_view_ setMouseDownCanMoveWindow:draggable];
1242 // AppKit will not update its cache of mouseDownCanMoveWindow unless something 1239 // AppKit will not update its cache of mouseDownCanMoveWindow unless something
1243 // changes. Previously we tried adding an NSView and removing it, but for some 1240 // changes. Previously we tried adding an NSView and removing it, but for some
1244 // reason it required reposting the mouse-down event, and didn't always work. 1241 // reason it required reposting the mouse-down event, and didn't always work.
1245 // Calling the below seems to be an effective solution. 1242 // Calling the below seems to be an effective solution.
1246 [window_ setMovableByWindowBackground:NO]; 1243 [window_ setMovableByWindowBackground:NO];
1247 [window_ setMovableByWindowBackground:YES]; 1244 [window_ setMovableByWindowBackground:YES];
1248 } 1245 }
1249 1246
1250 } // namespace views 1247 } // namespace views
OLDNEW
« no previous file with comments | « ui/base/cocoa/constrained_window/constrained_window_animation.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698