| Index: chrome/browser/cocoa/location_bar/location_bar_view_mac.mm
|
| diff --git a/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm
|
| index 74c8d2e2489f5f2d0c87a7bf6d5cccf2291a0b21..b31ce913e67e34d06035e730b9e723b41be1df8f 100644
|
| --- a/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm
|
| +++ b/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm
|
| @@ -284,8 +284,11 @@ void LocationBarViewMac::SetPreviewEnabledPageAction(
|
| page_action_views_.RefreshViews();
|
| [field_ setNeedsDisplay:YES];
|
|
|
| - LocationBarViewMac::PageActionImageView* page_action_image_view =
|
| - GetPageActionImageView(page_action);
|
| + LocationBarViewMac::PageActionImageView* page_action_image_view = NULL;
|
| + for (size_t i = 0; i < page_action_views_.Count(); ++i) {
|
| + if (page_action_views_.ViewAt(i)->page_action() == page_action)
|
| + page_action_image_view = page_action_views_.ViewAt(i);
|
| + }
|
| DCHECK(page_action_image_view);
|
| if (!page_action_image_view)
|
| return;
|
| @@ -295,33 +298,27 @@ void LocationBarViewMac::SetPreviewEnabledPageAction(
|
| GURL(WideToUTF8(toolbar_model_->GetText())));
|
| }
|
|
|
| -NSRect LocationBarViewMac::GetPageActionFrame(ExtensionAction* page_action) {
|
| - const size_t index = GetPageActionIndex(page_action);
|
| - AutocompleteTextFieldCell* cell = [field_ autocompleteTextFieldCell];
|
| - const NSRect iconRect =
|
| - [cell pageActionFrameForIndex:index inFrame:[field_ bounds]];
|
| - return [field_ convertRect:iconRect toView:nil];
|
| -}
|
| -
|
| -size_t LocationBarViewMac::GetPageActionIndex(ExtensionAction* page_action) {
|
| +NSPoint LocationBarViewMac::GetPageActionBubblePoint(
|
| + ExtensionAction* page_action) {
|
| DCHECK(page_action);
|
| - for (size_t i = 0; i < page_action_views_.Count(); ++i) {
|
| - if (page_action_views_.ViewAt(i)->page_action() == page_action)
|
| - return i;
|
| + size_t index = 0;
|
| + for (; index < page_action_views_.Count(); ++index) {
|
| + if (page_action_views_.ViewAt(index)->page_action() == page_action)
|
| + break;
|
| }
|
| - NOTREACHED();
|
| - return 0;
|
| -}
|
| + DCHECK_LT(index, page_action_views_.Count());
|
| + if (index == page_action_views_.Count())
|
| + return NSZeroPoint;
|
|
|
| -LocationBarViewMac::PageActionImageView*
|
| - LocationBarViewMac::GetPageActionImageView(ExtensionAction* page_action) {
|
| - DCHECK(page_action);
|
| - for (size_t i = 0; i < page_action_views_.Count(); ++i) {
|
| - if (page_action_views_.ViewAt(i)->page_action() == page_action)
|
| - return page_action_views_.ViewAt(i);
|
| + AutocompleteTextFieldCell* cell = [field_ autocompleteTextFieldCell];
|
| + NSRect frame = [cell pageActionFrameForIndex:index inFrame:[field_ bounds]];
|
| + if (!NSIsEmptyRect(frame)) {
|
| + frame = [field_ convertRect:frame toView:nil];
|
| + return NSMakePoint(NSMidX(frame), NSMinY(frame));
|
| }
|
| +
|
| NOTREACHED();
|
| - return NULL;
|
| + return NSZeroPoint;
|
| }
|
|
|
| ExtensionAction* LocationBarViewMac::GetPageAction(size_t index) {
|
|
|