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

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

Issue 496863003: Consolidate ExtensionAction execution code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" 5 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <string> 8 #include <string>
9 9
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 } else if (![hiddenButtons_ containsObject:button]) { 752 } else if (![hiddenButtons_ containsObject:button]) {
753 [hiddenButtons_ addObject:button]; 753 [hiddenButtons_ addObject:button];
754 [button removeFromSuperview]; 754 [button removeFromSuperview];
755 [button setAlphaValue:0.0]; 755 [button setAlphaValue:0.0];
756 } 756 }
757 } 757 }
758 758
759 - (BOOL)browserActionClicked:(BrowserActionButton*)button 759 - (BOOL)browserActionClicked:(BrowserActionButton*)button
760 shouldGrant:(BOOL)shouldGrant { 760 shouldGrant:(BOOL)shouldGrant {
761 const Extension* extension = [button extension]; 761 const Extension* extension = [button extension];
762 GURL popupUrl; 762 switch (extensions::ExtensionActionAPI::Get(profile_)->ExecuteExtensionAction(
763 switch (toolbarModel_->ExecuteBrowserAction(extension, browser_, &popupUrl, 763 extension, browser_, shouldGrant)) {
764 shouldGrant)) {
765 case ExtensionAction::ACTION_NONE: 764 case ExtensionAction::ACTION_NONE:
766 break; 765 break;
767 case ExtensionAction::ACTION_SHOW_POPUP: { 766 case ExtensionAction::ACTION_SHOW_POPUP: {
767 GURL popupUrl = extensions::ExtensionActionManager::Get(profile_)->
768 GetBrowserAction(*extension)->GetPopupUrl([self currentTabId]);
768 NSPoint arrowPoint = [self popupPointForBrowserAction:extension]; 769 NSPoint arrowPoint = [self popupPointForBrowserAction:extension];
769 [ExtensionPopupController showURL:popupUrl 770 [ExtensionPopupController showURL:popupUrl
770 inBrowser:browser_ 771 inBrowser:browser_
771 anchoredAt:arrowPoint 772 anchoredAt:arrowPoint
772 arrowLocation:info_bubble::kTopRight 773 arrowLocation:info_bubble::kTopRight
773 devMode:NO]; 774 devMode:NO];
774 return YES; 775 return YES;
775 } 776 }
776 } 777 }
777 return NO; 778 return NO;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 const extensions::ExtensionList& toolbar_items = 887 const extensions::ExtensionList& toolbar_items =
887 toolbarModel_->toolbar_items(); 888 toolbarModel_->toolbar_items();
888 if (index < toolbar_items.size()) { 889 if (index < toolbar_items.size()) {
889 const Extension* extension = toolbar_items[index].get(); 890 const Extension* extension = toolbar_items[index].get();
890 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; 891 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())];
891 } 892 }
892 return nil; 893 return nil;
893 } 894 }
894 895
895 @end 896 @end
OLDNEW
« no previous file with comments | « chrome/browser/extensions/page_action_controller.cc ('k') | chrome/browser/ui/cocoa/location_bar/page_action_decoration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698