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

Side by Side Diff: chrome/browser/ui/views/download/download_item_view.cc

Issue 8221027: Make views::Label and views::Link auto-color themselves to be readable over their background colo... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/download/download_item_view.h" 5 #include "chrome/browser/ui/views/download/download_item_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 filename = base::i18n::GetDisplayStringInLTRDirectionality(filename); 274 filename = base::i18n::GetDisplayStringInLTRDirectionality(filename);
275 dangerous_label = 275 dangerous_label =
276 l10n_util::GetStringFUTF16(IDS_PROMPT_DANGEROUS_DOWNLOAD, filename); 276 l10n_util::GetStringFUTF16(IDS_PROMPT_DANGEROUS_DOWNLOAD, filename);
277 } 277 }
278 } 278 }
279 279
280 dangerous_download_label_ = new views::Label(dangerous_label); 280 dangerous_download_label_ = new views::Label(dangerous_label);
281 dangerous_download_label_->SetMultiLine(true); 281 dangerous_download_label_->SetMultiLine(true);
282 dangerous_download_label_->SetHorizontalAlignment( 282 dangerous_download_label_->SetHorizontalAlignment(
283 views::Label::ALIGN_LEFT); 283 views::Label::ALIGN_LEFT);
284 dangerous_download_label_->SetAutoColorReadabilityEnabled(false);
284 AddChildView(dangerous_download_label_); 285 AddChildView(dangerous_download_label_);
285 SizeLabelToMinWidth(); 286 SizeLabelToMinWidth();
286 } 287 }
287 288
288 UpdateAccessibleName(); 289 UpdateAccessibleName();
289 set_accessibility_focusable(true); 290 set_accessibility_focusable(true);
290 291
291 // Set up our animation. 292 // Set up our animation.
292 StartDownloadProgress(); 293 StartDownloadProgress();
293 } 294 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 402
402 // Notify our parent. 403 // Notify our parent.
403 parent_->OpenedDownload(this); 404 parent_->OpenedDownload(this);
404 } 405 }
405 406
406 // View overrides 407 // View overrides
407 408
408 // In dangerous mode we have to layout our buttons. 409 // In dangerous mode we have to layout our buttons.
409 void DownloadItemView::Layout() { 410 void DownloadItemView::Layout() {
410 if (IsDangerousMode()) { 411 if (IsDangerousMode()) {
411 dangerous_download_label_->SetColor( 412 dangerous_download_label_->SetEnabledColor(
412 GetThemeProvider()->GetColor(ThemeService::COLOR_BOOKMARK_TEXT)); 413 GetThemeProvider()->GetColor(ThemeService::COLOR_BOOKMARK_TEXT));
413 414
414 int x = kLeftPadding + dangerous_mode_body_image_set_.top_left->width() + 415 int x = kLeftPadding + dangerous_mode_body_image_set_.top_left->width() +
415 warning_icon_->width() + kLabelPadding; 416 warning_icon_->width() + kLabelPadding;
416 int y = (height() - dangerous_download_label_->height()) / 2; 417 int y = (height() - dangerous_download_label_->height()) / 2;
417 dangerous_download_label_->SetBounds(x, y, 418 dangerous_download_label_->SetBounds(x, y,
418 dangerous_download_label_->width(), 419 dangerous_download_label_->width(),
419 dangerous_download_label_->height()); 420 dangerous_download_label_->height());
420 gfx::Size button_size = GetButtonSize(); 421 gfx::Size button_size = GetButtonSize();
421 x += dangerous_download_label_->width() + kLabelPadding; 422 x += dangerous_download_label_->width() + kLabelPadding;
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 // If the name has changed, notify assistive technology that the name 1118 // If the name has changed, notify assistive technology that the name
1118 // has changed so they can announce it immediately. 1119 // has changed so they can announce it immediately.
1119 if (new_name != accessible_name_) { 1120 if (new_name != accessible_name_) {
1120 accessible_name_ = new_name; 1121 accessible_name_ = new_name;
1121 if (GetWidget()) { 1122 if (GetWidget()) {
1122 GetWidget()->NotifyAccessibilityEvent( 1123 GetWidget()->NotifyAccessibilityEvent(
1123 this, ui::AccessibilityTypes::EVENT_NAME_CHANGED, true); 1124 this, ui::AccessibilityTypes::EVENT_NAME_CHANGED, true);
1124 } 1125 }
1125 } 1126 }
1126 } 1127 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698