AddChildView(pin_to_shelf_button_);
if (unpin_from_shelf_button_)
AddChildView(unpin_from_shelf_button_);
- UpdatePinButtons();
+ UpdatePinButtons(false);
if (remove_button_)
AddChildView(remove_button_);
}
-void AppInfoFooterPanel::UpdatePinButtons() {
+void AppInfoFooterPanel::UpdatePinButtons(bool focus_visible_button) {
if (pin_to_shelf_button_ && unpin_from_shelf_button_) {
bool is_pinned =
!ash::Shell::GetInstance()->GetShelfDelegate()->IsAppPinned(app_->id());
pin_to_shelf_button_->SetVisible(is_pinned);
unpin_from_shelf_button_->SetVisible(!is_pinned);
+
+ if (focus_visible_button) {
+ views::View* button_to_focus =
+ is_pinned ? pin_to_shelf_button_ : unpin_from_shelf_button_;
+ button_to_focus->RequestFocus();
+ }
}
}
NULL);
// Close the App Info dialog as well (which will free the dialog too).
- GetWidget()->Close();
+ Close();
}
void AppInfoFooterPanel::ExtensionUninstallCanceled() {
}
bool AppInfoFooterPanel::CanCreateShortcuts() const {
- // Ash platforms can't create shortcuts.
- return (chrome::GetHostDesktopTypeForNativeWindow(parent_window_) !=
+ // Ash platforms can't create shortcuts, and extensions can't have shortcuts.
+ return !app_->is_extension() &&
+ (chrome::GetHostDesktopTypeForNativeWindow(parent_window_) !=
chrome::HOST_DESKTOP_TYPE_ASH);
}
else
shelf_delegate->UnpinAppWithID(app_->id());
- UpdatePinButtons();
+ UpdatePinButtons(true);
Layout();
}
return false;
}
- // The Chrome app can't be unpinned.
- return app_->id() != extension_misc::kChromeAppId &&
+ // The Chrome app can't be unpinned, and extensions can't be pinned.
+ return app_->id() != extension_misc::kChromeAppId && !app_->is_extension() &&
ash::Shell::GetInstance()->GetShelfDelegate()->CanPin();
}