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

Side by Side Diff: chrome/browser/ui/views/cookie_info_view.cc

Issue 2758323002: Broke out layout metric information from ViewsDelegate to LayoutProvider (Closed)
Patch Set: LayoutDelegate -> LayoutProvider Created 3 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/views/cookie_info_view.h" 5 #include "chrome/browser/ui/views/cookie_info_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/i18n/time_formatting.h" 9 #include "base/i18n/time_formatting.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/browser/browsing_data/cookies_tree_model.h" 14 #include "chrome/browser/browsing_data/cookies_tree_model.h"
15 #include "chrome/browser/ui/views/harmony/layout_delegate.h" 15 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
16 #include "chrome/grit/generated_resources.h" 16 #include "chrome/grit/generated_resources.h"
17 #include "net/cookies/canonical_cookie.h" 17 #include "net/cookies/canonical_cookie.h"
18 #include "third_party/skia/include/core/SkColor.h" 18 #include "third_party/skia/include/core/SkColor.h"
19 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
20 #include "ui/gfx/canvas.h" 20 #include "ui/gfx/canvas.h"
21 #include "ui/native_theme/native_theme.h" 21 #include "ui/native_theme/native_theme.h"
22 #include "ui/views/border.h" 22 #include "ui/views/border.h"
23 #include "ui/views/controls/label.h" 23 #include "ui/views/controls/label.h"
24 #include "ui/views/controls/textfield/textfield.h" 24 #include "ui/views/controls/textfield/textfield.h"
25 #include "ui/views/layout/grid_layout.h" 25 #include "ui/views/layout/grid_layout.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_SENDFOR_LABEL)); 140 l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_SENDFOR_LABEL));
141 send_for_value_field_ = new views::Textfield; 141 send_for_value_field_ = new views::Textfield;
142 created_label_ = new views::Label( 142 created_label_ = new views::Label(
143 l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_CREATED_LABEL)); 143 l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_CREATED_LABEL));
144 created_value_field_ = new views::Textfield; 144 created_value_field_ = new views::Textfield;
145 expires_label_ = new views::Label( 145 expires_label_ = new views::Label(
146 l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_EXPIRES_LABEL)); 146 l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_EXPIRES_LABEL));
147 expires_value_field_ = new views::Textfield; 147 expires_value_field_ = new views::Textfield;
148 148
149 views::GridLayout* layout = new views::GridLayout(this); 149 views::GridLayout* layout = new views::GridLayout(this);
150 layout->SetInsets(0, 150 ChromeLayoutProvider* provider = ChromeLayoutProvider::Get();
151 LayoutDelegate::Get()->GetMetric( 151 layout->SetInsets(
152 LayoutDelegate::Metric::DIALOG_BUTTON_MARGIN), 152 0, provider->GetDistanceMetric(DISTANCE_DIALOG_BUTTON_MARGIN), 0,
153 0, 153 provider->GetDistanceMetric(DISTANCE_DIALOG_BUTTON_MARGIN));
Peter Kasting 2017/04/12 21:37:43 Nit: Use temp for side inset value?
kylix_rd 2017/04/13 16:45:42 Done.
154 LayoutDelegate::Get()->GetMetric(
155 LayoutDelegate::Metric::DIALOG_BUTTON_MARGIN));
156 SetLayoutManager(layout); 154 SetLayoutManager(layout);
157 155
158 int three_column_layout_id = 0; 156 int three_column_layout_id = 0;
159 views::ColumnSet* column_set = layout->AddColumnSet(three_column_layout_id); 157 views::ColumnSet* column_set = layout->AddColumnSet(three_column_layout_id);
160 column_set->AddColumn(LayoutDelegate::Get()->GetControlLabelGridAlignment(), 158 column_set->AddColumn(provider->GetControlLabelGridAlignment(),
161 views::GridLayout::CENTER, 0, 159 views::GridLayout::CENTER, 0,
162 views::GridLayout::USE_PREF, 0, 0); 160 views::GridLayout::USE_PREF, 0, 0);
163 column_set->AddPaddingColumn( 161 column_set->AddPaddingColumn(
164 0, 162 0,
165 LayoutDelegate::Get()->GetMetric( 163 provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_HORIZONTAL));
166 LayoutDelegate::Metric::RELATED_CONTROL_HORIZONTAL_SPACING));
167 column_set->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER, 164 column_set->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER,
168 0, views::GridLayout::USE_PREF, 0, 0); 165 0, views::GridLayout::USE_PREF, 0, 0);
169 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER, 166 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER,
170 1, views::GridLayout::USE_PREF, 0, 0); 167 1, views::GridLayout::USE_PREF, 0, 0);
171 168
172 AddLabelRow(three_column_layout_id, layout, name_label_, name_value_field_); 169 AddLabelRow(three_column_layout_id, layout, name_label_, name_value_field_);
173 AddLabelRow(three_column_layout_id, layout, content_label_, 170 AddLabelRow(three_column_layout_id, layout, content_label_,
174 content_value_field_); 171 content_value_field_);
175 AddLabelRow(three_column_layout_id, layout, domain_label_, 172 AddLabelRow(three_column_layout_id, layout, domain_label_,
176 domain_value_field_); 173 domain_value_field_);
177 AddLabelRow(three_column_layout_id, layout, path_label_, path_value_field_); 174 AddLabelRow(three_column_layout_id, layout, path_label_, path_value_field_);
178 AddLabelRow(three_column_layout_id, layout, send_for_label_, 175 AddLabelRow(three_column_layout_id, layout, send_for_label_,
179 send_for_value_field_); 176 send_for_value_field_);
180 AddLabelRow(three_column_layout_id, layout, created_label_, 177 AddLabelRow(three_column_layout_id, layout, created_label_,
181 created_value_field_); 178 created_value_field_);
182 AddLabelRow(three_column_layout_id, layout, expires_label_, 179 AddLabelRow(three_column_layout_id, layout, expires_label_,
183 expires_value_field_); 180 expires_value_field_);
184 } 181 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698