diff options
Diffstat (limited to 'chrome/browser/cocoa/extensions')
9 files changed, 33 insertions, 29 deletions
diff --git a/chrome/browser/cocoa/extensions/browser_action_button.h b/chrome/browser/cocoa/extensions/browser_action_button.h index 606b033..1205c80 100644 --- a/chrome/browser/cocoa/extensions/browser_action_button.h +++ b/chrome/browser/cocoa/extensions/browser_action_button.h @@ -42,7 +42,7 @@ extern NSString* const kBrowserActionButtonDragEndNotification; scoped_nsobject<NSViewAnimation> moveAnimation_; // The extension for this button. Weak. - Extension* extension_; + const Extension* extension_; // The ID of the active tab. int tabId_; @@ -57,7 +57,7 @@ extern NSString* const kBrowserActionButtonDragEndNotification; } - (id)initWithFrame:(NSRect)frame - extension:(Extension*)extension + extension:(const Extension*)extension profile:(Profile*)profile tabId:(int)tabId; @@ -76,7 +76,7 @@ extern NSString* const kBrowserActionButtonDragEndNotification; - (NSImage*)compositedImage; @property(readonly, nonatomic) BOOL isBeingDragged; -@property(readonly, nonatomic) Extension* extension; +@property(readonly, nonatomic) const Extension* extension; @property(readwrite, nonatomic) int tabId; @end diff --git a/chrome/browser/cocoa/extensions/browser_action_button.mm b/chrome/browser/cocoa/extensions/browser_action_button.mm index 70f15ee..0cdaee5 100644 --- a/chrome/browser/cocoa/extensions/browser_action_button.mm +++ b/chrome/browser/cocoa/extensions/browser_action_button.mm @@ -45,7 +45,8 @@ const CGFloat kShadowOffset = 2.0; class ExtensionImageTrackerBridge : public NotificationObserver, public ImageLoadingTracker::Observer { public: - ExtensionImageTrackerBridge(BrowserActionButton* owner, Extension* extension) + ExtensionImageTrackerBridge(BrowserActionButton* owner, + const Extension* extension) : owner_(owner), tracker_(this) { // The Browser Action API does not allow the default icon path to be @@ -113,7 +114,7 @@ class ExtensionImageTrackerBridge : public NotificationObserver, } - (id)initWithFrame:(NSRect)frame - extension:(Extension*)extension + extension:(const Extension*)extension profile:(Profile*)profile tabId:(int)tabId { if ((self = [super initWithFrame:frame])) { diff --git a/chrome/browser/cocoa/extensions/browser_actions_controller.h b/chrome/browser/cocoa/extensions/browser_actions_controller.h index 21b0b95..8f039ce 100644 --- a/chrome/browser/cocoa/extensions/browser_actions_controller.h +++ b/chrome/browser/cocoa/extensions/browser_actions_controller.h @@ -88,7 +88,7 @@ extern NSString* const kBrowserActionVisibilityChangedNotification; - (void)resizeContainerAndAnimate:(BOOL)animate; // Returns the NSView for the action button associated with an extension. -- (NSView*)browserActionViewForExtension:(Extension*)extension; +- (NSView*)browserActionViewForExtension:(const Extension*)extension; // Returns the saved width determined by the number of shown Browser Actions // preference property. If no preference is found, then the width for the @@ -98,7 +98,7 @@ extern NSString* const kBrowserActionVisibilityChangedNotification; // Returns where the popup arrow should point to for a given Browser Action. If // it is passed an extension that is not a Browser Action, then it will return // NSZeroPoint. -- (NSPoint)popupPointForBrowserAction:(Extension*)extension; +- (NSPoint)popupPointForBrowserAction:(const Extension*)extension; // Returns whether the chevron button is currently hidden or in the process of // being hidden (fading out). Will return NO if it is not hidden or is in the diff --git a/chrome/browser/cocoa/extensions/browser_actions_controller.mm b/chrome/browser/cocoa/extensions/browser_actions_controller.mm index e5a58ad..456ceba 100644 --- a/chrome/browser/cocoa/extensions/browser_actions_controller.mm +++ b/chrome/browser/cocoa/extensions/browser_actions_controller.mm @@ -70,13 +70,13 @@ const CGFloat kBrowserActionBubbleYOffset = 3.0; // Creates and then adds the given extension's action button to the container // at the given index within the container. It does not affect the toolbar model // object since it is called when the toolbar model changes. -- (void)createActionButtonForExtension:(Extension*)extension +- (void)createActionButtonForExtension:(const Extension*)extension withIndex:(NSUInteger)index; // Removes an action button for the given extension from the container. This // method also does not affect the underlying toolbar model since it is called // when the toolbar model changes. -- (void)removeActionButtonForExtension:(Extension*)extension; +- (void)removeActionButtonForExtension:(const Extension*)extension; // Useful in the case of a Browser Action being added/removed from the middle of // the container, this method repositions each button according to the current @@ -90,7 +90,7 @@ const CGFloat kBrowserActionBubbleYOffset = 3.0; // Returns the existing button with the given extension backing it; nil if it // cannot be found or the extension's ID is invalid. -- (BrowserActionButton*)buttonForExtension:(Extension*)extension; +- (BrowserActionButton*)buttonForExtension:(const Extension*)extension; // Returns the preferred width of the container given the number of visible // buttons |buttonCount|. @@ -141,7 +141,7 @@ const CGFloat kBrowserActionBubbleYOffset = 3.0; // Returns whether the given extension should be displayed. Only displays // incognito-enabled extensions in incognito mode. Otherwise returns YES. -- (BOOL)shouldDisplayBrowserAction:(Extension*)extension; +- (BOOL)shouldDisplayBrowserAction:(const Extension*)extension; // The reason |frame| is specified in these chevron functions is because the // container may be animating and the end frame of the animation should be @@ -203,12 +203,12 @@ class ExtensionsServiceObserverBridge : public NotificationObserver, } // ExtensionToolbarModel::Observer implementation. - void BrowserActionAdded(Extension* extension, int index) { + void BrowserActionAdded(const Extension* extension, int index) { [owner_ createActionButtonForExtension:extension withIndex:index]; [owner_ resizeContainerAndAnimate:NO]; } - void BrowserActionRemoved(Extension* extension) { + void BrowserActionRemoved(const Extension* extension) { [owner_ removeActionButtonForExtension:extension]; [owner_ resizeContainerAndAnimate:NO]; } @@ -342,7 +342,7 @@ class ExtensionsServiceObserverBridge : public NotificationObserver, } } -- (NSView*)browserActionViewForExtension:(Extension*)extension { +- (NSView*)browserActionViewForExtension:(const Extension*)extension { for (BrowserActionButton* button in [buttons_ allValues]) { if ([button extension] == extension) return button; @@ -374,7 +374,7 @@ class ExtensionsServiceObserverBridge : public NotificationObserver, return [self containerWidthWithButtonCount:savedButtonCount]; } -- (NSPoint)popupPointForBrowserAction:(Extension*)extension { +- (NSPoint)popupPointForBrowserAction:(const Extension*)extension { if (!extension->browser_action()) return NSZeroPoint; @@ -446,7 +446,7 @@ class ExtensionsServiceObserverBridge : public NotificationObserver, [containerView_ resizeToWidth:width animate:NO]; } -- (void)createActionButtonForExtension:(Extension*)extension +- (void)createActionButtonForExtension:(const Extension*)extension withIndex:(NSUInteger)index { if (!extension->browser_action()) return; @@ -491,7 +491,7 @@ class ExtensionsServiceObserverBridge : public NotificationObserver, [containerView_ setNeedsDisplay:YES]; } -- (void)removeActionButtonForExtension:(Extension*)extension { +- (void)removeActionButtonForExtension:(const Extension*)extension { if (!extension->browser_action()) return; @@ -555,7 +555,7 @@ class ExtensionsServiceObserverBridge : public NotificationObserver, } } -- (BrowserActionButton*)buttonForExtension:(Extension*)extension { +- (BrowserActionButton*)buttonForExtension:(const Extension*)extension { NSString* extensionId = base::SysUTF8ToNSString(extension->id()); DCHECK(extensionId); if (!extensionId) @@ -744,7 +744,7 @@ class ExtensionsServiceObserverBridge : public NotificationObserver, } } -- (BOOL)shouldDisplayBrowserAction:(Extension*)extension { +- (BOOL)shouldDisplayBrowserAction:(const Extension*)extension { // Only display incognito-enabled extensions while in incognito mode. return (!profile_->IsOffTheRecord() || profile_->GetExtensionsService()->IsIncognitoEnabled(extension)); @@ -854,7 +854,7 @@ class ExtensionsServiceObserverBridge : public NotificationObserver, if (profile_->IsOffTheRecord()) index = toolbarModel_->IncognitoIndexToOriginal(index); if (index < toolbarModel_->size()) { - Extension* extension = toolbarModel_->GetExtensionByIndex(index); + const Extension* extension = toolbarModel_->GetExtensionByIndex(index); return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; } return nil; diff --git a/chrome/browser/cocoa/extensions/extension_action_context_menu.h b/chrome/browser/cocoa/extensions/extension_action_context_menu.h index 3c9e216..80e8398 100644 --- a/chrome/browser/cocoa/extensions/extension_action_context_menu.h +++ b/chrome/browser/cocoa/extensions/extension_action_context_menu.h @@ -28,7 +28,7 @@ class DevmodeObserver; @interface ExtensionActionContextMenu : NSMenu { @private // The extension that this menu belongs to. Weak. - Extension* extension_; + const Extension* extension_; // The extension action this menu belongs to. Weak. ExtensionAction* action_; @@ -48,7 +48,7 @@ class DevmodeObserver; } // Initializes and returns a context menu for the given extension and profile. -- (id)initWithExtension:(Extension*)extension +- (id)initWithExtension:(const Extension*)extension profile:(Profile*)profile extensionAction:(ExtensionAction*)action; diff --git a/chrome/browser/cocoa/extensions/extension_action_context_menu.mm b/chrome/browser/cocoa/extensions/extension_action_context_menu.mm index 81aa61e..36ff520 100644 --- a/chrome/browser/cocoa/extensions/extension_action_context_menu.mm +++ b/chrome/browser/cocoa/extensions/extension_action_context_menu.mm @@ -36,7 +36,7 @@ // Also acts as the extension's UI delegate in order to display the dialog. class AsyncUninstaller : public ExtensionInstallUI::Delegate { public: - AsyncUninstaller(Extension* extension, Profile* profile) + AsyncUninstaller(const Extension* extension, Profile* profile) : extension_(extension), profile_(profile) { install_ui_.reset(new ExtensionInstallUI(profile)); @@ -55,7 +55,7 @@ class AsyncUninstaller : public ExtensionInstallUI::Delegate { private: // The extension that we're loading the icon for. Weak. - Extension* extension_; + const Extension* extension_; // The current profile. Weak. Profile* profile_; @@ -125,7 +125,7 @@ int CurrentTabId() { } // namespace -- (id)initWithExtension:(Extension*)extension +- (id)initWithExtension:(const Extension*)extension profile:(Profile*)profile extensionAction:(ExtensionAction*)action{ if ((self = [super initWithTitle:@""])) { diff --git a/chrome/browser/cocoa/extensions/extension_infobar_controller.mm b/chrome/browser/cocoa/extensions/extension_infobar_controller.mm index 1bb1a5f..a2a38f2 100644 --- a/chrome/browser/cocoa/extensions/extension_infobar_controller.mm +++ b/chrome/browser/cocoa/extensions/extension_infobar_controller.mm @@ -65,7 +65,7 @@ class InfobarBridge : public ExtensionInfoBarDelegate::DelegateObserver, // Load the Extension's icon image. void LoadIcon() { - Extension* extension = delegate_->extension_host()->extension(); + const Extension* extension = delegate_->extension_host()->extension(); ExtensionResource icon_resource = extension->GetIconResource( Extension::EXTENSION_ICON_BITTY, ExtensionIconSet::MATCH_EXACTLY); if (!icon_resource.relative_path().empty()) { diff --git a/chrome/browser/cocoa/extensions/extension_install_prompt_controller.h b/chrome/browser/cocoa/extensions/extension_install_prompt_controller.h index 0fb4d4e..8a6a4ce 100644 --- a/chrome/browser/cocoa/extensions/extension_install_prompt_controller.h +++ b/chrome/browser/cocoa/extensions/extension_install_prompt_controller.h @@ -49,7 +49,7 @@ class Profile; - (id)initWithParentWindow:(NSWindow*)window profile:(Profile*)profile - extension:(Extension*)extension + extension:(const Extension*)extension delegate:(ExtensionInstallUI::Delegate*)delegate icon:(SkBitmap*)bitmap warnings:(const std::vector<string16>&)warnings; diff --git a/chrome/browser/cocoa/extensions/extension_install_prompt_controller.mm b/chrome/browser/cocoa/extensions/extension_install_prompt_controller.mm index 9ba758b..10f4f81 100644 --- a/chrome/browser/cocoa/extensions/extension_install_prompt_controller.mm +++ b/chrome/browser/cocoa/extensions/extension_install_prompt_controller.mm @@ -58,7 +58,7 @@ void OffsetControlVertically(NSControl* control, CGFloat amount) { - (id)initWithParentWindow:(NSWindow*)window profile:(Profile*)profile - extension:(Extension*)extension + extension:(const Extension*)extension delegate:(ExtensionInstallUI::Delegate*)delegate icon:(SkBitmap*)icon warnings:(const std::vector<string16>&)warnings { @@ -185,7 +185,10 @@ void OffsetControlVertically(NSControl* control, CGFloat amount) { void ExtensionInstallUI::ShowExtensionInstallUIPrompt2Impl( - Profile* profile, Delegate* delegate, Extension* extension, SkBitmap* icon, + Profile* profile, + Delegate* delegate, + const Extension* extension, + SkBitmap* icon, const std::vector<string16>& warnings) { Browser* browser = BrowserList::GetLastActiveWithProfile(profile); if (!browser) { |