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

Side by Side Diff: chrome/browser/ui/views/harmony/chrome_layout_provider.h

Issue 2968713003: Harmonize the find in page dialog. (Closed)
Patch Set: Fix format Created 3 years, 5 months 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 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_VIEWS_HARMONY_CHROME_LAYOUT_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_HARMONY_CHROME_LAYOUT_PROVIDER_H_
6 #define CHROME_BROWSER_UI_VIEWS_HARMONY_CHROME_LAYOUT_PROVIDER_H_ 6 #define CHROME_BROWSER_UI_VIEWS_HARMONY_CHROME_LAYOUT_PROVIDER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "ui/gfx/geometry/insets.h" 11 #include "ui/gfx/geometry/insets.h"
12 #include "ui/views/layout/grid_layout.h" 12 #include "ui/views/layout/grid_layout.h"
13 #include "ui/views/layout/layout_provider.h" 13 #include "ui/views/layout/layout_provider.h"
14 14
15 enum ChromeInsetsMetric {
16 // Margins used by toasts.
17 INSETS_TOAST = views::VIEWS_INSETS_END,
18 };
19
15 enum ChromeDistanceMetric { 20 enum ChromeDistanceMetric {
16 // Default minimum width of a button. 21 // Default minimum width of a button.
17 DISTANCE_BUTTON_MINIMUM_WIDTH = views::VIEWS_DISTANCE_END, 22 DISTANCE_BUTTON_MINIMUM_WIDTH = views::VIEWS_DISTANCE_END,
18 // Vertical spacing between a list of multiple controls in one column. 23 // Vertical spacing between a list of multiple controls in one column.
19 DISTANCE_CONTROL_LIST_VERTICAL, 24 DISTANCE_CONTROL_LIST_VERTICAL,
20 // The combined vertical padding applied to text in a control. 25 // The combined vertical padding applied to text in a control.
21 DISTANCE_CONTROL_TOTAL_VERTICAL_TEXT_PADDING, 26 DISTANCE_CONTROL_TOTAL_VERTICAL_TEXT_PADDING,
22 // Smaller horizontal spacing between other controls that are logically 27 // Smaller horizontal spacing between other controls that are logically
23 // related. 28 // related.
24 DISTANCE_RELATED_CONTROL_HORIZONTAL_SMALL, 29 DISTANCE_RELATED_CONTROL_HORIZONTAL_SMALL,
25 // Smaller vertical spacing between controls that are logically related. 30 // Smaller vertical spacing between controls that are logically related.
26 DISTANCE_RELATED_CONTROL_VERTICAL_SMALL, 31 DISTANCE_RELATED_CONTROL_VERTICAL_SMALL,
27 // Horizontal spacing between an item such as an icon or checkbox and a 32 // Horizontal spacing between an item such as an icon or checkbox and a
28 // label related to it. 33 // label related to it.
29 DISTANCE_RELATED_LABEL_HORIZONTAL, 34 DISTANCE_RELATED_LABEL_HORIZONTAL,
30 // Horizontal spacing between an item and the related label, in the context of 35 // Horizontal spacing between an item and the related label, in the context of
31 // a row of such items. E.g. the bookmarks bar. 36 // a row of such items. E.g. the bookmarks bar.
32 DISTANCE_RELATED_LABEL_HORIZONTAL_LIST, 37 DISTANCE_RELATED_LABEL_HORIZONTAL_LIST,
33 // Horizontal indent of a subsection relative to related items above, e.g. 38 // Horizontal indent of a subsection relative to related items above, e.g.
34 // checkboxes below explanatory text/headings. 39 // checkboxes below explanatory text/headings.
35 DISTANCE_SUBSECTION_HORIZONTAL_INDENT, 40 DISTANCE_SUBSECTION_HORIZONTAL_INDENT,
41 // Vertical margin for controls in a toast.
42 DISTANCE_TOAST_CONTROL_VERTICAL,
43 // Vertical margin for labels in a toast.
44 DISTANCE_TOAST_LABEL_VERTICAL,
36 // Horizontal spacing between controls that are logically unrelated. 45 // Horizontal spacing between controls that are logically unrelated.
37 DISTANCE_UNRELATED_CONTROL_HORIZONTAL, 46 DISTANCE_UNRELATED_CONTROL_HORIZONTAL,
38 // Larger horizontal spacing between unrelated controls. 47 // Larger horizontal spacing between unrelated controls.
39 DISTANCE_UNRELATED_CONTROL_HORIZONTAL_LARGE, 48 DISTANCE_UNRELATED_CONTROL_HORIZONTAL_LARGE,
40 // Larger vertical spacing between unrelated controls. 49 // Larger vertical spacing between unrelated controls.
41 DISTANCE_UNRELATED_CONTROL_VERTICAL_LARGE, 50 DISTANCE_UNRELATED_CONTROL_VERTICAL_LARGE,
42 }; 51 };
43 52
44 class ChromeLayoutProvider : public views::LayoutProvider { 53 class ChromeLayoutProvider : public views::LayoutProvider {
45 public: 54 public:
46 ChromeLayoutProvider() {} 55 ChromeLayoutProvider() {}
47 ~ChromeLayoutProvider() override {} 56 ~ChromeLayoutProvider() override {}
48 57
49 static ChromeLayoutProvider* Get(); 58 static ChromeLayoutProvider* Get();
50 static std::unique_ptr<views::LayoutProvider> CreateLayoutProvider(); 59 static std::unique_ptr<views::LayoutProvider> CreateLayoutProvider();
51 60
52 // Calculates the control height based on the |font|'s reported glyph height, 61 // Calculates the control height based on the |font|'s reported glyph height,
53 // the default line spacing and DISTANCE_CONTROL_TOTAL_VERTICAL_TEXT_PADDING. 62 // the default line spacing and DISTANCE_CONTROL_TOTAL_VERTICAL_TEXT_PADDING.
54 static int GetControlHeightForFont(const gfx::FontList& font); 63 static int GetControlHeightForFont(const gfx::FontList& font);
55 64
56 // views::LayoutProvider: 65 // views::LayoutProvider:
66 gfx::Insets GetInsetsMetric(int metric) const override;
57 int GetDistanceMetric(int metric) const override; 67 int GetDistanceMetric(int metric) const override;
58 const views::TypographyProvider& GetTypographyProvider() const override; 68 const views::TypographyProvider& GetTypographyProvider() const override;
59 69
60 // Returns the alignment used for control labels in a GridLayout; for example, 70 // Returns the alignment used for control labels in a GridLayout; for example,
61 // in this GridLayout: 71 // in this GridLayout:
62 // --------------------------- 72 // ---------------------------
63 // | Label 1 Checkbox 1 | 73 // | Label 1 Checkbox 1 |
64 // | Label 2 Checkbox 2 | 74 // | Label 2 Checkbox 2 |
65 // --------------------------- 75 // ---------------------------
66 // This value controls the alignment used for "Label 1" and "Label 2". 76 // This value controls the alignment used for "Label 1" and "Label 2".
(...skipping 12 matching lines...) Expand all
79 // types, e.g. by adding a new LayoutDistance value that means what you need. 89 // types, e.g. by adding a new LayoutDistance value that means what you need.
80 // 90 //
81 // TODO(pkasting): Fix callers and remove this. 91 // TODO(pkasting): Fix callers and remove this.
82 virtual bool IsHarmonyMode() const; 92 virtual bool IsHarmonyMode() const;
83 93
84 private: 94 private:
85 DISALLOW_COPY_AND_ASSIGN(ChromeLayoutProvider); 95 DISALLOW_COPY_AND_ASSIGN(ChromeLayoutProvider);
86 }; 96 };
87 97
88 #endif // CHROME_BROWSER_UI_VIEWS_HARMONY_CHROME_LAYOUT_PROVIDER_H_ 98 #endif // CHROME_BROWSER_UI_VIEWS_HARMONY_CHROME_LAYOUT_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/find_bar_view.cc ('k') | chrome/browser/ui/views/harmony/chrome_layout_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698