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

Side by Side Diff: chrome/browser/autofill/autofill_popup_view.cc

Issue 11189093: Skip Unacceptable Items in new Autofill UI when Navigating with Keys. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/autofill/autofill_popup_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/autofill/autofill_popup_view.h" 5 #include "chrome/browser/autofill/autofill_popup_view.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/autofill/autofill_external_delegate.h" 9 #include "chrome/browser/autofill/autofill_external_delegate.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 129 }
130 } 130 }
131 131
132 void AutofillPopupView::ClearSelectedLine() { 132 void AutofillPopupView::ClearSelectedLine() {
133 SetSelectedLine(kNoSelection); 133 SetSelectedLine(kNoSelection);
134 } 134 }
135 135
136 void AutofillPopupView::SelectNextLine() { 136 void AutofillPopupView::SelectNextLine() {
137 int new_selected_line = selected_line_ + 1; 137 int new_selected_line = selected_line_ + 1;
138 138
139 // Skip over any lines that can't be selected.
140 while (static_cast<size_t>(new_selected_line) < autofill_values_.size() &&
141 !CanAccept(autofill_unique_ids()[new_selected_line])) {
142 ++new_selected_line;
143 }
144
139 if (new_selected_line == static_cast<int>(autofill_values_.size())) 145 if (new_selected_line == static_cast<int>(autofill_values_.size()))
140 new_selected_line = 0; 146 new_selected_line = 0;
141 147
142 SetSelectedLine(new_selected_line); 148 SetSelectedLine(new_selected_line);
143 } 149 }
144 150
145 void AutofillPopupView::SelectPreviousLine() { 151 void AutofillPopupView::SelectPreviousLine() {
146 int new_selected_line = selected_line_ - 1; 152 int new_selected_line = selected_line_ - 1;
147 153
154 // Skip over any lines that can't be selected.
155 while (new_selected_line > kNoSelection &&
156 !CanAccept(autofill_unique_ids()[new_selected_line])) {
157 --new_selected_line;
158 }
159
148 if (new_selected_line <= kNoSelection) 160 if (new_selected_line <= kNoSelection)
149 new_selected_line = autofill_values_.size() - 1; 161 new_selected_line = autofill_values_.size() - 1;
150 162
151 SetSelectedLine(new_selected_line); 163 SetSelectedLine(new_selected_line);
152 } 164 }
153 165
154 bool AutofillPopupView::AcceptSelectedLine() { 166 bool AutofillPopupView::AcceptSelectedLine() {
155 if (selected_line_ == kNoSelection) 167 if (selected_line_ == kNoSelection)
156 return false; 168 return false;
157 169
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 void AutofillPopupView::Observe(int type, 332 void AutofillPopupView::Observe(int type,
321 const content::NotificationSource& source, 333 const content::NotificationSource& source,
322 const content::NotificationDetails& details) { 334 const content::NotificationDetails& details) {
323 if (type == content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED) { 335 if (type == content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED) {
324 if (!*content::Details<bool>(details).ptr()) 336 if (!*content::Details<bool>(details).ptr())
325 Hide(); 337 Hide();
326 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { 338 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) {
327 Hide(); 339 Hide();
328 } 340 }
329 } 341 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_popup_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698