| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 if (resource_name == base::ASCIIToUTF16(kDataResources[i].name)) { | 266 if (resource_name == base::ASCIIToUTF16(kDataResources[i].name)) { |
| 267 result = kDataResources[i].id; | 267 result = kDataResources[i].id; |
| 268 break; | 268 break; |
| 269 } | 269 } |
| 270 } | 270 } |
| 271 | 271 |
| 272 return result; | 272 return result; |
| 273 } | 273 } |
| 274 | 274 |
| 275 const gfx::Rect AutofillPopupLayoutModel::RoundedElementBounds() const { | 275 const gfx::Rect AutofillPopupLayoutModel::RoundedElementBounds() const { |
| 276 return gfx::ToEnclosingRect(delegate_->element_bounds()); | 276 return gfx::ToNearestRect(delegate_->element_bounds()); |
| 277 } | 277 } |
| 278 | 278 |
| 279 bool AutofillPopupLayoutModel::IsPopupLayoutExperimentEnabled() const { | 279 bool AutofillPopupLayoutModel::IsPopupLayoutExperimentEnabled() const { |
| 280 return is_credit_card_popup_ && | 280 return is_credit_card_popup_ && |
| 281 IsAutofillCreditCardPopupLayoutExperimentEnabled(); | 281 IsAutofillCreditCardPopupLayoutExperimentEnabled(); |
| 282 } | 282 } |
| 283 | 283 |
| 284 SkColor AutofillPopupLayoutModel::GetBackgroundColor() const { | 284 SkColor AutofillPopupLayoutModel::GetBackgroundColor() const { |
| 285 return is_credit_card_popup_ ? | 285 return is_credit_card_popup_ ? |
| 286 GetCreditCardPopupBackgroundColor() : SK_ColorTRANSPARENT; | 286 GetCreditCardPopupBackgroundColor() : SK_ColorTRANSPARENT; |
| 287 } | 287 } |
| 288 | 288 |
| 289 SkColor AutofillPopupLayoutModel::GetDividerColor() const { | 289 SkColor AutofillPopupLayoutModel::GetDividerColor() const { |
| 290 return is_credit_card_popup_ ? | 290 return is_credit_card_popup_ ? |
| 291 GetCreditCardPopupDividerColor() : SK_ColorTRANSPARENT; | 291 GetCreditCardPopupDividerColor() : SK_ColorTRANSPARENT; |
| 292 } | 292 } |
| 293 | 293 |
| 294 unsigned int AutofillPopupLayoutModel::GetDropdownItemHeight() const { | 294 unsigned int AutofillPopupLayoutModel::GetDropdownItemHeight() const { |
| 295 return GetPopupDropdownItemHeight(); | 295 return GetPopupDropdownItemHeight(); |
| 296 } | 296 } |
| 297 | 297 |
| 298 bool AutofillPopupLayoutModel::IsIconAtStart(int frontend_id) const { | 298 bool AutofillPopupLayoutModel::IsIconAtStart(int frontend_id) const { |
| 299 return frontend_id == POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE || | 299 return frontend_id == POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE || |
| 300 (is_credit_card_popup_ && IsIconInCreditCardPopupAtStart()); | 300 (is_credit_card_popup_ && IsIconInCreditCardPopupAtStart()); |
| 301 } | 301 } |
| 302 | 302 |
| 303 } // namespace autofill | 303 } // namespace autofill |
| OLD | NEW |