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

Side by Side Diff: chrome/browser/ui/autofill/autofill_popup_controller_impl.cc

Issue 2496683003: Http Bad: Add a PopupItemId to identify http warning message (Closed)
Patch Set: address review comments Created 4 years, 1 month 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
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/ui/autofill/autofill_popup_controller_impl.h" 5 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 void AutofillPopupControllerImpl::SelectionCleared() { 280 void AutofillPopupControllerImpl::SelectionCleared() {
281 SetSelectedLine(kNoSelection); 281 SetSelectedLine(kNoSelection);
282 } 282 }
283 283
284 void AutofillPopupControllerImpl::AcceptSuggestion(size_t index) { 284 void AutofillPopupControllerImpl::AcceptSuggestion(size_t index) {
285 const autofill::Suggestion& suggestion = suggestions_[index]; 285 const autofill::Suggestion& suggestion = suggestions_[index];
286 delegate_->DidAcceptSuggestion(suggestion.value, suggestion.frontend_id, 286 delegate_->DidAcceptSuggestion(suggestion.value, suggestion.frontend_id,
287 index); 287 index);
288 } 288 }
289 289
290 bool AutofillPopupControllerImpl::IsWarning(size_t index) const {
291 return suggestions_[index].frontend_id == POPUP_ITEM_ID_WARNING_MESSAGE;
292 }
293
294 gfx::Rect AutofillPopupControllerImpl::popup_bounds() const { 290 gfx::Rect AutofillPopupControllerImpl::popup_bounds() const {
295 return layout_model_.popup_bounds(); 291 return layout_model_.popup_bounds();
296 } 292 }
297 293
298 content::WebContents* AutofillPopupControllerImpl::web_contents() { 294 content::WebContents* AutofillPopupControllerImpl::web_contents() {
299 return controller_common_->web_contents(); 295 return controller_common_->web_contents();
300 } 296 }
301 297
302 gfx::NativeView AutofillPopupControllerImpl::container_view() { 298 gfx::NativeView AutofillPopupControllerImpl::container_view() {
303 return controller_common_->container_view(); 299 return controller_common_->container_view();
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 bool AutofillPopupControllerImpl::RemoveSelectedLine() { 449 bool AutofillPopupControllerImpl::RemoveSelectedLine() {
454 if (selected_line_ == kNoSelection) 450 if (selected_line_ == kNoSelection)
455 return false; 451 return false;
456 452
457 DCHECK_GE(selected_line_, 0); 453 DCHECK_GE(selected_line_, 0);
458 DCHECK_LT(selected_line_, static_cast<int>(GetLineCount())); 454 DCHECK_LT(selected_line_, static_cast<int>(GetLineCount()));
459 return RemoveSuggestion(selected_line_); 455 return RemoveSuggestion(selected_line_);
460 } 456 }
461 457
462 bool AutofillPopupControllerImpl::CanAccept(int id) { 458 bool AutofillPopupControllerImpl::CanAccept(int id) {
463 return id != POPUP_ITEM_ID_SEPARATOR && id != POPUP_ITEM_ID_WARNING_MESSAGE && 459 // TODO(lshang): Make POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE clickable
464 id != POPUP_ITEM_ID_TITLE; 460 // and redirect to chrome security connection help center page.
461 return id != POPUP_ITEM_ID_SEPARATOR &&
462 id != POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE &&
463 id != POPUP_ITEM_ID_TITLE &&
464 id != POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE;
465 } 465 }
466 466
467 bool AutofillPopupControllerImpl::HasSuggestions() { 467 bool AutofillPopupControllerImpl::HasSuggestions() {
468 if (suggestions_.empty()) 468 if (suggestions_.empty())
469 return false; 469 return false;
470 int id = suggestions_[0].frontend_id; 470 int id = suggestions_[0].frontend_id;
471 return id > 0 || 471 return id > 0 ||
472 id == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY || 472 id == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY ||
473 id == POPUP_ITEM_ID_PASSWORD_ENTRY || 473 id == POPUP_ITEM_ID_PASSWORD_ENTRY ||
474 id == POPUP_ITEM_ID_DATALIST_ENTRY || 474 id == POPUP_ITEM_ID_DATALIST_ENTRY ||
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 // Don't clear view_, because otherwise the popup will have to get regenerated 532 // Don't clear view_, because otherwise the popup will have to get regenerated
533 // and this will cause flickering. 533 // and this will cause flickering.
534 suggestions_.clear(); 534 suggestions_.clear();
535 elided_values_.clear(); 535 elided_values_.clear();
536 elided_labels_.clear(); 536 elided_labels_.clear();
537 537
538 selected_line_ = kNoSelection; 538 selected_line_ = kNoSelection;
539 } 539 }
540 540
541 } // namespace autofill 541 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698