| 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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 bool AutofillPopupControllerImpl::RemoveSelectedLine() { | 456 bool AutofillPopupControllerImpl::RemoveSelectedLine() { |
| 457 if (selected_line_ == kNoSelection) | 457 if (selected_line_ == kNoSelection) |
| 458 return false; | 458 return false; |
| 459 | 459 |
| 460 DCHECK_GE(selected_line_, 0); | 460 DCHECK_GE(selected_line_, 0); |
| 461 DCHECK_LT(selected_line_, static_cast<int>(GetLineCount())); | 461 DCHECK_LT(selected_line_, static_cast<int>(GetLineCount())); |
| 462 return RemoveSuggestion(selected_line_); | 462 return RemoveSuggestion(selected_line_); |
| 463 } | 463 } |
| 464 | 464 |
| 465 bool AutofillPopupControllerImpl::CanAccept(int id) { | 465 bool AutofillPopupControllerImpl::CanAccept(int id) { |
| 466 // TODO(lshang): Make POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE clickable | |
| 467 // and redirect to chrome security connection help center page. | |
| 468 return id != POPUP_ITEM_ID_SEPARATOR && | 466 return id != POPUP_ITEM_ID_SEPARATOR && |
| 469 id != POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE && | 467 id != POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE && |
| 470 id != POPUP_ITEM_ID_TITLE && | 468 id != POPUP_ITEM_ID_TITLE; |
| 471 id != POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE; | |
| 472 } | 469 } |
| 473 | 470 |
| 474 bool AutofillPopupControllerImpl::HasSuggestions() { | 471 bool AutofillPopupControllerImpl::HasSuggestions() { |
| 475 if (suggestions_.empty()) | 472 if (suggestions_.empty()) |
| 476 return false; | 473 return false; |
| 477 int id = suggestions_[0].frontend_id; | 474 int id = suggestions_[0].frontend_id; |
| 478 return id > 0 || | 475 return id > 0 || |
| 479 id == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY || | 476 id == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY || |
| 480 id == POPUP_ITEM_ID_PASSWORD_ENTRY || | 477 id == POPUP_ITEM_ID_PASSWORD_ENTRY || |
| 481 id == POPUP_ITEM_ID_DATALIST_ENTRY || | 478 id == POPUP_ITEM_ID_DATALIST_ENTRY || |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 // Don't clear view_, because otherwise the popup will have to get regenerated | 536 // Don't clear view_, because otherwise the popup will have to get regenerated |
| 540 // and this will cause flickering. | 537 // and this will cause flickering. |
| 541 suggestions_.clear(); | 538 suggestions_.clear(); |
| 542 elided_values_.clear(); | 539 elided_values_.clear(); |
| 543 elided_labels_.clear(); | 540 elided_labels_.clear(); |
| 544 | 541 |
| 545 selected_line_ = kNoSelection; | 542 selected_line_ = kNoSelection; |
| 546 } | 543 } |
| 547 | 544 |
| 548 } // namespace autofill | 545 } // namespace autofill |
| OLD | NEW |