OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "extension_installed_bubble_controller.h" | 5 #import "extension_installed_bubble_controller.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/mac_util.h" | 8 #include "base/mac_util.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "chrome/browser/browser.h" | 10 #include "chrome/browser/browser.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 167 |
168 switch(type_) { | 168 switch(type_) { |
169 case extension_installed_bubble::kBrowserAction: { | 169 case extension_installed_bubble::kBrowserAction: { |
170 // Find the center of the bottom of the browser action icon. | 170 // Find the center of the bottom of the browser action icon. |
171 NSView* button = [[[window->cocoa_controller() toolbarController] | 171 NSView* button = [[[window->cocoa_controller() toolbarController] |
172 browserActionsController] browserActionViewForExtension:extension_]; | 172 browserActionsController] browserActionViewForExtension:extension_]; |
173 DCHECK(button); | 173 DCHECK(button); |
174 NSRect boundsRect = [[[button window] contentView] | 174 NSRect boundsRect = [[[button window] contentView] |
175 convertRect:[button frame] | 175 convertRect:[button frame] |
176 fromView:[button superview]]; | 176 fromView:[button superview]]; |
177 arrowPoint = | 177 CGFloat xPos = NSMinX(boundsRect) + NSWidth([button frame]) / 2; |
178 NSMakePoint(NSMinX(boundsRect) + NSWidth([button frame]) / 2, | 178 // If the button is hidden, display the button at the edge of the Browser |
179 NSMinY(boundsRect)); | 179 // Actions container. |
| 180 // TODO(andybons): Make it point to the chevron once it's implemented. |
| 181 if ([button alphaValue] == 0.0) |
| 182 xPos = NSMaxX([[button superview] frame]); |
| 183 |
| 184 arrowPoint = NSMakePoint(xPos, NSMinY(boundsRect)); |
180 break; | 185 break; |
181 } | 186 } |
182 case extension_installed_bubble::kPageAction: { | 187 case extension_installed_bubble::kPageAction: { |
183 LocationBarViewMac* locationBarView = | 188 LocationBarViewMac* locationBarView = |
184 static_cast<LocationBarViewMac*>( | 189 static_cast<LocationBarViewMac*>( |
185 [[window->cocoa_controller() toolbarController] | 190 [[window->cocoa_controller() toolbarController] |
186 locationBarBridge]); | 191 locationBarBridge]); |
187 // Tell the location bar to show a preview of the page action icon, which | 192 // Tell the location bar to show a preview of the page action icon, which |
188 // would ordinarily only be displayed on a page of the appropriate type. | 193 // would ordinarily only be displayed on a page of the appropriate type. |
189 // We remove this preview when the extension installed bubble closes. | 194 // We remove this preview when the extension installed bubble closes. |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 341 |
337 - (NSRect)getPageActionInfoMsgFrame { | 342 - (NSRect)getPageActionInfoMsgFrame { |
338 return [pageActionInfoMsg_ frame]; | 343 return [pageActionInfoMsg_ frame]; |
339 } | 344 } |
340 | 345 |
341 - (NSRect)getExtensionInstalledInfoMsgFrame { | 346 - (NSRect)getExtensionInstalledInfoMsgFrame { |
342 return [extensionInstalledInfoMsg_ frame]; | 347 return [extensionInstalledInfoMsg_ frame]; |
343 } | 348 } |
344 | 349 |
345 @end | 350 @end |
OLD | NEW |