Skip to content

Commit

Permalink
Delete UseExtraDialogPadding and add top margin to collected cookies.
Browse files Browse the repository at this point in the history
This patch deletes ChromeLayoutProvider::UseExtraDialogPadding, which
always returns false, and any code guarded by it. This patch also adds
a margin between the title and content to the collected cookies dialog,
which is currently guarded by the above method, but upon reviewing
designer comments was probably intended to be replaced by the proper
Harmony constant instead.

Bug: 867557, 610428
Change-Id: I6d30e93e213cd235e66156b097d01a4cf6a40a1f
Reviewed-on: https://chromium-review.googlesource.com/c/1449156
Reviewed-by: Peter Boström <[email protected]>
Commit-Queue: Bret Sepulveda <[email protected]>
Cr-Commit-Position: refs/heads/master@{#628194}
  • Loading branch information
bsep-chromium authored and Commit Bot committed Feb 1, 2019
1 parent 12e6395 commit 9e10ae6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 36 deletions.
7 changes: 1 addition & 6 deletions chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "chrome/browser/ui/views/bookmarks/bookmark_editor_view.h"

#include <set>
#include <string>

#include "base/logging.h"
Expand Down Expand Up @@ -402,12 +403,6 @@ void BookmarkEditorView::Init() {
layout->AddView(tree_view_->CreateParentIfNecessary());
}

if (provider->UseExtraDialogPadding()) {
layout->AddPaddingRow(
views::GridLayout::kFixedSize,
provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL));
}

if (!show_tree_ || bb_model_->loaded())
Reset();
}
Expand Down
4 changes: 0 additions & 4 deletions chrome/browser/ui/views/chrome_layout_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,6 @@ ChromeLayoutProvider::GetControlLabelGridAlignment() const {
return views::GridLayout::LEADING;
}

bool ChromeLayoutProvider::UseExtraDialogPadding() const {
return false;
}

bool ChromeLayoutProvider::ShouldShowWindowIcon() const {
return false;
}
4 changes: 0 additions & 4 deletions chrome/browser/ui/views/chrome_layout_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ class ChromeLayoutProvider : public views::LayoutProvider {
// This value controls the alignment used for "Label 1" and "Label 2".
virtual views::GridLayout::Alignment GetControlLabelGridAlignment() const;

// Returns whether to use extra padding on dialogs. If this is false, content
// Views for dialogs should not insert extra padding at their own edges.
virtual bool UseExtraDialogPadding() const;

// Returns whether to show the icon next to the title text on a dialog.
virtual bool ShouldShowWindowIcon() const;

Expand Down
25 changes: 9 additions & 16 deletions chrome/browser/ui/views/collected_cookies_views.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

#include "chrome/browser/ui/views/collected_cookies_views.h"

#include <map>
#include <memory>
#include <utility>

#include "base/macros.h"
#include "chrome/browser/browsing_data/browsing_data_appcache_helper.h"
Expand Down Expand Up @@ -60,10 +62,6 @@ namespace {
const int kTreeViewWidth = 400;
const int kTreeViewHeight = 125;

// Spacing constants used with non-Harmony dialogs.
const int kTabbedPaneTopPadding = 14;
const int kCookieInfoBottomPadding = 4;

// Adds a ColumnSet to |layout| to hold two buttons with padding between.
// Starts a new row with the added ColumnSet.
void StartNewButtonColumnSet(views::GridLayout* layout,
Expand Down Expand Up @@ -401,10 +399,13 @@ void CollectedCookiesViews::Init() {
views::GridLayout* layout =
SetLayoutManager(std::make_unique<views::GridLayout>(this));
ChromeLayoutProvider* provider = ChromeLayoutProvider::Get();
if (provider->UseExtraDialogPadding()) {
SetBorder(
views::CreateEmptyBorder(gfx::Insets(kTabbedPaneTopPadding, 0, 0, 0)));
}

// Add margin above the content. The left, right, and bottom margins are added
// by the content itself.
set_margins(
gfx::Insets(provider->GetDistanceMetric(
views::DISTANCE_DIALOG_CONTENT_MARGIN_TOP_CONTROL),
0, 0, 0));

const int single_column_layout_id = 0;
views::ColumnSet* column_set = layout->AddColumnSet(single_column_layout_id);
Expand All @@ -424,18 +425,10 @@ void CollectedCookiesViews::Init() {
tabbed_pane->AddTab(label_blocked, CreateBlockedPane());
tabbed_pane->SelectTabAt(0);
tabbed_pane->set_listener(this);
if (ChromeLayoutProvider::Get()->UseExtraDialogPadding()) {
layout->AddPaddingRow(
views::GridLayout::kFixedSize,
provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL));
}

layout->StartRow(views::GridLayout::kFixedSize, single_column_layout_id);
cookie_info_view_ = new CookieInfoView();
layout->AddView(cookie_info_view_);
if (provider->UseExtraDialogPadding())
layout->AddPaddingRow(views::GridLayout::kFixedSize,
kCookieInfoBottomPadding);

layout->StartRow(views::GridLayout::kFixedSize, single_column_layout_id);
infobar_ = new InfobarView();
Expand Down
8 changes: 2 additions & 6 deletions chrome/browser/ui/views/login_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "chrome/browser/ui/views/login_view.h"

#include <memory>

#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/chrome_typography.h"
#include "chrome/browser/ui/views/textfield_layout.h"
Expand Down Expand Up @@ -70,12 +72,6 @@ LoginView::LoginView(const base::string16& authority,
kFieldsColumnSetId);
password_field_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD);

if (provider->UseExtraDialogPadding()) {
layout->AddPaddingRow(views::GridLayout::kFixedSize,
provider->GetDistanceMetric(
views::DISTANCE_UNRELATED_CONTROL_VERTICAL));
}

if (login_model_data) {
login_model_->AddObserverAndDeliverCredentials(this,
login_model_data->form);
Expand Down

0 comments on commit 9e10ae6

Please sign in to comment.