Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(397)

Side by Side Diff: chrome/browser/ui/autofill/autofill_popup_layout_model.h

Issue 2517843002: Http Bad: Put icon on the left of http warning message on Views (Closed)
Patch Set: add comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 20 matching lines...) Expand all
31 // TODO(mathp): investigate moving ownership of this class to the view. 31 // TODO(mathp): investigate moving ownership of this class to the view.
32 class AutofillPopupLayoutModel { 32 class AutofillPopupLayoutModel {
33 public: 33 public:
34 explicit AutofillPopupLayoutModel(AutofillPopupViewDelegate* delegate); 34 explicit AutofillPopupLayoutModel(AutofillPopupViewDelegate* delegate);
35 ~AutofillPopupLayoutModel(); 35 ~AutofillPopupLayoutModel();
36 36
37 // The minimum amount of padding between the Autofill name and subtext, 37 // The minimum amount of padding between the Autofill name and subtext,
38 // in pixels. 38 // in pixels.
39 static const int kNamePadding = 15; 39 static const int kNamePadding = 15;
40 40
41 // The minimum amount of padding between the Autofill http warning message
42 // name and subtext, in pixels.
43 static const int kHttpWarningNamePadding = 8;
44
41 // The amount of padding between icons in pixels. 45 // The amount of padding between icons in pixels.
42 static const int kIconPadding = 5; 46 static const int kIconPadding = 5;
43 47
48 // The amount of padding between icons in pixels.
49 static const int kHttpWarningIconPadding = 8;
Evan Stade 2016/11/29 15:43:17 I'm confused by this for two reasons - first becau
lshang 2016/11/30 05:43:36 I advised the comments a bit to make it more clear
50
44 // The amount of padding at the end of the popup in pixels. 51 // The amount of padding at the end of the popup in pixels.
45 static const int kEndPadding = 8; 52 static const int kEndPadding = 8;
46 53
47 #if !defined(OS_ANDROID) 54 #if !defined(OS_ANDROID)
48 // Calculates the desired height of the popup based on its contents. 55 // Calculates the desired height of the popup based on its contents.
49 int GetDesiredPopupHeight() const; 56 int GetDesiredPopupHeight() const;
50 57
51 // Calculates the desired width of the popup based on its contents. 58 // Calculates the desired width of the popup based on its contents.
52 int GetDesiredPopupWidth() const; 59 int GetDesiredPopupWidth() const;
53 60
54 // Calculate the width of the row, excluding all the text. This provides 61 // Calculate the width of the row, excluding all the text. This provides
55 // the size of the row that won't be reducible (since all the text can be 62 // the size of the row that won't be reducible (since all the text can be
56 // elided if there isn't enough space). |with_label| indicates whether a label 63 // elided if there isn't enough space). |with_label| indicates whether a label
57 // is expected to be present. 64 // is expected to be present.
58 int RowWidthWithoutText(int row, bool with_label) const; 65 int RowWidthWithoutText(int row, bool with_label) const;
59 66
60 // Get the available space for the total text width. |with_label| indicates 67 // Get the available space for the total text width. |with_label| indicates
61 // whether a label is expected to be present. 68 // whether a label is expected to be present.
62 int GetAvailableWidthForRow(int row, bool with_label) const; 69 int GetAvailableWidthForRow(int row, bool with_label) const;
63 70
64 // Calculates and sets the bounds of the popup, including placing it properly 71 // Calculates and sets the bounds of the popup, including placing it properly
65 // to prevent it from going off the screen. 72 // to prevent it from going off the screen.
66 void UpdatePopupBounds(); 73 void UpdatePopupBounds();
67 74
68 // The same font can vary based on the type of data it is showing at the row 75 // The same font can vary based on the type of data it is showing at the row
69 // |index|. 76 // |index|.
70 const gfx::FontList& GetValueFontListForRow(size_t index) const; 77 const gfx::FontList& GetValueFontListForRow(size_t index) const;
71 const gfx::FontList& GetLabelFontList() const; 78 const gfx::FontList& GetLabelFontListForRow(size_t index) const;
72 79
73 // Returns the value font color of the row item according to its |index|. 80 // Returns the value font color of the row item according to its |index|.
74 SkColor GetValueFontColorForRow(size_t index) const; 81 SkColor GetValueFontColorForRow(size_t index) const;
75 82
76 // Returns the icon image of the item at |index| in the popup. 83 // Returns the icon image of the item at |index| in the popup.
77 gfx::ImageSkia GetIconImage(size_t index) const; 84 gfx::ImageSkia GetIconImage(size_t index) const;
78 #endif 85 #endif
79 86
80 // Convert a y-coordinate to the closest line. 87 // Convert a y-coordinate to the closest line.
81 int LineFromY(int y) const; 88 int LineFromY(int y) const;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 PopupViewCommon view_common_; 120 PopupViewCommon view_common_;
114 121
115 AutofillPopupViewDelegate* delegate_; // Weak reference. 122 AutofillPopupViewDelegate* delegate_; // Weak reference.
116 123
117 DISALLOW_COPY_AND_ASSIGN(AutofillPopupLayoutModel); 124 DISALLOW_COPY_AND_ASSIGN(AutofillPopupLayoutModel);
118 }; 125 };
119 126
120 } // namespace autofill 127 } // namespace autofill
121 128
122 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_LAYOUT_MODEL_H_ 129 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_LAYOUT_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698