Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / views / apps / app_info_dialog / app_info_footer_panel.cc
index dfad49b..84112a3 100644 (file)
@@ -82,18 +82,24 @@ void AppInfoFooterPanel::LayoutButtons() {
     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();
+    }
   }
 }
 
@@ -121,7 +127,7 @@ void AppInfoFooterPanel::ExtensionUninstallAccepted() {
                               NULL);
 
   // Close the App Info dialog as well (which will free the dialog too).
-  GetWidget()->Close();
+  Close();
 }
 
 void AppInfoFooterPanel::ExtensionUninstallCanceled() {
@@ -137,8 +143,9 @@ void AppInfoFooterPanel::CreateShortcuts() {
 }
 
 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);
 }
 
@@ -152,7 +159,7 @@ void AppInfoFooterPanel::SetPinnedToShelf(bool value) {
   else
     shelf_delegate->UnpinAppWithID(app_->id());
 
-  UpdatePinButtons();
+  UpdatePinButtons(true);
   Layout();
 }
 
@@ -163,8 +170,8 @@ bool AppInfoFooterPanel::CanSetPinnedToShelf() const {
     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();
 }