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

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 test Created 4 years, 1 month 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 19 matching lines...) Expand all
30 // TODO(mathp): investigate moving ownership of this class to the view. 30 // TODO(mathp): investigate moving ownership of this class to the view.
31 class AutofillPopupLayoutModel { 31 class AutofillPopupLayoutModel {
32 public: 32 public:
33 explicit AutofillPopupLayoutModel(AutofillPopupViewDelegate* delegate); 33 explicit AutofillPopupLayoutModel(AutofillPopupViewDelegate* delegate);
34 ~AutofillPopupLayoutModel(); 34 ~AutofillPopupLayoutModel();
35 35
36 // The minimum amount of padding between the Autofill name and subtext, 36 // The minimum amount of padding between the Autofill name and subtext,
37 // in pixels. 37 // in pixels.
38 static const int kNamePadding = 15; 38 static const int kNamePadding = 15;
39 39
40 // The minimum amount of padding between the Autofill http warning message
41 // name and subtext, in pixels.
42 static const int kHttpWarningNamePadding = 8;
43
40 // The amount of padding between icons in pixels. 44 // The amount of padding between icons in pixels.
41 static const int kIconPadding = 5; 45 static const int kIconPadding = 5;
42 46
47 // The amount of padding between icons in pixels.
48 static const int kHttpWarningIconPadding = 8;
49
43 // The amount of padding at the end of the popup in pixels. 50 // The amount of padding at the end of the popup in pixels.
44 static const int kEndPadding = 8; 51 static const int kEndPadding = 8;
45 52
46 #if !defined(OS_ANDROID) 53 #if !defined(OS_ANDROID)
47 // Calculates the desired height of the popup based on its contents. 54 // Calculates the desired height of the popup based on its contents.
48 int GetDesiredPopupHeight() const; 55 int GetDesiredPopupHeight() const;
49 56
50 // Calculates the desired width of the popup based on its contents. 57 // Calculates the desired width of the popup based on its contents.
51 int GetDesiredPopupWidth() const; 58 int GetDesiredPopupWidth() const;
52 59
53 // Calculate the width of the row, excluding all the text. This provides 60 // Calculate the width of the row, excluding all the text. This provides
54 // the size of the row that won't be reducible (since all the text can be 61 // the size of the row that won't be reducible (since all the text can be
55 // elided if there isn't enough space). |with_label| indicates whether a label 62 // elided if there isn't enough space). |with_label| indicates whether a label
56 // is expected to be present. 63 // is expected to be present.
57 int RowWidthWithoutText(int row, bool with_label) const; 64 int RowWidthWithoutText(int row, bool with_label) const;
58 65
59 // Get the available space for the total text width. |with_label| indicates 66 // Get the available space for the total text width. |with_label| indicates
60 // whether a label is expected to be present. 67 // whether a label is expected to be present.
61 int GetAvailableWidthForRow(int row, bool with_label) const; 68 int GetAvailableWidthForRow(int row, bool with_label) const;
62 69
63 // Calculates and sets the bounds of the popup, including placing it properly 70 // Calculates and sets the bounds of the popup, including placing it properly
64 // to prevent it from going off the screen. 71 // to prevent it from going off the screen.
65 void UpdatePopupBounds(); 72 void UpdatePopupBounds();
66 73
67 // The same font can vary based on the type of data it is showing at the row 74 // The same font can vary based on the type of data it is showing at the row
68 // |index|. 75 // |index|.
69 const gfx::FontList& GetValueFontListForRow(size_t index) const; 76 const gfx::FontList& GetValueFontListForRow(size_t index) const;
70 const gfx::FontList& GetLabelFontList() const; 77 const gfx::FontList& GetLabelFontListForRow(size_t index) const;
71 78
72 // Returns the value font color of the row item according to its |index|. 79 // Returns the value font color of the row item according to its |index|.
73 SkColor GetValueFontColorForRow(size_t index) const; 80 SkColor GetValueFontColorForRow(size_t index) const;
74 #endif 81 #endif
75 82
76 // Convert a y-coordinate to the closest line. 83 // Convert a y-coordinate to the closest line.
77 int LineFromY(int y) const; 84 int LineFromY(int y) const;
78 85
79 const gfx::Rect popup_bounds() const { return popup_bounds_; } 86 const gfx::Rect popup_bounds() const { return popup_bounds_; }
80 87
(...skipping 28 matching lines...) Expand all
109 PopupViewCommon view_common_; 116 PopupViewCommon view_common_;
110 117
111 AutofillPopupViewDelegate* delegate_; // Weak reference. 118 AutofillPopupViewDelegate* delegate_; // Weak reference.
112 119
113 DISALLOW_COPY_AND_ASSIGN(AutofillPopupLayoutModel); 120 DISALLOW_COPY_AND_ASSIGN(AutofillPopupLayoutModel);
114 }; 121 };
115 122
116 } // namespace autofill 123 } // namespace autofill
117 124
118 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_LAYOUT_MODEL_H_ 125 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_LAYOUT_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698