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

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

Issue 11421164: Migrate CollectedCookiesViews to Chrome style. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 | Annotate | Revision Log
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.h" 10 #include "base/message_loop.h"
11 #include "base/string16.h" 11 #include "base/string16.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/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/constrained_window_constants.h"
16 #include "chrome/common/chrome_switches.h"
15 #include "grit/generated_resources.h" 17 #include "grit/generated_resources.h"
16 #include "grit/locale_settings.h" 18 #include "grit/locale_settings.h"
17 #include "net/cookies/canonical_cookie.h" 19 #include "net/cookies/canonical_cookie.h"
18 #include "net/cookies/parsed_cookie.h" 20 #include "net/cookies/parsed_cookie.h"
19 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
20 #include "ui/gfx/canvas.h" 22 #include "ui/gfx/canvas.h"
21 #include "ui/gfx/color_utils.h" 23 #include "ui/gfx/color_utils.h"
22 #include "ui/views/border.h" 24 #include "ui/views/border.h"
23 #include "ui/views/controls/combobox/combobox.h" 25 #include "ui/views/controls/combobox/combobox.h"
24 #include "ui/views/controls/label.h" 26 #include "ui/views/controls/label.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 180
179 void CookieInfoView::Init() { 181 void CookieInfoView::Init() {
180 // Ensure we don't run this more than once and leak memory. 182 // Ensure we don't run this more than once and leak memory.
181 DCHECK(!name_label_); 183 DCHECK(!name_label_);
182 184
183 #if defined(USE_AURA) || !defined(OS_WIN) 185 #if defined(USE_AURA) || !defined(OS_WIN)
184 SkColor border_color = SK_ColorGRAY; 186 SkColor border_color = SK_ColorGRAY;
185 #else 187 #else
186 SkColor border_color = color_utils::GetSysSkColor(COLOR_3DSHADOW); 188 SkColor border_color = color_utils::GetSysSkColor(COLOR_3DSHADOW);
187 #endif 189 #endif
188 views::Border* border = views::Border::CreateSolidBorder( 190 if (!chrome::UseChromeStyleDialogs())
189 kCookieInfoViewBorderSize, border_color); 191 set_border(views::Border::CreateSolidBorder(kCookieInfoViewBorderSize,
190 set_border(border); 192 border_color));
191 193
192 name_label_ = new views::Label( 194 name_label_ = new views::Label(
193 l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_NAME_LABEL)); 195 l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_NAME_LABEL));
194 name_value_field_ = new views::Textfield; 196 name_value_field_ = new views::Textfield;
195 content_label_ = new views::Label( 197 content_label_ = new views::Label(
196 l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_CONTENT_LABEL)); 198 l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_CONTENT_LABEL));
197 content_value_field_ = new views::Textfield; 199 content_value_field_ = new views::Textfield;
198 domain_label_ = new views::Label( 200 domain_label_ = new views::Label(
199 l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_DOMAIN_LABEL)); 201 l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_DOMAIN_LABEL));
200 domain_value_field_ = new views::Textfield; 202 domain_value_field_ = new views::Textfield;
(...skipping 10 matching lines...) Expand all
211 l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_EXPIRES_LABEL)); 213 l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_EXPIRES_LABEL));
212 if (editable_expiration_date_) 214 if (editable_expiration_date_)
213 expires_value_combobox_ = new views::Combobox(this); 215 expires_value_combobox_ = new views::Combobox(this);
214 else 216 else
215 expires_value_field_ = new views::Textfield; 217 expires_value_field_ = new views::Textfield;
216 218
217 using views::GridLayout; 219 using views::GridLayout;
218 using views::ColumnSet; 220 using views::ColumnSet;
219 221
220 GridLayout* layout = new GridLayout(this); 222 GridLayout* layout = new GridLayout(this);
221 layout->SetInsets(kCookieInfoViewInsetSize, 223 if (chrome::UseChromeStyleDialogs())
222 kCookieInfoViewInsetSize, 224 layout->SetInsets(0,
223 kCookieInfoViewInsetSize, 225 ConstrainedWindowConstants::kHorizontalPadding,
224 kCookieInfoViewInsetSize); 226 0,
227 ConstrainedWindowConstants::kHorizontalPadding);
228 else
229 layout->SetInsets(kCookieInfoViewInsetSize,
230 kCookieInfoViewInsetSize,
231 kCookieInfoViewInsetSize,
232 kCookieInfoViewInsetSize);
225 SetLayoutManager(layout); 233 SetLayoutManager(layout);
226 234
227 int three_column_layout_id = 0; 235 int three_column_layout_id = 0;
228 ColumnSet* column_set = layout->AddColumnSet(three_column_layout_id); 236 ColumnSet* column_set = layout->AddColumnSet(three_column_layout_id);
229 column_set->AddColumn(GridLayout::TRAILING, GridLayout::CENTER, 0, 237 column_set->AddColumn(GridLayout::TRAILING, GridLayout::CENTER, 0,
230 GridLayout::USE_PREF, 0, 0); 238 GridLayout::USE_PREF, 0, 0);
231 column_set->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing); 239 column_set->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing);
232 column_set->AddColumn(GridLayout::TRAILING, GridLayout::CENTER, 0, 240 column_set->AddColumn(GridLayout::TRAILING, GridLayout::CENTER, 0,
233 GridLayout::USE_PREF, 0, 0); 241 GridLayout::USE_PREF, 0, 0);
234 column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, 242 column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1,
(...skipping 15 matching lines...) Expand all
250 expires_value_combobox_); 258 expires_value_combobox_);
251 } else { 259 } else {
252 AddLabelRow(three_column_layout_id, layout, expires_label_, 260 AddLabelRow(three_column_layout_id, layout, expires_label_,
253 expires_value_field_); 261 expires_value_field_);
254 } 262 }
255 263
256 // Color these borderless text areas the same as the containing dialog. 264 // Color these borderless text areas the same as the containing dialog.
257 #if defined(USE_AURA) || !defined(OS_WIN) 265 #if defined(USE_AURA) || !defined(OS_WIN)
258 SkColor text_area_background = SK_ColorWHITE; 266 SkColor text_area_background = SK_ColorWHITE;
259 #else 267 #else
260 SkColor text_area_background = color_utils::GetSysSkColor(COLOR_3DFACE); 268 SkColor text_area_background = chrome::UseChromeStyleDialogs() ?
269 SK_ColorWHITE :
270 color_utils::GetSysSkColor(COLOR_3DFACE);
261 #endif 271 #endif
272 const SkColor kChromeStyleTextColor = SkColorSetRGB(0x78, 0x78, 0x78);
262 // Now that the Textfields are in the view hierarchy, we can initialize them. 273 // Now that the Textfields are in the view hierarchy, we can initialize them.
263 name_value_field_->SetReadOnly(true); 274 name_value_field_->SetReadOnly(true);
264 name_value_field_->RemoveBorder(); 275 name_value_field_->RemoveBorder();
265 name_value_field_->SetBackgroundColor(text_area_background); 276 name_value_field_->SetBackgroundColor(text_area_background);
277 if (chrome::UseChromeStyleDialogs())
278 name_value_field_->SetTextColor(kChromeStyleTextColor);
266 content_value_field_->SetReadOnly(true); 279 content_value_field_->SetReadOnly(true);
267 content_value_field_->RemoveBorder(); 280 content_value_field_->RemoveBorder();
268 content_value_field_->SetBackgroundColor(text_area_background); 281 content_value_field_->SetBackgroundColor(text_area_background);
282 if (chrome::UseChromeStyleDialogs())
283 content_value_field_->SetTextColor(kChromeStyleTextColor);
269 domain_value_field_->SetReadOnly(true); 284 domain_value_field_->SetReadOnly(true);
270 domain_value_field_->RemoveBorder(); 285 domain_value_field_->RemoveBorder();
271 domain_value_field_->SetBackgroundColor(text_area_background); 286 domain_value_field_->SetBackgroundColor(text_area_background);
287 if (chrome::UseChromeStyleDialogs())
288 domain_value_field_->SetTextColor(kChromeStyleTextColor);
272 path_value_field_->SetReadOnly(true); 289 path_value_field_->SetReadOnly(true);
273 path_value_field_->RemoveBorder(); 290 path_value_field_->RemoveBorder();
274 path_value_field_->SetBackgroundColor(text_area_background); 291 path_value_field_->SetBackgroundColor(text_area_background);
292 if (chrome::UseChromeStyleDialogs())
293 path_value_field_->SetTextColor(kChromeStyleTextColor);
275 send_for_value_field_->SetReadOnly(true); 294 send_for_value_field_->SetReadOnly(true);
276 send_for_value_field_->RemoveBorder(); 295 send_for_value_field_->RemoveBorder();
277 send_for_value_field_->SetBackgroundColor(text_area_background); 296 send_for_value_field_->SetBackgroundColor(text_area_background);
297 if (chrome::UseChromeStyleDialogs())
298 send_for_value_field_->SetTextColor(kChromeStyleTextColor);
278 created_value_field_->SetReadOnly(true); 299 created_value_field_->SetReadOnly(true);
279 created_value_field_->RemoveBorder(); 300 created_value_field_->RemoveBorder();
280 created_value_field_->SetBackgroundColor(text_area_background); 301 created_value_field_->SetBackgroundColor(text_area_background);
302 if (chrome::UseChromeStyleDialogs())
303 created_value_field_->SetTextColor(kChromeStyleTextColor);
281 if (expires_value_field_) { 304 if (expires_value_field_) {
282 expires_value_field_->SetReadOnly(true); 305 expires_value_field_->SetReadOnly(true);
283 expires_value_field_->RemoveBorder(); 306 expires_value_field_->RemoveBorder();
284 expires_value_field_->SetBackgroundColor(text_area_background); 307 expires_value_field_->SetBackgroundColor(text_area_background);
308 if (chrome::UseChromeStyleDialogs())
309 expires_value_field_->SetTextColor(kChromeStyleTextColor);
285 } 310 }
286 } 311 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698