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

Side by Side Diff: chrome/browser/cocoa/extensions/browser_actions_controller.mm

Issue 524023: [Mac] Fixes bug where clicking a Browser Action button twice quickly will res... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 11 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 | « no previous file | 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) 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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 BrowserActionButton* actionButton = [buttons_ objectForKey:extensionId]; 436 BrowserActionButton* actionButton = [buttons_ objectForKey:extensionId];
437 NSRect relativeButtonBounds = [[[actionButton window] contentView] 437 NSRect relativeButtonBounds = [[[actionButton window] contentView]
438 convertRect:[actionButton bounds] 438 convertRect:[actionButton bounds]
439 fromView:actionButton]; 439 fromView:actionButton];
440 NSPoint arrowPoint = [[actionButton window] convertBaseToScreen:NSMakePoint( 440 NSPoint arrowPoint = [[actionButton window] convertBaseToScreen:NSMakePoint(
441 NSMinX(relativeButtonBounds), 441 NSMinX(relativeButtonBounds),
442 NSMinY(relativeButtonBounds))]; 442 NSMinY(relativeButtonBounds))];
443 // Adjust the anchor point to be at the center of the browser action button. 443 // Adjust the anchor point to be at the center of the browser action button.
444 arrowPoint.x += kBrowserActionWidth / 2; 444 arrowPoint.x += kBrowserActionWidth / 2;
445 445
446 // Close any existing (or loading) popup owned by this controller.
447 if (popupController_)
448 [self hidePopup];
449
446 popupController_ = [ExtensionPopupController showURL:action->popup_url() 450 popupController_ = [ExtensionPopupController showURL:action->popup_url()
447 inBrowser:browser_ 451 inBrowser:browser_
448 anchoredAt:arrowPoint 452 anchoredAt:arrowPoint
449 arrowLocation:kTopRight]; 453 arrowLocation:kTopRight];
450 } else { 454 } else {
451 ExtensionBrowserEventRouter::GetInstance()->BrowserActionExecuted( 455 ExtensionBrowserEventRouter::GetInstance()->BrowserActionExecuted(
452 profile_, action->extension_id(), browser_); 456 profile_, action->extension_id(), browser_);
453 } 457 }
454 } 458 }
455 459
456 - (int)currentTabId { 460 - (int)currentTabId {
457 TabContents* selected_tab = browser_->GetSelectedTabContents(); 461 TabContents* selected_tab = browser_->GetSelectedTabContents();
458 if (!selected_tab) 462 if (!selected_tab)
459 return -1; 463 return -1;
460 464
461 return selected_tab->controller().session_id().id(); 465 return selected_tab->controller().session_id().id();
462 } 466 }
463 467
464 - (NSButton*)buttonWithIndex:(int)index { 468 - (NSButton*)buttonWithIndex:(int)index {
465 return [buttonOrder_ objectAtIndex:(NSUInteger)index]; 469 return [buttonOrder_ objectAtIndex:(NSUInteger)index];
466 } 470 }
467 471
468 @end 472 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698