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

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

Issue 660063: Move skia_utils_gtk.cc/.h to app/gfx/ directory. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: fixes comments Created 10 years, 9 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
« no previous file with comments | « chrome/browser/gtk/browser_window_gtk.cc ('k') | chrome/browser/gtk/gtk_theme_provider.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/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/gfx/canvas_paint.h" 8 #include "app/gfx/canvas_paint.h"
9 #include "app/gfx/color_utils.h" 9 #include "app/gfx/color_utils.h"
10 #include "app/gfx/font.h" 10 #include "app/gfx/font.h"
11 #include "app/gfx/skia_utils_gtk.h"
11 #include "app/gfx/text_elider.h" 12 #include "app/gfx/text_elider.h"
12 #include "app/menus/simple_menu_model.h" 13 #include "app/menus/simple_menu_model.h"
13 #include "app/resource_bundle.h" 14 #include "app/resource_bundle.h"
14 #include "app/slide_animation.h" 15 #include "app/slide_animation.h"
15 #include "base/basictypes.h" 16 #include "base/basictypes.h"
16 #include "base/callback.h" 17 #include "base/callback.h"
17 #include "base/string_util.h" 18 #include "base/string_util.h"
18 #include "base/time.h" 19 #include "base/time.h"
19 #include "chrome/browser/browser.h" 20 #include "chrome/browser/browser.h"
20 #include "chrome/browser/browser_process.h" 21 #include "chrome/browser/browser_process.h"
21 #include "chrome/browser/download/download_item_model.h" 22 #include "chrome/browser/download/download_item_model.h"
22 #include "chrome/browser/download/download_manager.h" 23 #include "chrome/browser/download/download_manager.h"
23 #include "chrome/browser/download/download_shelf.h" 24 #include "chrome/browser/download/download_shelf.h"
24 #include "chrome/browser/download/download_util.h" 25 #include "chrome/browser/download/download_util.h"
25 #include "chrome/browser/gtk/download_item_drag.h" 26 #include "chrome/browser/gtk/download_item_drag.h"
26 #include "chrome/browser/gtk/download_shelf_gtk.h" 27 #include "chrome/browser/gtk/download_shelf_gtk.h"
27 #include "chrome/browser/gtk/gtk_theme_provider.h" 28 #include "chrome/browser/gtk/gtk_theme_provider.h"
28 #include "chrome/browser/gtk/menu_gtk.h" 29 #include "chrome/browser/gtk/menu_gtk.h"
29 #include "chrome/browser/gtk/nine_box.h" 30 #include "chrome/browser/gtk/nine_box.h"
30 #include "chrome/browser/gtk/standard_menus.h" 31 #include "chrome/browser/gtk/standard_menus.h"
31 #include "chrome/common/gtk_util.h" 32 #include "chrome/common/gtk_util.h"
32 #include "chrome/common/notification_service.h" 33 #include "chrome/common/notification_service.h"
33 #include "grit/generated_resources.h" 34 #include "grit/generated_resources.h"
34 #include "grit/theme_resources.h" 35 #include "grit/theme_resources.h"
35 #include "skia/ext/skia_utils_gtk.h"
36 #include "third_party/skia/include/core/SkBitmap.h" 36 #include "third_party/skia/include/core/SkBitmap.h"
37 37
38 namespace { 38 namespace {
39 39
40 // The width of the |menu_button_| widget. It has to be at least as wide as the 40 // The width of the |menu_button_| widget. It has to be at least as wide as the
41 // bitmap that we use to draw it, i.e. 16, but can be more. 41 // bitmap that we use to draw it, i.e. 16, but can be more.
42 const int kMenuButtonWidth = 16; 42 const int kMenuButtonWidth = 16;
43 43
44 // Padding on left and right of items in dangerous download prompt. 44 // Padding on left and right of items in dangerous download prompt.
45 const int kDangerousElementPadding = 3; 45 const int kDangerousElementPadding = 3;
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 SkColorGetR(color)), 532 SkColorGetR(color)),
533 static_cast<int>(kDownloadItemLuminanceMod * 533 static_cast<int>(kDownloadItemLuminanceMod *
534 SkColorGetG(color)), 534 SkColorGetG(color)),
535 static_cast<int>(kDownloadItemLuminanceMod * 535 static_cast<int>(kDownloadItemLuminanceMod *
536 SkColorGetB(color))); 536 SkColorGetB(color)));
537 } 537 }
538 538
539 // Lighten the color by blending it with the download item body color. These 539 // Lighten the color by blending it with the download item body color. These
540 // values are taken from IDR_DOWNLOAD_BUTTON. 540 // values are taken from IDR_DOWNLOAD_BUTTON.
541 SkColor blend_color = SkColorSetRGB(241, 245, 250); 541 SkColor blend_color = SkColorSetRGB(241, 245, 250);
542 text_color = skia::SkColorToGdkColor( 542 text_color = gfx::SkColorToGdkColor(
543 color_utils::AlphaBlend(blend_color, color, 77)); 543 color_utils::AlphaBlend(blend_color, color, 77));
544 } 544 }
545 545
546 gtk_util::SetLabelColor(status_label, theme_provider_->UseGtkTheme() ? 546 gtk_util::SetLabelColor(status_label, theme_provider_->UseGtkTheme() ?
547 NULL : &text_color); 547 NULL : &text_color);
548 gtk_label_set_label(GTK_LABEL(status_label), status_text.c_str()); 548 gtk_label_set_label(GTK_LABEL(status_label), status_text.c_str());
549 } 549 }
550 550
551 void DownloadItemGtk::UpdateDangerWarning() { 551 void DownloadItemGtk::UpdateDangerWarning() {
552 if (dangerous_prompt_) { 552 if (dangerous_prompt_) {
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 884
885 // static 885 // static
886 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button, 886 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button,
887 DownloadItemGtk* item) { 887 DownloadItemGtk* item) {
888 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", 888 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download",
889 base::Time::Now() - item->creation_time_); 889 base::Time::Now() - item->creation_time_);
890 if (item->get_download()->state() == DownloadItem::IN_PROGRESS) 890 if (item->get_download()->state() == DownloadItem::IN_PROGRESS)
891 item->get_download()->Cancel(true); 891 item->get_download()->Cancel(true);
892 item->get_download()->Remove(true); 892 item->get_download()->Remove(true);
893 } 893 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/browser_window_gtk.cc ('k') | chrome/browser/gtk/gtk_theme_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698