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

Side by Side Diff: chrome/browser/gtk/download_item_gtk.cc

Issue 2775002: revert r49217, which caused unit test failures on win: (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 6 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
« no previous file with comments | « no previous file | net/base/net_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/gtk/download_item_gtk.h" 5 #include "chrome/browser/gtk/download_item_gtk.h"
6 6
7 #include "app/gtk_util.h" 7 #include "app/gtk_util.h"
8 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
9 #include "app/menus/simple_menu_model.h" 9 #include "app/menus/simple_menu_model.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 541
542 // Lighten the color by blending it with the download item body color. These 542 // Lighten the color by blending it with the download item body color. These
543 // values are taken from IDR_DOWNLOAD_BUTTON. 543 // values are taken from IDR_DOWNLOAD_BUTTON.
544 SkColor blend_color = SkColorSetRGB(241, 245, 250); 544 SkColor blend_color = SkColorSetRGB(241, 245, 250);
545 text_color = gfx::SkColorToGdkColor( 545 text_color = gfx::SkColorToGdkColor(
546 color_utils::AlphaBlend(blend_color, color, 77)); 546 color_utils::AlphaBlend(blend_color, color, 77));
547 } 547 }
548 548
549 gtk_util::SetLabelColor(status_label, theme_provider_->UseGtkTheme() ? 549 gtk_util::SetLabelColor(status_label, theme_provider_->UseGtkTheme() ?
550 NULL : &text_color); 550 NULL : &text_color);
551 gtk_label_set_text(GTK_LABEL(status_label), status_text.c_str()); 551 gtk_label_set_label(GTK_LABEL(status_label), status_text.c_str());
552 } 552 }
553 553
554 void DownloadItemGtk::UpdateDangerWarning() { 554 void DownloadItemGtk::UpdateDangerWarning() {
555 if (dangerous_prompt_) { 555 if (dangerous_prompt_) {
556 // We create |dangerous_warning| as a wide string so we can more easily 556 // We create |dangerous_warning| as a wide string so we can more easily
557 // calculate its length in characters. 557 // calculate its length in characters.
558 std::wstring dangerous_warning; 558 std::wstring dangerous_warning;
559 if (get_download()->is_extension_install()) { 559 if (get_download()->is_extension_install()) {
560 dangerous_warning = 560 dangerous_warning =
561 l10n_util::GetString(IDS_PROMPT_DANGEROUS_DOWNLOAD_EXTENSION); 561 l10n_util::GetString(IDS_PROMPT_DANGEROUS_DOWNLOAD_EXTENSION);
(...skipping 14 matching lines...) Expand all
576 // Set the warning icon. 576 // Set the warning icon.
577 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 577 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
578 GdkPixbuf* download_pixbuf = rb.GetPixbufNamed(IDR_WARNING); 578 GdkPixbuf* download_pixbuf = rb.GetPixbufNamed(IDR_WARNING);
579 gtk_image_set_from_pixbuf(GTK_IMAGE(dangerous_image_), download_pixbuf); 579 gtk_image_set_from_pixbuf(GTK_IMAGE(dangerous_image_), download_pixbuf);
580 580
581 GdkColor color = theme_provider_->GetGdkColor( 581 GdkColor color = theme_provider_->GetGdkColor(
582 BrowserThemeProvider::COLOR_BOOKMARK_TEXT); 582 BrowserThemeProvider::COLOR_BOOKMARK_TEXT);
583 gtk_util::SetLabelColor(dangerous_label_, &color); 583 gtk_util::SetLabelColor(dangerous_label_, &color);
584 } 584 }
585 585
586 gtk_label_set_text(GTK_LABEL(dangerous_label_), 586 gtk_label_set_label(GTK_LABEL(dangerous_label_),
587 WideToUTF8(dangerous_warning).c_str()); 587 WideToUTF8(dangerous_warning).c_str());
588 588
589 // Until we switch to vector graphics, force the font size. 589 // Until we switch to vector graphics, force the font size.
590 gtk_util::ForceFontSizePixels(dangerous_label_, kTextSize); 590 gtk_util::ForceFontSizePixels(dangerous_label_, kTextSize);
591 591
592 // Get the label width when displaying in one line, and reduce it to 60% to 592 // Get the label width when displaying in one line, and reduce it to 60% to
593 // wrap the label into two lines. 593 // wrap the label into two lines.
594 gtk_widget_set_size_request(dangerous_label_, -1, -1); 594 gtk_widget_set_size_request(dangerous_label_, -1, -1);
595 gtk_label_set_line_wrap(GTK_LABEL(dangerous_label_), FALSE); 595 gtk_label_set_line_wrap(GTK_LABEL(dangerous_label_), FALSE);
596 596
597 GtkRequisition req; 597 GtkRequisition req;
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 get_download()->manager()->DangerousDownloadValidated(get_download()); 855 get_download()->manager()->DangerousDownloadValidated(get_download());
856 } 856 }
857 857
858 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button) { 858 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button) {
859 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", 859 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download",
860 base::Time::Now() - creation_time_); 860 base::Time::Now() - creation_time_);
861 if (get_download()->state() == DownloadItem::IN_PROGRESS) 861 if (get_download()->state() == DownloadItem::IN_PROGRESS)
862 get_download()->Cancel(true); 862 get_download()->Cancel(true);
863 get_download()->Remove(true); 863 get_download()->Remove(true);
864 } 864 }
OLDNEW
« no previous file with comments | « no previous file | net/base/net_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698