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

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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 filename = base::i18n::GetDisplayStringInLTRDirectionality(filename); 273 filename = base::i18n::GetDisplayStringInLTRDirectionality(filename);
274 dangerous_label = 274 dangerous_label =
275 l10n_util::GetStringFUTF16(IDS_PROMPT_DANGEROUS_DOWNLOAD, filename); 275 l10n_util::GetStringFUTF16(IDS_PROMPT_DANGEROUS_DOWNLOAD, filename);
276 } 276 }
277 } 277 }
278 278
279 dangerous_download_label_ = new views::Label(dangerous_label); 279 dangerous_download_label_ = new views::Label(dangerous_label);
280 dangerous_download_label_->SetMultiLine(true); 280 dangerous_download_label_->SetMultiLine(true);
281 dangerous_download_label_->SetHorizontalAlignment( 281 dangerous_download_label_->SetHorizontalAlignment(
282 views::Label::ALIGN_LEFT); 282 views::Label::ALIGN_LEFT);
283 dangerous_download_label_->SetAutoColorReadabilityEnabled(false);
283 AddChildView(dangerous_download_label_); 284 AddChildView(dangerous_download_label_);
284 SizeLabelToMinWidth(); 285 SizeLabelToMinWidth();
285 } 286 }
286 287
287 UpdateAccessibleName(); 288 UpdateAccessibleName();
288 set_accessibility_focusable(true); 289 set_accessibility_focusable(true);
289 290
290 // Set up our animation. 291 // Set up our animation.
291 StartDownloadProgress(); 292 StartDownloadProgress();
292 } 293 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 398
398 // Notify our parent. 399 // Notify our parent.
399 parent_->OpenedDownload(this); 400 parent_->OpenedDownload(this);
400 } 401 }
401 402
402 // View overrides 403 // View overrides
403 404
404 // In dangerous mode we have to layout our buttons. 405 // In dangerous mode we have to layout our buttons.
405 void DownloadItemView::Layout() { 406 void DownloadItemView::Layout() {
406 if (IsDangerousMode()) { 407 if (IsDangerousMode()) {
407 dangerous_download_label_->SetColor( 408 dangerous_download_label_->SetEnabledColor(
408 GetThemeProvider()->GetColor(ThemeService::COLOR_BOOKMARK_TEXT)); 409 GetThemeProvider()->GetColor(ThemeService::COLOR_BOOKMARK_TEXT));
409 410
410 int x = kLeftPadding + dangerous_mode_body_image_set_.top_left->width() + 411 int x = kLeftPadding + dangerous_mode_body_image_set_.top_left->width() +
411 warning_icon_->width() + kLabelPadding; 412 warning_icon_->width() + kLabelPadding;
412 int y = (height() - dangerous_download_label_->height()) / 2; 413 int y = (height() - dangerous_download_label_->height()) / 2;
413 dangerous_download_label_->SetBounds(x, y, 414 dangerous_download_label_->SetBounds(x, y,
414 dangerous_download_label_->width(), 415 dangerous_download_label_->width(),
415 dangerous_download_label_->height()); 416 dangerous_download_label_->height());
416 gfx::Size button_size = GetButtonSize(); 417 gfx::Size button_size = GetButtonSize();
417 x += dangerous_download_label_->width() + kLabelPadding; 418 x += dangerous_download_label_->width() + kLabelPadding;
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 // If the name has changed, notify assistive technology that the name 1110 // If the name has changed, notify assistive technology that the name
1110 // has changed so they can announce it immediately. 1111 // has changed so they can announce it immediately.
1111 if (new_name != accessible_name_) { 1112 if (new_name != accessible_name_) {
1112 accessible_name_ = new_name; 1113 accessible_name_ = new_name;
1113 if (GetWidget()) { 1114 if (GetWidget()) {
1114 GetWidget()->NotifyAccessibilityEvent( 1115 GetWidget()->NotifyAccessibilityEvent(
1115 this, ui::AccessibilityTypes::EVENT_NAME_CHANGED, true); 1116 this, ui::AccessibilityTypes::EVENT_NAME_CHANGED, true);
1116 } 1117 }
1117 } 1118 }
1118 } 1119 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/default_search_view.cc ('k') | chrome/browser/ui/views/download/download_shelf_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698