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

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

Powered by Google App Engine
This is Rietveld 408576698