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|. |
| 78 SkColor GetValueFontColorForRow(size_t index) const; | 79 ui::NativeTheme::ColorId GetValueFontColorIDForRow(size_t index) const; |
| 80 | |
| 81 // TODO(jiahuiguo) Add a function to return label fonr color ID for cocoa impl | |
|
Jared Saul
2017/01/04 19:51:38
s/fonr/font
jiahuiguo
2017/01/05 19:21:20
Done.
| |
| 82 // ui::NativeTheme::ColorId GetLabelFontColorIDForRow(size_t index) const; | |
| 79 | 83 |
| 80 // Returns the icon image of the item at |index| in the popup. | 84 // Returns the icon image of the item at |index| in the popup. |
| 81 gfx::ImageSkia GetIconImage(size_t index) const; | 85 gfx::ImageSkia GetIconImage(size_t index) const; |
| 82 #endif | 86 #endif |
| 83 | 87 |
| 84 // Convert a y-coordinate to the closest line. | 88 // Convert a y-coordinate to the closest line. |
| 85 int LineFromY(int y) const; | 89 int LineFromY(int y) const; |
| 86 | 90 |
| 87 const gfx::Rect popup_bounds() const { return popup_bounds_; } | 91 const gfx::Rect popup_bounds() const { return popup_bounds_; } |
| 88 | 92 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 AutofillPopupViewDelegate* delegate_; // Weak reference. | 141 AutofillPopupViewDelegate* delegate_; // Weak reference. |
| 138 | 142 |
| 139 const bool is_credit_card_popup_; | 143 const bool is_credit_card_popup_; |
| 140 | 144 |
| 141 DISALLOW_COPY_AND_ASSIGN(AutofillPopupLayoutModel); | 145 DISALLOW_COPY_AND_ASSIGN(AutofillPopupLayoutModel); |
| 142 }; | 146 }; |
| 143 | 147 |
| 144 } // namespace autofill | 148 } // namespace autofill |
| 145 | 149 |
| 146 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_LAYOUT_MODEL_H_ | 150 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_LAYOUT_MODEL_H_ |
| OLD | NEW |