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

Unified Diff: chrome/browser/cocoa/autocomplete_text_field_editor.mm

Issue 600133: Mac: Content blocked icons. (Closed)
Patch Set: comments andybons Created 10 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/cocoa/autocomplete_text_field_editor.mm
diff --git a/chrome/browser/cocoa/autocomplete_text_field_editor.mm b/chrome/browser/cocoa/autocomplete_text_field_editor.mm
index b4e0a5ef58ac613a62f2bd6a85022e0141cda5e5..7eb8b93908a74b2debb55a7ba0c2b587cc5b827c 100644
--- a/chrome/browser/cocoa/autocomplete_text_field_editor.mm
+++ b/chrome/browser/cocoa/autocomplete_text_field_editor.mm
@@ -13,7 +13,6 @@
#import "chrome/browser/cocoa/autocomplete_text_field.h"
#import "chrome/browser/cocoa/autocomplete_text_field_cell.h"
#import "chrome/browser/cocoa/browser_window_controller.h"
-#import "chrome/browser/cocoa/extensions/extension_action_context_menu.h"
#import "chrome/browser/cocoa/toolbar_controller.h"
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/common/extensions/extension_action.h"
@@ -96,25 +95,13 @@ class Extension;
AutocompleteTextField* field = (AutocompleteTextField*)[self delegate];
NSRect bounds([field bounds]);
AutocompleteTextFieldCell* cell = [field autocompleteTextFieldCell];
- const size_t pageActionCount = [cell pageActionCount];
BOOL flipped = [self isFlipped];
- if (!profile_)
- return [self defaultMenuForEvent:event];
-
- ExtensionsService* service = profile_->GetExtensionsService();
- if (!service)
- return [self defaultMenuForEvent:event];
-
- for (size_t i = 0; i < pageActionCount; ++i) {
- NSRect pageActionFrame = [cell pageActionFrameForIndex:i inFrame:bounds];
- if (NSMouseInRect(location, pageActionFrame, flipped)) {
- Extension* extension = service->GetExtensionById(
- [cell pageActionForIndex:i]->extension_id(), false);
- DCHECK(extension);
- if (!extension)
- break;
- return [[[ExtensionActionContextMenu alloc]
- initWithExtension:extension profile:profile_] autorelease];
+
+ for (AutocompleteTextFieldIcon* icon in [cell layedOutIcons:bounds]) {
+ if (NSMouseInRect(location, [icon rect], flipped)) {
+ NSMenu* menu = [icon view]->GetMenu();
+ if (menu)
+ return menu;
}
}

Powered by Google App Engine
This is Rietveld 408576698