| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 { | 290 bool AutofillPopupControllerImpl::IsWarning(size_t index) const { |
| 291 return suggestions_[index].frontend_id == | 291 return suggestions_[index].frontend_id == |
| 292 POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE || | 292 POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE || |
| 293 suggestions_[index].frontend_id == | 293 suggestions_[index].frontend_id == |
| 294 POPUP_ITEM_ID_PAYMENT_DISABLED_MESSAGE || |
| 295 suggestions_[index].frontend_id == |
| 294 POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE; | 296 POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE; |
| 295 } | 297 } |
| 296 | 298 |
| 297 gfx::Rect AutofillPopupControllerImpl::popup_bounds() const { | 299 gfx::Rect AutofillPopupControllerImpl::popup_bounds() const { |
| 298 return layout_model_.popup_bounds(); | 300 return layout_model_.popup_bounds(); |
| 299 } | 301 } |
| 300 | 302 |
| 301 content::WebContents* AutofillPopupControllerImpl::web_contents() { | 303 content::WebContents* AutofillPopupControllerImpl::web_contents() { |
| 302 return controller_common_->web_contents(); | 304 return controller_common_->web_contents(); |
| 303 } | 305 } |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 if (selected_line_ == kNoSelection) | 459 if (selected_line_ == kNoSelection) |
| 458 return false; | 460 return false; |
| 459 | 461 |
| 460 DCHECK_GE(selected_line_, 0); | 462 DCHECK_GE(selected_line_, 0); |
| 461 DCHECK_LT(selected_line_, static_cast<int>(GetLineCount())); | 463 DCHECK_LT(selected_line_, static_cast<int>(GetLineCount())); |
| 462 return RemoveSuggestion(selected_line_); | 464 return RemoveSuggestion(selected_line_); |
| 463 } | 465 } |
| 464 | 466 |
| 465 bool AutofillPopupControllerImpl::CanAccept(int id) { | 467 bool AutofillPopupControllerImpl::CanAccept(int id) { |
| 466 return id != POPUP_ITEM_ID_SEPARATOR && | 468 return id != POPUP_ITEM_ID_SEPARATOR && |
| 469 id != POPUP_ITEM_ID_PAYMENT_DISABLED_MESSAGE && |
| 467 id != POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE && | 470 id != POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE && |
| 468 id != POPUP_ITEM_ID_TITLE; | 471 id != POPUP_ITEM_ID_TITLE; |
| 469 } | 472 } |
| 470 | 473 |
| 471 bool AutofillPopupControllerImpl::HasSuggestions() { | 474 bool AutofillPopupControllerImpl::HasSuggestions() { |
| 472 if (suggestions_.empty()) | 475 if (suggestions_.empty()) |
| 473 return false; | 476 return false; |
| 474 int id = suggestions_[0].frontend_id; | 477 int id = suggestions_[0].frontend_id; |
| 475 return id > 0 || | 478 return id > 0 || |
| 476 id == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY || | 479 id == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY || |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 // Don't clear view_, because otherwise the popup will have to get regenerated | 539 // Don't clear view_, because otherwise the popup will have to get regenerated |
| 537 // and this will cause flickering. | 540 // and this will cause flickering. |
| 538 suggestions_.clear(); | 541 suggestions_.clear(); |
| 539 elided_values_.clear(); | 542 elided_values_.clear(); |
| 540 elided_labels_.clear(); | 543 elided_labels_.clear(); |
| 541 | 544 |
| 542 selected_line_ = kNoSelection; | 545 selected_line_ = kNoSelection; |
| 543 } | 546 } |
| 544 | 547 |
| 545 } // namespace autofill | 548 } // namespace autofill |
| OLD | NEW |