Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 { | 53 enum class DialogWidth { |
|
kylix_rd
2017/04/21 17:45:24
This can now be removed since GetDialogPreferredWi
Elly Fong-Jones
2017/04/21 18:25:19
Well-spotted, thank you :) removed.
| |
| 54 SMALL, | 54 SMALL, |
| 55 MEDIUM, | 55 MEDIUM, |
| 56 LARGE, | 56 LARGE, |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 class ChromeLayoutProvider : public views::LayoutProvider { | 59 class ChromeLayoutProvider : public views::LayoutProvider { |
| 60 public: | 60 public: |
| 61 ChromeLayoutProvider() {} | 61 ChromeLayoutProvider() {} |
| 62 ~ChromeLayoutProvider() override {} | 62 ~ChromeLayoutProvider() override {} |
| 63 | 63 |
| 64 static ChromeLayoutProvider* Get(); | 64 static ChromeLayoutProvider* Get(); |
| 65 static std::unique_ptr<views::LayoutProvider> CreateLayoutProvider(); | 65 static std::unique_ptr<views::LayoutProvider> CreateLayoutProvider(); |
| 66 | 66 |
| 67 // views::LayoutProvider: | |
| 67 int GetDistanceMetric(int metric) const override; | 68 int GetDistanceMetric(int metric) const override; |
| 68 | |
| 69 const views::TypographyProvider& GetTypographyProvider() const override; | 69 const views::TypographyProvider& GetTypographyProvider() const override; |
| 70 | 70 |
| 71 // Returns the alignment used for control labels in a GridLayout; for example, | 71 // Returns the alignment used for control labels in a GridLayout; for example, |
| 72 // in this GridLayout: | 72 // in this GridLayout: |
| 73 // --------------------------- | 73 // --------------------------- |
| 74 // | Label 1 Checkbox 1 | | 74 // | Label 1 Checkbox 1 | |
| 75 // | Label 2 Checkbox 2 | | 75 // | Label 2 Checkbox 2 | |
| 76 // --------------------------- | 76 // --------------------------- |
| 77 // This value controls the alignment used for "Label 1" and "Label 2". | 77 // This value controls the alignment used for "Label 1" and "Label 2". |
| 78 virtual views::GridLayout::Alignment GetControlLabelGridAlignment() const; | 78 virtual views::GridLayout::Alignment GetControlLabelGridAlignment() const; |
| 79 | 79 |
| 80 // Returns whether to use extra padding on dialogs. If this is false, content | 80 // 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. | 81 // Views for dialogs should not insert extra padding at their own edges. |
| 82 virtual bool UseExtraDialogPadding() const; | 82 virtual bool UseExtraDialogPadding() const; |
| 83 | 83 |
| 84 // Returns whether to show the icon next to the title text on a dialog. | 84 // Returns whether to show the icon next to the title text on a dialog. |
| 85 virtual bool ShouldShowWindowIcon() const; | 85 virtual bool ShouldShowWindowIcon() const; |
| 86 | 86 |
| 87 // DEPRECATED. Returns whether Harmony mode is enabled. | 87 // DEPRECATED. Returns whether Harmony mode is enabled. |
| 88 // | 88 // |
| 89 // Instead of using this, create a generic solution that works for all UI | 89 // 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. | 90 // types, e.g. by adding a new LayoutDistance value that means what you need. |
| 91 // | 91 // |
| 92 // TODO(pkasting): Fix callers and remove this. | 92 // TODO(pkasting): Fix callers and remove this. |
| 93 virtual bool IsHarmonyMode() const; | 93 virtual bool IsHarmonyMode() const; |
| 94 | 94 |
| 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: | 95 private: |
| 100 DISALLOW_COPY_AND_ASSIGN(ChromeLayoutProvider); | 96 DISALLOW_COPY_AND_ASSIGN(ChromeLayoutProvider); |
| 101 }; | 97 }; |
| 102 | 98 |
| 103 #endif // CHROME_BROWSER_UI_VIEWS_HARMONY_CHROME_LAYOUT_PROVIDER_H_ | 99 #endif // CHROME_BROWSER_UI_VIEWS_HARMONY_CHROME_LAYOUT_PROVIDER_H_ |
| OLD | NEW |