Commit 66f7a47e authored by ananta's avatar ananta Committed by Commit bot

Views/Harmony Remove references to ui/views/layout/layout_constants.h

Replace references to constants in ui/views/layout/layout_constants.h with their
equivalents using ChromeLayoutProvider. Removed some stale includes of layout_constants.h

BUG=691897

Review-Url: https://codereview.chromium.org/2837153003
Cr-Commit-Position: refs/heads/master@{#467245}
parent 998900e4
......@@ -14,7 +14,6 @@
#include "ui/views/controls/label.h"
#include "ui/views/controls/link.h"
#include "ui/views/layout/grid_layout.h"
#include "ui/views/layout/layout_constants.h"
#include "ui/views/widget/widget.h"
ConfirmBubbleViews::ConfirmBubbleViews(
......
......@@ -44,7 +44,6 @@
#include "ui/views/controls/menu/menu_runner.h"
#include "ui/views/controls/separator.h"
#include "ui/views/layout/grid_layout.h"
#include "ui/views/layout/layout_constants.h"
#include "ui/views/native_cursor.h"
#include "ui/views/window/dialog_client_view.h"
......
......@@ -8,6 +8,7 @@
#include "base/bind_helpers.h"
#include "build/build_config.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
#include "components/constrained_window/constrained_window_views.h"
......@@ -98,6 +99,8 @@ void CreateChromeApplicationShortcutView::InitControls() {
profile_->GetPrefs()->GetBoolean(prefs::kWebAppCreateInAppsMenu));
#endif
ChromeLayoutProvider* provider = ChromeLayoutProvider::Get();
// Layout controls
views::GridLayout* layout = views::GridLayout::CreatePanel(this);
......@@ -108,7 +111,8 @@ void CreateChromeApplicationShortcutView::InitControls() {
static const int kTableColumnSetId = 1;
column_set = layout->AddColumnSet(kTableColumnSetId);
column_set->AddPaddingColumn(0, views::kCheckboxIndent);
column_set->AddPaddingColumn(
0, provider->GetDistanceMetric(DISTANCE_SUBSECTION_HORIZONTAL_INDENT));
column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL,
100.0f, views::GridLayout::USE_PREF, 0, 0);
......@@ -119,14 +123,16 @@ void CreateChromeApplicationShortcutView::InitControls() {
layout->StartRow(0, kTableColumnSetId);
layout->AddView(desktop_check_box_);
const int vertical_spacing =
provider->GetDistanceMetric(DISTANCE_RELATED_CONTROL_VERTICAL_SMALL);
if (menu_check_box_ != nullptr) {
layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing);
layout->AddPaddingRow(0, vertical_spacing);
layout->StartRow(0, kTableColumnSetId);
layout->AddView(menu_check_box_);
}
if (quick_launch_check_box_ != nullptr) {
layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing);
layout->AddPaddingRow(0, vertical_spacing);
layout->StartRow(0, kTableColumnSetId);
layout->AddView(quick_launch_check_box_);
}
......
......@@ -6,6 +6,7 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
#include "chrome/grit/generated_resources.h"
#include "components/strings/grit/components_strings.h"
#include "ui/base/l10n/l10n_util.h"
......@@ -13,7 +14,6 @@
#include "ui/views/controls/label.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/layout/grid_layout.h"
#include "ui/views/layout/layout_constants.h"
#include "ui/views/widget/widget.h"
namespace chrome {
......@@ -123,6 +123,8 @@ void CryptoModulePasswordDialogView::Init(const std::string& hostname,
password_entry_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD);
password_entry_->set_controller(this);
ChromeLayoutProvider* provider = ChromeLayoutProvider::Get();
views::GridLayout* layout = views::GridLayout::CreatePanel(this);
views::ColumnSet* reason_column_set = layout->AddColumnSet(0);
......@@ -135,13 +137,15 @@ void CryptoModulePasswordDialogView::Init(const std::string& hostname,
views::GridLayout::LEADING, 0,
views::GridLayout::USE_PREF, 0, 0);
column_set->AddPaddingColumn(
0, views::kUnrelatedControlLargeHorizontalSpacing);
0,
provider->GetDistanceMetric(DISTANCE_UNRELATED_CONTROL_HORIZONTAL_LARGE));
column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1,
views::GridLayout::USE_PREF, 0, 0);
layout->StartRow(0, 0);
layout->AddView(reason_label_);
layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing);
layout->AddPaddingRow(
0, provider->GetDistanceMetric(DISTANCE_UNRELATED_CONTROL_VERTICAL));
layout->StartRow(0, 1);
layout->AddView(password_label_);
......
......@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/crypto_module_password_dialog.h"
#include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/test/views_test_base.h"
......@@ -20,6 +21,14 @@ class CryptoModulePasswordDialogViewTest : public views::ViewsTestBase {
CryptoModulePasswordDialogViewTest() {}
~CryptoModulePasswordDialogViewTest() override {}
// Overrides from views::ViewsTestBase:
void SetUp() override {
ViewsTestBase::SetUp();
// Set the ChromeLayoutProvider as the default layout provider.
test_views_delegate()->set_layout_provider(
ChromeLayoutProvider::CreateLayoutProvider());
}
void Capture(const std::string& text) {
text_ = text;
}
......
......@@ -10,6 +10,7 @@
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
#include "chrome/grit/generated_resources.h"
#include "components/search_engines/util.h"
#include "ui/base/l10n/l10n_util.h"
......@@ -18,7 +19,6 @@
#include "ui/views/controls/link.h"
#include "ui/views/event_monitor.h"
#include "ui/views/layout/grid_layout.h"
#include "ui/views/layout/layout_constants.h"
#include "ui/views/widget/widget.h"
namespace {
......@@ -65,10 +65,13 @@ void FirstRunBubble::Init() {
views::GridLayout* layout = views::GridLayout::CreatePanel(this);
layout->SetInsets(kTopInset, kLeftInset, kBottomInset, kRightInset);
ChromeLayoutProvider* provider = ChromeLayoutProvider::Get();
views::ColumnSet* columns = layout->AddColumnSet(0);
columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::LEADING, 0,
views::GridLayout::USE_PREF, 0, 0);
columns->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing);
columns->AddPaddingColumn(0, provider->GetDistanceMetric(
views::DISTANCE_RELATED_CONTROL_HORIZONTAL));
columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::LEADING, 0,
views::GridLayout::USE_PREF, 0, 0);
columns->AddPaddingColumn(1, 0);
......@@ -76,8 +79,9 @@ void FirstRunBubble::Init() {
layout->StartRow(0, 0);
layout->AddView(title);
layout->AddView(change);
layout->StartRowWithPadding(0, 0, 0,
views::kRelatedControlSmallVerticalSpacing);
layout->StartRowWithPadding(
0, 0, 0,
provider->GetDistanceMetric(DISTANCE_RELATED_CONTROL_VERTICAL_SMALL));
layout->AddView(subtext, columns->num_columns(), 1);
}
......
......@@ -5,6 +5,7 @@
#include "chrome/browser/ui/views/first_run_bubble.h"
#include "base/macros.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
#include "chrome/test/base/testing_profile.h"
#include "components/search_engines/template_url.h"
#include "components/search_engines/template_url_service.h"
......@@ -82,6 +83,9 @@ FirstRunBubbleTest::~FirstRunBubbleTest() {}
void FirstRunBubbleTest::SetUp() {
ViewsTestBase::SetUp();
// Set the ChromeLayoutProvider as the default layout provider.
test_views_delegate()->set_layout_provider(
ChromeLayoutProvider::CreateLayoutProvider());
TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
profile(), &TemplateURLServiceFactory::BuildInstanceFor);
TemplateURLService* turl_model =
......
......@@ -13,6 +13,7 @@
#include "chrome/browser/metrics/metrics_reporting_state.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
......@@ -25,7 +26,6 @@
#include "ui/views/controls/button/checkbox.h"
#include "ui/views/controls/link.h"
#include "ui/views/layout/grid_layout.h"
#include "ui/views/layout/layout_constants.h"
#include "ui/views/widget/widget.h"
#include "ui/views/window/dialog_delegate.h"
......@@ -82,8 +82,6 @@ FirstRunDialog::FirstRunDialog(Profile* profile)
report_crashes_(NULL) {
GridLayout* layout = GridLayout::CreatePanel(this);
const int related_y = views::kRelatedControlVerticalSpacing;
views::ColumnSet* column_set = layout->AddColumnSet(0);
column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 0,
GridLayout::USE_PREF, 0, 0);
......@@ -94,7 +92,9 @@ FirstRunDialog::FirstRunDialog(Profile* profile)
make_default_->SetChecked(true);
layout->AddView(make_default_);
layout->StartRowWithPadding(0, 0, 0, related_y);
layout->StartRowWithPadding(0, 0, 0,
ChromeLayoutProvider::Get()->GetDistanceMetric(
views::DISTANCE_RELATED_CONTROL_VERTICAL));
report_crashes_ = new views::Checkbox(l10n_util::GetStringUTF16(
IDS_OPTIONS_ENABLE_LOGGING));
// Having this box checked means the user has to opt-out of metrics recording.
......
......@@ -22,7 +22,6 @@
#include "ui/views/controls/link.h"
#include "ui/views/controls/link_listener.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/layout/layout_constants.h"
namespace {
......
......@@ -21,7 +21,6 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/layout/layout_constants.h"
#include "ui/views/widget/widget.h"
#include "url/gurl.h"
......
......@@ -38,7 +38,6 @@
#include "ui/views/controls/styled_label.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/layout/grid_layout.h"
#include "ui/views/layout/layout_constants.h"
#include "ui/views/widget/widget.h"
using views::GridLayout;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment