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

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

Issue 2821413002: views: support dialog width snapping once and for all (Closed)
Patch Set: fix failing unittest Created 3 years, 7 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"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // Horizontal spacing between controls that are logically unrelated. 43 // Horizontal spacing between controls that are logically unrelated.
44 DISTANCE_UNRELATED_CONTROL_HORIZONTAL, 44 DISTANCE_UNRELATED_CONTROL_HORIZONTAL,
45 // Larger horizontal spacing between unrelated controls. 45 // Larger horizontal spacing between unrelated controls.
46 DISTANCE_UNRELATED_CONTROL_HORIZONTAL_LARGE, 46 DISTANCE_UNRELATED_CONTROL_HORIZONTAL_LARGE,
47 // Vertical spacing between controls that are logically unrelated. 47 // Vertical spacing between controls that are logically unrelated.
48 DISTANCE_UNRELATED_CONTROL_VERTICAL, 48 DISTANCE_UNRELATED_CONTROL_VERTICAL,
49 // Larger vertical spacing between unrelated controls. 49 // Larger vertical spacing between unrelated controls.
50 DISTANCE_UNRELATED_CONTROL_VERTICAL_LARGE, 50 DISTANCE_UNRELATED_CONTROL_VERTICAL_LARGE,
51 }; 51 };
52 52
53 enum class DialogWidth {
54 SMALL,
55 MEDIUM,
56 LARGE,
57 };
58
59 class ChromeLayoutProvider : public views::LayoutProvider { 53 class ChromeLayoutProvider : public views::LayoutProvider {
60 public: 54 public:
61 ChromeLayoutProvider() {} 55 ChromeLayoutProvider() {}
62 ~ChromeLayoutProvider() override {} 56 ~ChromeLayoutProvider() override {}
63 57
64 static ChromeLayoutProvider* Get(); 58 static ChromeLayoutProvider* Get();
65 static std::unique_ptr<views::LayoutProvider> CreateLayoutProvider(); 59 static std::unique_ptr<views::LayoutProvider> CreateLayoutProvider();
66 60
61 // views::LayoutProvider:
67 int GetDistanceMetric(int metric) const override; 62 int GetDistanceMetric(int metric) const override;
68
69 const views::TypographyProvider& GetTypographyProvider() const override; 63 const views::TypographyProvider& GetTypographyProvider() const override;
70 64
71 // Returns the alignment used for control labels in a GridLayout; for example, 65 // Returns the alignment used for control labels in a GridLayout; for example,
72 // in this GridLayout: 66 // in this GridLayout:
73 // --------------------------- 67 // ---------------------------
74 // | Label 1 Checkbox 1 | 68 // | Label 1 Checkbox 1 |
75 // | Label 2 Checkbox 2 | 69 // | Label 2 Checkbox 2 |
76 // --------------------------- 70 // ---------------------------
77 // This value controls the alignment used for "Label 1" and "Label 2". 71 // This value controls the alignment used for "Label 1" and "Label 2".
78 virtual views::GridLayout::Alignment GetControlLabelGridAlignment() const; 72 virtual views::GridLayout::Alignment GetControlLabelGridAlignment() const;
79 73
80 // Returns whether to use extra padding on dialogs. If this is false, content 74 // Returns whether to use extra padding on dialogs. If this is false, content
81 // Views for dialogs should not insert extra padding at their own edges. 75 // Views for dialogs should not insert extra padding at their own edges.
82 virtual bool UseExtraDialogPadding() const; 76 virtual bool UseExtraDialogPadding() const;
83 77
84 // Returns whether to show the icon next to the title text on a dialog. 78 // Returns whether to show the icon next to the title text on a dialog.
85 virtual bool ShouldShowWindowIcon() const; 79 virtual bool ShouldShowWindowIcon() const;
86 80
87 // DEPRECATED. Returns whether Harmony mode is enabled. 81 // DEPRECATED. Returns whether Harmony mode is enabled.
88 // 82 //
89 // Instead of using this, create a generic solution that works for all UI 83 // Instead of using this, create a generic solution that works for all UI
90 // types, e.g. by adding a new LayoutDistance value that means what you need. 84 // types, e.g. by adding a new LayoutDistance value that means what you need.
91 // 85 //
92 // TODO(pkasting): Fix callers and remove this. 86 // TODO(pkasting): Fix callers and remove this.
93 virtual bool IsHarmonyMode() const; 87 virtual bool IsHarmonyMode() const;
94 88
95 // Returns the preferred width in DIPs for a dialog of the specified |width|.
96 // May return 0 if the dialog has no preferred width.
97 virtual int GetDialogPreferredWidth(DialogWidth width) const;
98
99 private: 89 private:
100 DISALLOW_COPY_AND_ASSIGN(ChromeLayoutProvider); 90 DISALLOW_COPY_AND_ASSIGN(ChromeLayoutProvider);
101 }; 91 };
102 92
103 #endif // CHROME_BROWSER_UI_VIEWS_HARMONY_CHROME_LAYOUT_PROVIDER_H_ 93 #endif // CHROME_BROWSER_UI_VIEWS_HARMONY_CHROME_LAYOUT_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/device_chooser_content_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