| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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_layout_model.h" | 5 #include "chrome/browser/ui/autofill/autofill_popup_layout_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 int AutofillPopupLayoutModel::GetIconResourceID( | 265 int AutofillPopupLayoutModel::GetIconResourceID( |
| 266 const base::string16& resource_name) const { | 266 const base::string16& resource_name) const { |
| 267 int result = -1; | 267 int result = -1; |
| 268 for (size_t i = 0; i < arraysize(kDataResources); ++i) { | 268 for (size_t i = 0; i < arraysize(kDataResources); ++i) { |
| 269 if (resource_name == base::ASCIIToUTF16(kDataResources[i].name)) { | 269 if (resource_name == base::ASCIIToUTF16(kDataResources[i].name)) { |
| 270 result = kDataResources[i].id; | 270 result = kDataResources[i].id; |
| 271 break; | 271 break; |
| 272 } | 272 } |
| 273 } | 273 } |
| 274 | 274 |
| 275 #if defined(OS_ANDROID) && !defined(USE_AURA) | |
| 276 if (result == IDR_AUTOFILL_CC_SCAN_NEW && IsKeyboardAccessoryEnabled()) | |
| 277 result = IDR_AUTOFILL_CC_SCAN_NEW_KEYBOARD_ACCESSORY; | |
| 278 #endif | |
| 279 | |
| 280 return result; | 275 return result; |
| 281 } | 276 } |
| 282 | 277 |
| 283 const gfx::Rect AutofillPopupLayoutModel::RoundedElementBounds() const { | 278 const gfx::Rect AutofillPopupLayoutModel::RoundedElementBounds() const { |
| 284 return gfx::ToEnclosingRect(delegate_->element_bounds()); | 279 return gfx::ToEnclosingRect(delegate_->element_bounds()); |
| 285 } | 280 } |
| 286 | 281 |
| 287 bool AutofillPopupLayoutModel::IsPopupLayoutExperimentEnabled() const { | 282 bool AutofillPopupLayoutModel::IsPopupLayoutExperimentEnabled() const { |
| 288 return is_credit_card_popup_ && | 283 return is_credit_card_popup_ && |
| 289 IsAutofillCreditCardPopupLayoutExperimentEnabled(); | 284 IsAutofillCreditCardPopupLayoutExperimentEnabled(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 302 unsigned int AutofillPopupLayoutModel::GetDropdownItemHeight() const { | 297 unsigned int AutofillPopupLayoutModel::GetDropdownItemHeight() const { |
| 303 return GetPopupDropdownItemHeight(); | 298 return GetPopupDropdownItemHeight(); |
| 304 } | 299 } |
| 305 | 300 |
| 306 bool AutofillPopupLayoutModel::IsIconAtStart(int frontend_id) const { | 301 bool AutofillPopupLayoutModel::IsIconAtStart(int frontend_id) const { |
| 307 return frontend_id == POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE || | 302 return frontend_id == POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE || |
| 308 (is_credit_card_popup_ && IsIconInCreditCardPopupAtStart()); | 303 (is_credit_card_popup_ && IsIconInCreditCardPopupAtStart()); |
| 309 } | 304 } |
| 310 | 305 |
| 311 } // namespace autofill | 306 } // namespace autofill |
| OLD | NEW |