| 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 "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/ui/autofill/autofill_popup_delegate.h" | 9 #include "chrome/browser/ui/autofill/autofill_popup_delegate.h" |
| 10 #include "chrome/browser/ui/autofill/autofill_popup_view.h" | 10 #include "chrome/browser/ui/autofill/autofill_popup_view.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 const string16& resource_name) { | 184 const string16& resource_name) { |
| 185 for (size_t i = 0; i < arraysize(kDataResources); ++i) { | 185 for (size_t i = 0; i < arraysize(kDataResources); ++i) { |
| 186 if (resource_name == ASCIIToUTF16(kDataResources[i].name)) | 186 if (resource_name == ASCIIToUTF16(kDataResources[i].name)) |
| 187 return kDataResources[i].id; | 187 return kDataResources[i].id; |
| 188 } | 188 } |
| 189 | 189 |
| 190 return -1; | 190 return -1; |
| 191 } | 191 } |
| 192 | 192 |
| 193 bool AutofillPopupControllerImpl::CanDelete(size_t index) { | 193 bool AutofillPopupControllerImpl::CanDelete(size_t index) { |
| 194 // TODO(isherman): AddressBook suggestions on Mac should not be drawn as |
| 195 // deleteable. |
| 194 int id = identifiers_[index]; | 196 int id = identifiers_[index]; |
| 195 return id > 0 || | 197 return id > 0 || |
| 196 id == WebAutofillClient::MenuItemIDAutocompleteEntry || | 198 id == WebAutofillClient::MenuItemIDAutocompleteEntry || |
| 197 id == WebAutofillClient::MenuItemIDPasswordEntry; | 199 id == WebAutofillClient::MenuItemIDPasswordEntry; |
| 198 } | 200 } |
| 199 | 201 |
| 200 #if !defined(OS_ANDROID) | 202 #if !defined(OS_ANDROID) |
| 201 int AutofillPopupControllerImpl::GetPopupRequiredWidth() { | 203 int AutofillPopupControllerImpl::GetPopupRequiredWidth() { |
| 202 if (name_font_.platform_font() == NULL || | 204 if (name_font_.platform_font() == NULL || |
| 203 subtext_font_.platform_font() == NULL) { | 205 subtext_font_.platform_font() == NULL) { |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 // Remove the deleted element. | 427 // Remove the deleted element. |
| 426 names_.erase(names_.begin() + selected_line_); | 428 names_.erase(names_.begin() + selected_line_); |
| 427 subtexts_.erase(subtexts_.begin() + selected_line_); | 429 subtexts_.erase(subtexts_.begin() + selected_line_); |
| 428 icons_.erase(icons_.begin() + selected_line_); | 430 icons_.erase(icons_.begin() + selected_line_); |
| 429 identifiers_.erase(identifiers_.begin() + selected_line_); | 431 identifiers_.erase(identifiers_.begin() + selected_line_); |
| 430 | 432 |
| 431 SetSelectedLine(kNoSelection); | 433 SetSelectedLine(kNoSelection); |
| 432 | 434 |
| 433 if (HasSuggestions()) { | 435 if (HasSuggestions()) { |
| 434 delegate_->ClearPreviewedForm(); | 436 delegate_->ClearPreviewedForm(); |
| 437 // TODO(isherman): This doesn't update the origin as it should on Mac, due |
| 438 // to the flipped coordinate system. |
| 435 UpdateBoundsAndRedrawPopup(); | 439 UpdateBoundsAndRedrawPopup(); |
| 436 } else { | 440 } else { |
| 437 HideInternal(); | 441 HideInternal(); |
| 438 } | 442 } |
| 439 | 443 |
| 440 return true; | 444 return true; |
| 441 } | 445 } |
| 442 | 446 |
| 443 int AutofillPopupControllerImpl::LineFromY(int y) { | 447 int AutofillPopupControllerImpl::LineFromY(int y) { |
| 444 int current_height = 0; | 448 int current_height = 0; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 identifiers_[0] == WebAutofillClient::MenuItemIDDataListEntry); | 501 identifiers_[0] == WebAutofillClient::MenuItemIDDataListEntry); |
| 498 } | 502 } |
| 499 | 503 |
| 500 void AutofillPopupControllerImpl::ShowView() { | 504 void AutofillPopupControllerImpl::ShowView() { |
| 501 view_->Show(); | 505 view_->Show(); |
| 502 } | 506 } |
| 503 | 507 |
| 504 void AutofillPopupControllerImpl::InvalidateRow(size_t row) { | 508 void AutofillPopupControllerImpl::InvalidateRow(size_t row) { |
| 505 view_->InvalidateRow(row); | 509 view_->InvalidateRow(row); |
| 506 } | 510 } |
| OLD | NEW |