}
// extensions::ExtensionToolbarModel::Observer implementation.
- virtual void BrowserActionAdded(
+ virtual void ToolbarExtensionAdded(
const Extension* extension,
int index) OVERRIDE {
[owner_ createActionButtonForExtension:extension withIndex:index];
[owner_ resizeContainerAndAnimate:NO];
}
- virtual void BrowserActionRemoved(const Extension* extension) OVERRIDE {
+ virtual void ToolbarExtensionRemoved(const Extension* extension) OVERRIDE {
[owner_ removeActionButtonForExtension:extension];
[owner_ resizeContainerAndAnimate:NO];
}
- virtual bool BrowserActionShowPopup(const Extension* extension) OVERRIDE {
+ virtual void ToolbarExtensionMoved(const Extension* extension,
+ int index) OVERRIDE {
+ }
+
+ virtual void ToolbarExtensionUpdated(const Extension* extension) OVERRIDE {
+ BrowserActionButton* button = [owner_ buttonForExtension:extension];
+ if (button)
+ [button updateState];
+ }
+
+ virtual bool ShowExtensionActionPopup(const Extension* extension,
+ bool grant_active_tab) OVERRIDE {
// Do not override other popups and only show in active window.
ExtensionPopupController* popup = [ExtensionPopupController popup];
if (popup || !browser_->window()->IsActive())
BrowserActionButton* button = [owner_ buttonForExtension:extension];
return button && [owner_ browserActionClicked:button
- shouldGrant:NO];
+ shouldGrant:grant_active_tab];
+ }
+
+ virtual void ToolbarVisibleCountChanged() OVERRIDE {
+ }
+
+ virtual void ToolbarHighlightModeChanged(bool is_highlighting) OVERRIDE {
+ }
+
+ virtual Browser* GetBrowser() OVERRIDE {
+ return browser_;
}
private:
if (intersectionWidth > dragThreshold && button != draggedButton &&
![button isAnimating] && index < [self visibleButtonCount]) {
- toolbarModel_->MoveBrowserAction([draggedButton extension], index);
+ toolbarModel_->MoveExtensionIcon([draggedButton extension], index);
[self positionActionButtonsAndAnimate:YES];
return;
}
- (BOOL)browserActionClicked:(BrowserActionButton*)button
shouldGrant:(BOOL)shouldGrant {
const Extension* extension = [button extension];
- GURL popupUrl;
- switch (toolbarModel_->ExecuteBrowserAction(extension, browser_, &popupUrl,
- shouldGrant)) {
+ switch (extensions::ExtensionActionAPI::Get(profile_)->ExecuteExtensionAction(
+ extension, browser_, shouldGrant)) {
case ExtensionAction::ACTION_NONE:
break;
case ExtensionAction::ACTION_SHOW_POPUP: {
+ GURL popupUrl = extensions::ExtensionActionManager::Get(profile_)->
+ GetBrowserAction(*extension)->GetPopupUrl([self currentTabId]);
NSPoint arrowPoint = [self popupPointForBrowserAction:extension];
[ExtensionPopupController showURL:popupUrl
inBrowser:browser_