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

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

Issue 7740044: Implement fullscreen info bubble on Win and Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix license Created 9 years, 2 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/memory/scoped_nsobject.h" 9 #include "base/memory/scoped_nsobject.h"
10 #include "content/common/content_notification_types.h" 10 #include "content/common/content_notification_types.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 [window_ finishCloseAfterAnimation]; 87 [window_ finishCloseAfterAnimation];
88 } 88 }
89 } 89 }
90 90
91 @end 91 @end
92 92
93 93
94 @implementation InfoBubbleWindow 94 @implementation InfoBubbleWindow
95 95
96 @synthesize delayOnClose = delayOnClose_; 96 @synthesize delayOnClose = delayOnClose_;
97 @synthesize canBecomeKeyWindow = canBecomeKeyWindow_;
97 98
98 - (id)initWithContentRect:(NSRect)contentRect 99 - (id)initWithContentRect:(NSRect)contentRect
99 styleMask:(NSUInteger)aStyle 100 styleMask:(NSUInteger)aStyle
100 backing:(NSBackingStoreType)bufferingType 101 backing:(NSBackingStoreType)bufferingType
101 defer:(BOOL)flag { 102 defer:(BOOL)flag {
102 if ((self = [super initWithContentRect:contentRect 103 if ((self = [super initWithContentRect:contentRect
103 styleMask:NSBorderlessWindowMask 104 styleMask:NSBorderlessWindowMask
104 backing:bufferingType 105 backing:bufferingType
105 defer:flag])) { 106 defer:flag])) {
106 [self setBackgroundColor:[NSColor clearColor]]; 107 [self setBackgroundColor:[NSColor clearColor]];
107 [self setExcludedFromWindowsMenu:YES]; 108 [self setExcludedFromWindowsMenu:YES];
108 [self setOpaque:NO]; 109 [self setOpaque:NO];
109 [self setHasShadow:YES]; 110 [self setHasShadow:YES];
110 delayOnClose_ = YES; 111 delayOnClose_ = YES;
112 canBecomeKeyWindow_ = YES;
111 notificationBridge_.reset(new AppNotificationBridge(self)); 113 notificationBridge_.reset(new AppNotificationBridge(self));
112 114
113 // Start invisible. Will be made visible when ordered front. 115 // Start invisible. Will be made visible when ordered front.
114 [self setAlphaValue:0.0]; 116 [self setAlphaValue:0.0];
115 117
116 // Set up alphaValue animation so that self is delegate for the animation. 118 // Set up alphaValue animation so that self is delegate for the animation.
117 // Setting up the delegate is required so that the 119 // Setting up the delegate is required so that the
118 // animationDidStop:finished: callback can be handled. 120 // animationDidStop:finished: callback can be handled.
119 // Notice that only the alphaValue Animation is replaced in case 121 // Notice that only the alphaValue Animation is replaced in case
120 // superclasses set up animations. 122 // superclasses set up animations.
121 CAAnimation* alphaAnimation = [CABasicAnimation animation]; 123 CAAnimation* alphaAnimation = [CABasicAnimation animation];
122 scoped_nsobject<InfoBubbleWindowCloser> delegate( 124 scoped_nsobject<InfoBubbleWindowCloser> delegate(
123 [[InfoBubbleWindowCloser alloc] initWithWindow:self]); 125 [[InfoBubbleWindowCloser alloc] initWithWindow:self]);
124 [alphaAnimation setDelegate:delegate]; 126 [alphaAnimation setDelegate:delegate];
125 NSMutableDictionary* animations = 127 NSMutableDictionary* animations =
126 [NSMutableDictionary dictionaryWithDictionary:[self animations]]; 128 [NSMutableDictionary dictionaryWithDictionary:[self animations]];
127 [animations setObject:alphaAnimation forKey:@"alphaValue"]; 129 [animations setObject:alphaAnimation forKey:@"alphaValue"];
128 [self setAnimations:animations]; 130 [self setAnimations:animations];
129 } 131 }
130 return self; 132 return self;
131 } 133 }
132 134
133 // According to 135 // According to
134 // http://www.cocoabuilder.com/archive/message/cocoa/2006/6/19/165953, 136 // http://www.cocoabuilder.com/archive/message/cocoa/2006/6/19/165953,
135 // NSBorderlessWindowMask windows cannot become key or main. In this 137 // NSBorderlessWindowMask windows cannot become key or main. In this
136 // case, this is not a desired behavior. As an example, the bubble could have 138 // case, this is not necessarily a desired behavior. As an example, the
137 // buttons. 139 // bubble could have buttons.
138 - (BOOL)canBecomeKeyWindow { 140 - (BOOL)canBecomeKeyWindow {
139 return YES; 141 return canBecomeKeyWindow_;
140 } 142 }
141 143
142 // Lets the traffic light buttons on the browser window keep their "active" 144 // Lets the traffic light buttons on the browser window keep their "active"
143 // state while an info bubble is open. Only has an effect on 10.7. 145 // state while an info bubble is open. Only has an effect on 10.7.
144 - (BOOL)_sharesParentKeyState { 146 - (BOOL)_sharesParentKeyState {
145 return YES; 147 return YES;
146 } 148 }
147 149
148 - (void)close { 150 - (void)close {
149 // Block the window from receiving events while it fades out. 151 // Block the window from receiving events while it fades out.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 - (void)sendEvent:(NSEvent*)theEvent { 221 - (void)sendEvent:(NSEvent*)theEvent {
220 if (!closing_) 222 if (!closing_)
221 [super sendEvent:theEvent]; 223 [super sendEvent:theEvent];
222 } 224 }
223 225
224 - (BOOL)isClosing { 226 - (BOOL)isClosing {
225 return closing_; 227 return closing_;
226 } 228 }
227 229
228 @end 230 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/info_bubble_window.h ('k') | chrome/browser/ui/cocoa/view_id_util_browsertest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698