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

Unified Diff: chrome/browser/ui/views/content_setting_bubble_contents.cc

Issue 2758323002: Broke out layout metric information from ViewsDelegate to LayoutProvider (Closed)
Patch Set: Deleted LayoutDelegate and HarmonyLayoutDelegate. Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/content_setting_bubble_contents.cc
diff --git a/chrome/browser/ui/views/content_setting_bubble_contents.cc b/chrome/browser/ui/views/content_setting_bubble_contents.cc
index 6d0ade5ffe0f0cbbf4fa4092130fd9b44a1151a0..74aa6b8e81d60e06922c82b79902af645deed0c8 100644
--- a/chrome/browser/ui/views/content_setting_bubble_contents.cc
+++ b/chrome/browser/ui/views/content_setting_bubble_contents.cc
@@ -19,7 +19,7 @@
#include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/views/harmony/chrome_typography.h"
-#include "chrome/browser/ui/views/harmony/layout_delegate.h"
+#include "chrome/browser/ui/views/harmony/chrome_views_layout_delegate.h"
#include "chrome/grit/generated_resources.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/strings/grit/components_strings.h"
@@ -186,8 +186,9 @@ ContentSettingBubbleContents::~ContentSettingBubbleContents() {
gfx::Size ContentSettingBubbleContents::GetPreferredSize() const {
gfx::Size preferred_size(views::View::GetPreferredSize());
- int preferred_width = LayoutDelegate::Get()->GetDialogPreferredWidth(
- LayoutDelegate::DialogWidth::SMALL);
+ int preferred_width =
+ ChromeViewsLayoutDelegate::Get()->GetDialogPreferredWidth(
+ DialogWidth::SMALL);
if (!preferred_width)
preferred_width = (!content_setting_bubble_model_->bubble_content()
.domain_lists.empty() &&
@@ -210,13 +211,17 @@ void ContentSettingBubbleContents::Init() {
GridLayout* layout = new views::GridLayout(this);
SetLayoutManager(layout);
- const LayoutDelegate* layout_delegate = LayoutDelegate::Get();
- const int related_control_horizontal_spacing = layout_delegate->GetMetric(
- LayoutDelegate::Metric::RELATED_CONTROL_HORIZONTAL_SPACING);
- const int related_control_vertical_spacing = layout_delegate->GetMetric(
- LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING);
- const int unrelated_control_vertical_spacing = layout_delegate->GetMetric(
- LayoutDelegate::Metric::UNRELATED_CONTROL_VERTICAL_SPACING);
+ const ChromeViewsLayoutDelegate* layout_delegate =
+ ChromeViewsLayoutDelegate::Get();
+ const int related_control_horizontal_spacing =
+ layout_delegate->GetDistanceMetric(
+ ChromeDistanceMetric::RELATED_CONTROL_HORIZONTAL);
+ const int related_control_vertical_spacing =
+ layout_delegate->GetDistanceMetric(
+ ChromeDistanceMetric::RELATED_CONTROL_VERTICAL);
+ const int unrelated_control_vertical_spacing =
+ layout_delegate->GetDistanceMetric(
+ ChromeDistanceMetric::UNRELATED_CONTROL_VERTICAL);
const int kSingleColumnSetId = 0;
views::ColumnSet* column_set = layout->AddColumnSet(kSingleColumnSetId);
@@ -304,9 +309,8 @@ void ContentSettingBubbleContents::Init() {
views::ColumnSet* indented_single_column_set =
layout->AddColumnSet(indented_kSingleColumnSetId);
indented_single_column_set->AddPaddingColumn(
- 0,
- layout_delegate->GetMetric(
- LayoutDelegate::Metric::SUBSECTION_HORIZONTAL_INDENT));
+ 0, layout_delegate->GetDistanceMetric(
+ ChromeDistanceMetric::SUBSECTION_HORIZONTAL_INDENT));
indented_single_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL,
1, GridLayout::USE_PREF, 0, 0);
@@ -347,9 +351,8 @@ void ContentSettingBubbleContents::Init() {
views::ColumnSet* menu_column_set =
layout->AddColumnSet(kMediaMenuColumnSetId);
menu_column_set->AddPaddingColumn(
- 0,
- layout_delegate->GetMetric(
- LayoutDelegate::Metric::SUBSECTION_HORIZONTAL_INDENT));
+ 0, layout_delegate->GetDistanceMetric(
+ ChromeDistanceMetric::SUBSECTION_HORIZONTAL_INDENT));
menu_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 0,
GridLayout::USE_PREF, 0, 0);
menu_column_set->AddPaddingColumn(0, related_control_horizontal_spacing);

Powered by Google App Engine
This is Rietveld 408576698