OLD | NEW |
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/extensions/extension_installed_bubble_controlle
r.h" | 5 #import "chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controlle
r.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 arrowPoint = [wrenchButton convertPoint:anchor toView:nil]; | 214 arrowPoint = [wrenchButton convertPoint:anchor toView:nil]; |
215 break; | 215 break; |
216 } | 216 } |
217 default: { | 217 default: { |
218 NOTREACHED() << "Generic extension type not allowed in install bubble."; | 218 NOTREACHED() << "Generic extension type not allowed in install bubble."; |
219 } | 219 } |
220 } | 220 } |
221 return arrowPoint; | 221 return arrowPoint; |
222 } | 222 } |
223 | 223 |
224 // We want this to be a child of a browser window. addChildWindow: | 224 // Override -[BaseBubbleController showWindow:] to tweak bubble location and |
225 // (called from this function) will bring the window on-screen; | 225 // set up UI elements. |
226 // unfortunately, [NSWindowController showWindow:] will also bring it | |
227 // on-screen (but will cause unexpected changes to the window's | |
228 // position). We cannot have an addChildWindow: and a subsequent | |
229 // showWindow:. Thus, we have our own version. | |
230 - (void)showWindow:(id)sender { | 226 - (void)showWindow:(id)sender { |
231 // Generic extensions get an infobar rather than a bubble. | 227 // Generic extensions get an infobar rather than a bubble. |
232 DCHECK(type_ != extension_installed_bubble::kGeneric); | 228 DCHECK(type_ != extension_installed_bubble::kGeneric); |
233 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 229 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
234 | 230 |
235 // Load nib and calculate height based on messages to be shown. | 231 // Load nib and calculate height based on messages to be shown. |
236 NSWindow* window = [self initializeWindow]; | 232 NSWindow* window = [self initializeWindow]; |
237 int newWindowHeight = [self calculateWindowHeight]; | 233 int newWindowHeight = [self calculateWindowHeight]; |
238 [self.bubble setFrameSize:NSMakeSize( | 234 [self.bubble setFrameSize:NSMakeSize( |
239 NSWidth([[window contentView] bounds]), newWindowHeight)]; | 235 NSWidth([[window contentView] bounds]), newWindowHeight)]; |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 | 449 |
454 - (NSRect)getExtensionInstalledInfoMsgFrame { | 450 - (NSRect)getExtensionInstalledInfoMsgFrame { |
455 return [extensionInstalledInfoMsg_ frame]; | 451 return [extensionInstalledInfoMsg_ frame]; |
456 } | 452 } |
457 | 453 |
458 - (void)extensionUnloaded:(id)sender { | 454 - (void)extensionUnloaded:(id)sender { |
459 extension_ = NULL; | 455 extension_ = NULL; |
460 } | 456 } |
461 | 457 |
462 @end | 458 @end |
OLD | NEW |