Chromium Code Reviews| 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 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_LAYOUT_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_LAYOUT_MODEL_H_ |
| 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_LAYOUT_MODEL_H_ | 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_LAYOUT_MODEL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h" | 11 #include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h" |
| 12 #include "chrome/browser/ui/autofill/popup_view_common.h" | 12 #include "chrome/browser/ui/autofill/popup_view_common.h" |
| 13 #include "third_party/skia/include/core/SkColor.h" | 13 #include "third_party/skia/include/core/SkColor.h" |
| 14 #include "ui/gfx/font_list.h" | 14 #include "ui/gfx/font_list.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
| 16 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
| 17 #include "ui/native_theme/native_theme.h" | |
| 17 | 18 |
| 18 namespace gfx { | 19 namespace gfx { |
| 19 class ImageSkia; | 20 class ImageSkia; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace autofill { | 23 namespace autofill { |
| 23 | 24 |
| 24 // Helper class which keeps tracks of popup bounds and related view information. | 25 // Helper class which keeps tracks of popup bounds and related view information. |
| 25 // TODO(mathp): investigate moving ownership of this class to the view. | 26 // TODO(mathp): investigate moving ownership of this class to the view. |
| 26 class AutofillPopupLayoutModel { | 27 class AutofillPopupLayoutModel { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 | 68 |
| 68 // Calculates and sets the bounds of the popup, including placing it properly | 69 // Calculates and sets the bounds of the popup, including placing it properly |
| 69 // to prevent it from going off the screen. | 70 // to prevent it from going off the screen. |
| 70 void UpdatePopupBounds(); | 71 void UpdatePopupBounds(); |
| 71 | 72 |
| 72 // The same font can vary based on the type of data it is showing at the row | 73 // The same font can vary based on the type of data it is showing at the row |
| 73 // |index|. | 74 // |index|. |
| 74 const gfx::FontList& GetValueFontListForRow(size_t index) const; | 75 const gfx::FontList& GetValueFontListForRow(size_t index) const; |
| 75 const gfx::FontList& GetLabelFontListForRow(size_t index) const; | 76 const gfx::FontList& GetLabelFontListForRow(size_t index) const; |
| 76 | 77 |
| 77 // Returns the value font color of the row item according to its |index|. | 78 // Returns the value font color_id of the row item according to its |index|. |
|
Evan Stade
2016/12/20 18:01:19
nit: s/color_id/color ID
jiahuiguo
2017/01/03 19:37:52
Done.
| |
| 78 SkColor GetValueFontColorForRow(size_t index) const; | 79 ui::NativeTheme::ColorId GetValueFontColorForRow(size_t index) const; |
| 79 | 80 |
| 80 // Returns the icon image of the item at |index| in the popup. | 81 // Returns the icon image of the item at |index| in the popup. |
| 81 gfx::ImageSkia GetIconImage(size_t index) const; | 82 gfx::ImageSkia GetIconImage(size_t index) const; |
| 82 #endif | 83 #endif |
| 83 | 84 |
| 84 // Convert a y-coordinate to the closest line. | 85 // Convert a y-coordinate to the closest line. |
| 85 int LineFromY(int y) const; | 86 int LineFromY(int y) const; |
| 86 | 87 |
| 87 const gfx::Rect popup_bounds() const { return popup_bounds_; } | 88 const gfx::Rect popup_bounds() const { return popup_bounds_; } |
| 88 | 89 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 AutofillPopupViewDelegate* delegate_; // Weak reference. | 138 AutofillPopupViewDelegate* delegate_; // Weak reference. |
| 138 | 139 |
| 139 const bool is_credit_card_popup_; | 140 const bool is_credit_card_popup_; |
| 140 | 141 |
| 141 DISALLOW_COPY_AND_ASSIGN(AutofillPopupLayoutModel); | 142 DISALLOW_COPY_AND_ASSIGN(AutofillPopupLayoutModel); |
| 142 }; | 143 }; |
| 143 | 144 |
| 144 } // namespace autofill | 145 } // namespace autofill |
| 145 | 146 |
| 146 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_LAYOUT_MODEL_H_ | 147 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_LAYOUT_MODEL_H_ |
| OLD | NEW |