summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/importer_view.cc
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-06 22:38:08 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-06 22:38:08 +0000
commit3693262b7dee1403e3adb8ad240fad8e2fa80e85 (patch)
tree4c6d4c7f948d123cdf99592cd58be7e2bf19d6ab /chrome/browser/views/importer_view.cc
parent2590b5c54896952e37a3f24e3cc3e59e6b415573 (diff)
downloadchromium_src-3693262b7dee1403e3adb8ad240fad8e2fa80e85.zip
chromium_src-3693262b7dee1403e3adb8ad240fad8e2fa80e85.tar.gz
chromium_src-3693262b7dee1403e3adb8ad240fad8e2fa80e85.tar.bz2
Lands http://codereview.chromium.org/1543007 for Thiago:
views: Disable the "Import" button on Import Bookmarks dialog if there is no checkbox checked. BUG=30401 TEST=open Import Bookmarks dialog, uncheck all checkboxes, see if the "Import" button is disabled. Review URL: http://codereview.chromium.org/1566022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43774 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/importer_view.cc')
-rw-r--r--chrome/browser/views/importer_view.cc22
1 files changed, 21 insertions, 1 deletions
diff --git a/chrome/browser/views/importer_view.cc b/chrome/browser/views/importer_view.cc
index d99fd42..151badf 100644
--- a/chrome/browser/views/importer_view.cc
+++ b/chrome/browser/views/importer_view.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -126,6 +126,18 @@ std::wstring ImporterView::GetDialogButtonLabel(
}
}
+bool ImporterView::IsDialogButtonEnabled(
+ MessageBoxFlags::DialogButton button) const {
+ if (button == MessageBoxFlags::DIALOGBUTTON_OK) {
+ return history_checkbox_->checked() ||
+ favorites_checkbox_->checked() ||
+ passwords_checkbox_->checked() ||
+ search_engines_checkbox_->checked();
+ }
+
+ return true;
+}
+
bool ImporterView::IsModal() const {
return true;
}
@@ -156,6 +168,13 @@ views::View* ImporterView::GetContentsView() {
return this;
}
+void ImporterView::ButtonPressed(
+ views::Button* sender, const views::Event& event) {
+ // When no checkbox is checked we should disable the "Import" button.
+ // This forces the button to evaluate what state they should be in.
+ GetDialogClientView()->UpdateDialogButtons();
+}
+
int ImporterView::GetItemCount() {
DCHECK(importer_host_.get());
int item_count = importer_host_->GetAvailableProfileCount();
@@ -205,6 +224,7 @@ views::Checkbox* ImporterView::InitCheckbox(const std::wstring& text,
bool checked) {
views::Checkbox* checkbox = new views::Checkbox(text);
checkbox->SetChecked(checked);
+ checkbox->set_listener(this);
return checkbox;
}