| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "browser_actions_controller.h" | 5 #import "browser_actions_controller.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "app/gfx/canvas_paint.h" | 9 #include "app/gfx/canvas_paint.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 BrowserActionButton* actionButton = [buttons_ objectForKey:extensionId]; | 434 BrowserActionButton* actionButton = [buttons_ objectForKey:extensionId]; |
| 435 NSRect relativeButtonBounds = [[[actionButton window] contentView] | 435 NSRect relativeButtonBounds = [[[actionButton window] contentView] |
| 436 convertRect:[actionButton bounds] | 436 convertRect:[actionButton bounds] |
| 437 fromView:actionButton]; | 437 fromView:actionButton]; |
| 438 NSPoint arrowPoint = [[actionButton window] convertBaseToScreen:NSMakePoint( | 438 NSPoint arrowPoint = [[actionButton window] convertBaseToScreen:NSMakePoint( |
| 439 NSMinX(relativeButtonBounds), | 439 NSMinX(relativeButtonBounds), |
| 440 NSMinY(relativeButtonBounds))]; | 440 NSMinY(relativeButtonBounds))]; |
| 441 // Adjust the anchor point to be at the center of the browser action button. | 441 // Adjust the anchor point to be at the center of the browser action button. |
| 442 arrowPoint.x += kBrowserActionWidth / 2; | 442 arrowPoint.x += kBrowserActionWidth / 2; |
| 443 | 443 |
| 444 popupController_ = | 444 popupController_ = [ExtensionPopupController showURL:action->popup_url() |
| 445 [[ExtensionPopupController showURL:action->popup_url() | 445 inBrowser:browser_ |
| 446 inBrowser:browser_ | 446 anchoredAt:arrowPoint |
| 447 anchoredAt:arrowPoint | 447 arrowLocation:kTopRight]; |
| 448 arrowLocation:kTopRight] retain]; | |
| 449 } else { | 448 } else { |
| 450 ExtensionBrowserEventRouter::GetInstance()->BrowserActionExecuted( | 449 ExtensionBrowserEventRouter::GetInstance()->BrowserActionExecuted( |
| 451 profile_, action->extension_id(), browser_); | 450 profile_, action->extension_id(), browser_); |
| 452 } | 451 } |
| 453 } | 452 } |
| 454 | 453 |
| 455 - (int)currentTabId { | 454 - (int)currentTabId { |
| 456 TabContents* selected_tab = browser_->GetSelectedTabContents(); | 455 TabContents* selected_tab = browser_->GetSelectedTabContents(); |
| 457 if (!selected_tab) | 456 if (!selected_tab) |
| 458 return -1; | 457 return -1; |
| 459 | 458 |
| 460 return selected_tab->controller().session_id().id(); | 459 return selected_tab->controller().session_id().id(); |
| 461 } | 460 } |
| 462 | 461 |
| 463 - (NSButton*)buttonWithIndex:(int)index { | 462 - (NSButton*)buttonWithIndex:(int)index { |
| 464 return [buttonOrder_ objectAtIndex:(NSUInteger)index]; | 463 return [buttonOrder_ objectAtIndex:(NSUInteger)index]; |
| 465 } | 464 } |
| 466 | 465 |
| 467 @end | 466 @end |
| OLD | NEW |