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

Side by Side Diff: chrome/browser/ui/cocoa/info_bubble_window.mm

Issue 10808046: Disable blurring for extension bubbles (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/cocoa/info_bubble_window.h ('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 (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 "chrome/browser/ui/cocoa/info_bubble_window.h" 5 #import "chrome/browser/ui/cocoa/info_bubble_window.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "base/memory/scoped_nsobject.h" 10 #include "base/memory/scoped_nsobject.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 108 }
109 } 109 }
110 110
111 @end 111 @end
112 112
113 113
114 @implementation InfoBubbleWindow 114 @implementation InfoBubbleWindow
115 115
116 @synthesize delayOnClose = delayOnClose_; 116 @synthesize delayOnClose = delayOnClose_;
117 @synthesize canBecomeKeyWindow = canBecomeKeyWindow_; 117 @synthesize canBecomeKeyWindow = canBecomeKeyWindow_;
118 @synthesize hasBlurredBackground = hasBlurredBackground_;
118 119
119 - (id)initWithContentRect:(NSRect)contentRect 120 - (id)initWithContentRect:(NSRect)contentRect
120 styleMask:(NSUInteger)aStyle 121 styleMask:(NSUInteger)aStyle
121 backing:(NSBackingStoreType)bufferingType 122 backing:(NSBackingStoreType)bufferingType
122 defer:(BOOL)flag { 123 defer:(BOOL)flag {
123 if ((self = [super initWithContentRect:contentRect 124 if ((self = [super initWithContentRect:contentRect
124 styleMask:NSBorderlessWindowMask 125 styleMask:NSBorderlessWindowMask
125 backing:bufferingType 126 backing:bufferingType
126 defer:flag])) { 127 defer:flag])) {
127 [self setBackgroundColor:[NSColor clearColor]]; 128 [self setBackgroundColor:[NSColor clearColor]];
128 [self setExcludedFromWindowsMenu:YES]; 129 [self setExcludedFromWindowsMenu:YES];
129 [self setOpaque:NO]; 130 [self setOpaque:NO];
130 [self setHasShadow:YES]; 131 [self setHasShadow:YES];
131 delayOnClose_ = YES; 132 delayOnClose_ = YES;
132 canBecomeKeyWindow_ = YES; 133 canBecomeKeyWindow_ = YES;
134 hasBlurredBackground_ = YES;
133 notificationBridge_.reset(new AppNotificationBridge(self)); 135 notificationBridge_.reset(new AppNotificationBridge(self));
134 136
135 // Start invisible. Will be made visible when ordered front. 137 // Start invisible. Will be made visible when ordered front.
136 [self setAlphaValue:0.0]; 138 [self setAlphaValue:0.0];
137 139
138 // Set up alphaValue animation so that self is delegate for the animation. 140 // Set up alphaValue animation so that self is delegate for the animation.
139 // Setting up the delegate is required so that the 141 // Setting up the delegate is required so that the
140 // animationDidStop:finished: callback can be handled. 142 // animationDidStop:finished: callback can be handled.
141 // Notice that only the alphaValue Animation is replaced in case 143 // Notice that only the alphaValue Animation is replaced in case
142 // superclasses set up animations. 144 // superclasses set up animations.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // in the designated initializer. 218 // in the designated initializer.
217 [super orderWindow:orderingMode relativeTo:otherWindowNumber]; 219 [super orderWindow:orderingMode relativeTo:otherWindowNumber];
218 220
219 // Set up frame so it can be adjust down by a few pixels. 221 // Set up frame so it can be adjust down by a few pixels.
220 NSRect frame = [self frame]; 222 NSRect frame = [self frame];
221 NSPoint newOrigin = frame.origin; 223 NSPoint newOrigin = frame.origin;
222 newOrigin.y += kOrderInSlideOffset; 224 newOrigin.y += kOrderInSlideOffset;
223 [self setFrameOrigin:newOrigin]; 225 [self setFrameOrigin:newOrigin];
224 226
225 // Add a gaussian blur to the window. 227 // Add a gaussian blur to the window.
226 CGSConnection cgsConnection = _CGSDefaultConnection(); 228 if (hasBlurredBackground_) {
227 CGSWindowFilterRef filter; 229 CGSConnection cgsConnection = _CGSDefaultConnection();
228 if (CGSNewCIFilterByName(cgsConnection, CFSTR("CIGaussianBlur"), 230 CGSWindowFilterRef filter;
229 &filter) == kCGErrorSuccess) { 231 if (CGSNewCIFilterByName(cgsConnection, CFSTR("CIGaussianBlur"),
230 NSDictionary* blurOptions = 232 &filter) == kCGErrorSuccess) {
231 [NSDictionary dictionaryWithObject:[NSNumber numberWithFloat:1.5] 233 NSDictionary* blurOptions =
232 forKey:@"inputRadius"]; 234 [NSDictionary dictionaryWithObject:[NSNumber numberWithFloat:1.5]
235 forKey:@"inputRadius"];
233 236
234 if (CGSSetCIFilterValuesFromDictionary(cgsConnection, filter, 237 if (CGSSetCIFilterValuesFromDictionary(cgsConnection, filter,
235 base::mac::NSToCFCast(blurOptions)) == kCGErrorSuccess) { 238 base::mac::NSToCFCast(blurOptions)) == kCGErrorSuccess) {
236 CGSAddWindowFilter(cgsConnection, [self windowNumber], filter, 1); 239 CGSAddWindowFilter(cgsConnection, [self windowNumber], filter, 1);
240 }
241
242 CGSReleaseCIFilter(cgsConnection, filter);
237 } 243 }
238
239 CGSReleaseCIFilter(cgsConnection, filter);
240 } 244 }
241 245
242 // Apply animations to show and move self. 246 // Apply animations to show and move self.
243 [NSAnimationContext beginGrouping]; 247 [NSAnimationContext beginGrouping];
244 // The star currently triggers on mouse down, not mouse up. 248 // The star currently triggers on mouse down, not mouse up.
245 [[NSAnimationContext currentContext] 249 [[NSAnimationContext currentContext]
246 gtm_setDuration:kOrderInAnimationDuration 250 gtm_setDuration:kOrderInAnimationDuration
247 eventMask:NSLeftMouseUpMask|NSLeftMouseDownMask]; 251 eventMask:NSLeftMouseUpMask|NSLeftMouseDownMask];
248 [[self animator] setAlphaValue:1.0]; 252 [[self animator] setAlphaValue:1.0];
249 [[self animator] setFrame:frame display:YES]; 253 [[self animator] setFrame:frame display:YES];
250 [NSAnimationContext endGrouping]; 254 [NSAnimationContext endGrouping];
251 } else { 255 } else {
252 [super orderWindow:orderingMode relativeTo:otherWindowNumber]; 256 [super orderWindow:orderingMode relativeTo:otherWindowNumber];
253 } 257 }
254 } 258 }
255 259
256 // If the window is currently animating a close, block all UI events to the 260 // If the window is currently animating a close, block all UI events to the
257 // window. 261 // window.
258 - (void)sendEvent:(NSEvent*)theEvent { 262 - (void)sendEvent:(NSEvent*)theEvent {
259 if (!closing_) 263 if (!closing_)
260 [super sendEvent:theEvent]; 264 [super sendEvent:theEvent];
261 } 265 }
262 266
263 - (BOOL)isClosing { 267 - (BOOL)isClosing {
264 return closing_; 268 return closing_;
265 } 269 }
266 270
267 @end 271 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/info_bubble_window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698