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

Unified Diff: chrome/browser/autofill/autofill_popup_view.cc

Issue 9432029: GTK Keyboard Support for New Autofill (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 9 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
Index: chrome/browser/autofill/autofill_popup_view.cc
diff --git a/chrome/browser/autofill/autofill_popup_view.cc b/chrome/browser/autofill/autofill_popup_view.cc
index 7e3ba5a3be0d87fca605378dd1c5b1d6857fa3ad..940974e4e7753a04b31bfc3bfd9d889c9bd9185b 100644
--- a/chrome/browser/autofill/autofill_popup_view.cc
+++ b/chrome/browser/autofill/autofill_popup_view.cc
@@ -17,6 +17,9 @@ AutofillPopupView::AutofillPopupView(
AutofillExternalDelegate* external_delegate)
: external_delegate_(external_delegate),
selected_line_(-1) {
Ilya Sherman 2012/03/21 23:35:30 nit: Please use the named constant here.
csharp 2012/03/23 15:10:52 Done.
+ if (!web_contents)
+ return;
+
registrar_.Add(this,
content::NOTIFICATION_WEB_CONTENTS_HIDDEN,
content::Source<content::WebContents>(web_contents));
@@ -54,21 +57,53 @@ void AutofillPopupView::SetSelectedLine(int selected_line) {
if (selected_line_ == selected_line)
return;
- if (selected_line_ != -1)
+ if (selected_line_ != kNoSelection)
InvalidateRow(selected_line_);
- if (selected_line != -1)
+ if (selected_line != kNoSelection)
InvalidateRow(selected_line);
selected_line_ = selected_line;
- if (selected_line_ != -1) {
+ if (selected_line_ != kNoSelection) {
external_delegate_->SelectAutofillSuggestionAtIndex(
autofill_unique_ids_[selected_line_],
selected_line);
}
}
+void AutofillPopupView::SelectNextLine() {
+ int new_selected_line = selected_line_ + 1;
+
+ if (new_selected_line == static_cast<int>(autofill_values_.size()))
+ new_selected_line = kNoSelection;
+
+ SetSelectedLine(new_selected_line);
+}
+
+void AutofillPopupView::SelectPreviousLine() {
+ int new_selected_line = selected_line_ - 1;
+
+ if (new_selected_line < kNoSelection)
+ new_selected_line = autofill_values_.size() - 1;
+
+ SetSelectedLine(new_selected_line);
+}
+
+void AutofillPopupView::AcceptSelectedLine() {
+ DCHECK(selected_line_ >= 0 &&
+ selected_line_ < static_cast<int>(autofill_values_.size()));
Ilya Sherman 2012/03/21 23:35:30 nit: Please write this as a DCHECK_GE and DCHECK_L
csharp 2012/03/23 15:10:52 Done.
+
+ external_delegate()->DidAcceptAutofillSuggestions(
+ autofill_values_[selected_line_],
+ autofill_unique_ids_[selected_line_],
+ selected_line_);
+}
+
+void AutofillPopupView::RemoveLine(int line) {
+ // TODO(csharp) add removal code.
+}
+
void AutofillPopupView::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {

Powered by Google App Engine
This is Rietveld 408576698