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

Unified Diff: chrome/browser/ui/views/extensions/device_permissions_dialog_view.cc

Issue 2045093002: In DevicePermissionsDialogView disable Connect button if no device selected (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: in DevicePermissionsDialogView disable Connect button if no device selected Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/extensions/device_permissions_dialog_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/extensions/device_permissions_dialog_view.cc
diff --git a/chrome/browser/ui/views/extensions/device_permissions_dialog_view.cc b/chrome/browser/ui/views/extensions/device_permissions_dialog_view.cc
index 6f5d379cddcfa23f386cd1d1dab3ac9ef8e195ca..a8f490097f44db296021d23a46fd404020baa507 100644
--- a/chrome/browser/ui/views/extensions/device_permissions_dialog_view.cc
+++ b/chrome/browser/ui/views/extensions/device_permissions_dialog_view.cc
@@ -23,6 +23,7 @@
#include "ui/views/controls/table/table_view.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/layout_constants.h"
+#include "ui/views/window/dialog_client_view.h"
using device::UsbDevice;
using extensions::DevicePermissionsPrompt;
@@ -115,6 +116,7 @@ DevicePermissionsDialogView::DevicePermissionsDialogView(
table_columns,
views::TEXT_ONLY,
!prompt_->multiple());
+ table_view_->SetObserver(this);
views::View* table_parent = table_view_->CreateParentIfNecessary();
AddChildView(table_parent);
@@ -147,6 +149,12 @@ base::string16 DevicePermissionsDialogView::GetDialogButtonLabel(
return views::DialogDelegateView::GetDialogButtonLabel(button);
}
+bool DevicePermissionsDialogView::IsDialogButtonEnabled(
+ ui::DialogButton button) const {
+ return button != ui::DIALOG_BUTTON_OK ||
+ !table_view_->selection_model().empty();
+}
+
ui::ModalType DevicePermissionsDialogView::GetModalType() const {
return ui::MODAL_TYPE_CHILD;
}
@@ -159,6 +167,10 @@ gfx::Size DevicePermissionsDialogView::GetPreferredSize() const {
return gfx::Size(500, 250);
}
+void DevicePermissionsDialogView::OnSelectionChanged() {
+ GetDialogClientView()->UpdateDialogButtons();
+}
+
void ChromeDevicePermissionsPrompt::ShowDialogViews() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
« no previous file with comments | « chrome/browser/ui/views/extensions/device_permissions_dialog_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698