| 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 | 17 |
| 18 namespace gfx { |
| 19 class ImageSkia; |
| 20 } |
| 21 |
| 18 namespace autofill { | 22 namespace autofill { |
| 19 | 23 |
| 20 // Helper class which keeps tracks of popup bounds and related view information. | 24 // Helper class which keeps tracks of popup bounds and related view information. |
| 21 // TODO(mathp): investigate moving ownership of this class to the view. | 25 // TODO(mathp): investigate moving ownership of this class to the view. |
| 22 class AutofillPopupLayoutModel { | 26 class AutofillPopupLayoutModel { |
| 23 public: | 27 public: |
| 24 explicit AutofillPopupLayoutModel(AutofillPopupViewDelegate* delegate); | 28 explicit AutofillPopupLayoutModel(AutofillPopupViewDelegate* delegate); |
| 25 ~AutofillPopupLayoutModel(); | 29 ~AutofillPopupLayoutModel(); |
| 26 | 30 |
| 27 // The minimum amount of padding between the Autofill name and subtext, | 31 // The minimum amount of padding between the Autofill name and subtext, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 55 // to prevent it from going off the screen. | 59 // to prevent it from going off the screen. |
| 56 void UpdatePopupBounds(); | 60 void UpdatePopupBounds(); |
| 57 | 61 |
| 58 // The same font can vary based on the type of data it is showing at the row | 62 // The same font can vary based on the type of data it is showing at the row |
| 59 // |index|. | 63 // |index|. |
| 60 const gfx::FontList& GetValueFontListForRow(size_t index) const; | 64 const gfx::FontList& GetValueFontListForRow(size_t index) const; |
| 61 const gfx::FontList& GetLabelFontList() const; | 65 const gfx::FontList& GetLabelFontList() const; |
| 62 | 66 |
| 63 // Returns the value font color of the row item according to its |index|. | 67 // Returns the value font color of the row item according to its |index|. |
| 64 SkColor GetValueFontColorForRow(size_t index) const; | 68 SkColor GetValueFontColorForRow(size_t index) const; |
| 69 |
| 70 // Returns the icon image of the item at |index| in the popup. |
| 71 gfx::ImageSkia GetIconImage(size_t index) const; |
| 65 #endif | 72 #endif |
| 66 | 73 |
| 67 // Convert a y-coordinate to the closest line. | 74 // Convert a y-coordinate to the closest line. |
| 68 int LineFromY(int y) const; | 75 int LineFromY(int y) const; |
| 69 | 76 |
| 70 const gfx::Rect popup_bounds() const { return popup_bounds_; } | 77 const gfx::Rect popup_bounds() const { return popup_bounds_; } |
| 71 | 78 |
| 72 // Returns the bounds of the item at |index| in the popup, relative to | 79 // Returns the bounds of the item at |index| in the popup, relative to |
| 73 // the top left of the popup. | 80 // the top left of the popup. |
| 74 gfx::Rect GetRowBounds(size_t index) const; | 81 gfx::Rect GetRowBounds(size_t index) const; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 100 PopupViewCommon view_common_; | 107 PopupViewCommon view_common_; |
| 101 | 108 |
| 102 AutofillPopupViewDelegate* delegate_; // Weak reference. | 109 AutofillPopupViewDelegate* delegate_; // Weak reference. |
| 103 | 110 |
| 104 DISALLOW_COPY_AND_ASSIGN(AutofillPopupLayoutModel); | 111 DISALLOW_COPY_AND_ASSIGN(AutofillPopupLayoutModel); |
| 105 }; | 112 }; |
| 106 | 113 |
| 107 } // namespace autofill | 114 } // namespace autofill |
| 108 | 115 |
| 109 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_LAYOUT_MODEL_H_ | 116 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_LAYOUT_MODEL_H_ |
| OLD | NEW |