| OLD | NEW |
| 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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 bool AutofillPopupControllerImpl::CanAccept(int id) { | 457 bool AutofillPopupControllerImpl::CanAccept(int id) { |
| 458 return id != POPUP_ITEM_ID_SEPARATOR && | 458 return id != POPUP_ITEM_ID_SEPARATOR && |
| 459 id != POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE && | 459 id != POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE && |
| 460 id != POPUP_ITEM_ID_TITLE; | 460 id != POPUP_ITEM_ID_TITLE; |
| 461 } | 461 } |
| 462 | 462 |
| 463 bool AutofillPopupControllerImpl::HasSuggestions() { | 463 bool AutofillPopupControllerImpl::HasSuggestions() { |
| 464 if (suggestions_.empty()) | 464 if (suggestions_.empty()) |
| 465 return false; | 465 return false; |
| 466 int id = suggestions_[0].frontend_id; | 466 int id = suggestions_[0].frontend_id; |
| 467 return id > 0 || | 467 return id > 0 || id == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY || |
| 468 id == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY || | |
| 469 id == POPUP_ITEM_ID_PASSWORD_ENTRY || | 468 id == POPUP_ITEM_ID_PASSWORD_ENTRY || |
| 469 id == POPUP_ITEM_ID_USERNAME_ENTRY || |
| 470 id == POPUP_ITEM_ID_DATALIST_ENTRY || | 470 id == POPUP_ITEM_ID_DATALIST_ENTRY || |
| 471 id == POPUP_ITEM_ID_SCAN_CREDIT_CARD; | 471 id == POPUP_ITEM_ID_SCAN_CREDIT_CARD; |
| 472 } | 472 } |
| 473 | 473 |
| 474 void AutofillPopupControllerImpl::SetValues( | 474 void AutofillPopupControllerImpl::SetValues( |
| 475 const std::vector<autofill::Suggestion>& suggestions) { | 475 const std::vector<autofill::Suggestion>& suggestions) { |
| 476 suggestions_ = suggestions; | 476 suggestions_ = suggestions; |
| 477 elided_values_.resize(suggestions.size()); | 477 elided_values_.resize(suggestions.size()); |
| 478 elided_labels_.resize(suggestions.size()); | 478 elided_labels_.resize(suggestions.size()); |
| 479 for (size_t i = 0; i < suggestions.size(); i++) { | 479 for (size_t i = 0; i < suggestions.size(); i++) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 // Don't clear view_, because otherwise the popup will have to get regenerated | 528 // Don't clear view_, because otherwise the popup will have to get regenerated |
| 529 // and this will cause flickering. | 529 // and this will cause flickering. |
| 530 suggestions_.clear(); | 530 suggestions_.clear(); |
| 531 elided_values_.clear(); | 531 elided_values_.clear(); |
| 532 elided_labels_.clear(); | 532 elided_labels_.clear(); |
| 533 | 533 |
| 534 selected_line_ = kNoSelection; | 534 selected_line_ = kNoSelection; |
| 535 } | 535 } |
| 536 | 536 |
| 537 } // namespace autofill | 537 } // namespace autofill |
| OLD | NEW |