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

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

Issue 9109028: GTK: Another GTK deprecation patch. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: evanm fix Created 8 years, 11 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 | chrome/browser/ui/gtk/find_bar_gtk.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) 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/gtk/download/download_item_gtk.h" 5 #include "chrome/browser/ui/gtk/download/download_item_gtk.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 int border_width = gtk_container_get_border_width(GTK_CONTAINER(widget)); 708 int border_width = gtk_container_get_border_width(GTK_CONTAINER(widget));
709 int x = allocation.x + border_width; 709 int x = allocation.x + border_width;
710 int y = allocation.y + border_width; 710 int y = allocation.y + border_width;
711 int width = allocation.width - border_width * 2; 711 int width = allocation.width - border_width * 2;
712 int height = allocation.height - border_width * 2; 712 int height = allocation.height - border_width * 2;
713 713
714 if (IsDangerous()) { 714 if (IsDangerous()) {
715 // Draw a simple frame around the area when we're displaying the warning. 715 // Draw a simple frame around the area when we're displaying the warning.
716 gtk_paint_shadow(gtk_widget_get_style(widget), 716 gtk_paint_shadow(gtk_widget_get_style(widget),
717 gtk_widget_get_window(widget), 717 gtk_widget_get_window(widget),
718 static_cast<GtkStateType>(widget->state), 718 gtk_widget_get_state(widget),
719 static_cast<GtkShadowType>(GTK_SHADOW_OUT), 719 static_cast<GtkShadowType>(GTK_SHADOW_OUT),
720 &e->area, widget, "frame", 720 &e->area, widget, "frame",
721 x, y, width, height); 721 x, y, width, height);
722 } else { 722 } else {
723 // Manually draw the GTK button border around the download item. We draw 723 // Manually draw the GTK button border around the download item. We draw
724 // the left part of the button (the file), a divider, and then the right 724 // the left part of the button (the file), a divider, and then the right
725 // part of the button (the menu). We can't draw a button on top of each 725 // part of the button (the menu). We can't draw a button on top of each
726 // other (*cough*Clearlooks*cough*) so instead, to draw the left part of 726 // other (*cough*Clearlooks*cough*) so instead, to draw the left part of
727 // the button, we instruct GTK to draw the entire button...with a 727 // the button, we instruct GTK to draw the entire button...with a
728 // doctored clip rectangle to the left part of the button sans 728 // doctored clip rectangle to the left part of the button sans
729 // separator. We then repeat this for the right button. 729 // separator. We then repeat this for the right button.
730 GtkStyle* style = body_.get()->style; 730 GtkStyle* style = gtk_widget_get_style(body_.get());
731 731
732 GtkAllocation left_clip; 732 GtkAllocation left_clip;
733 gtk_widget_get_allocation(body_.get(), &left_clip); 733 gtk_widget_get_allocation(body_.get(), &left_clip);
734 734
735 GtkAllocation right_clip; 735 GtkAllocation right_clip;
736 gtk_widget_get_allocation(menu_button_, &right_clip); 736 gtk_widget_get_allocation(menu_button_, &right_clip);
737 737
738 GtkShadowType body_shadow = 738 GtkShadowType body_shadow =
739 GTK_BUTTON(body_.get())->depressed ? GTK_SHADOW_IN : GTK_SHADOW_OUT; 739 GTK_BUTTON(body_.get())->depressed ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
740 gtk_paint_box(style, 740 gtk_paint_box(style,
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 get_download()->DangerousDownloadValidated(); 896 get_download()->DangerousDownloadValidated();
897 } 897 }
898 898
899 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button) { 899 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button) {
900 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", 900 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download",
901 base::Time::Now() - creation_time_); 901 base::Time::Now() - creation_time_);
902 if (get_download()->IsPartialDownload()) 902 if (get_download()->IsPartialDownload())
903 get_download()->Cancel(true); 903 get_download()->Cancel(true);
904 get_download()->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); 904 get_download()->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD);
905 } 905 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/find_bar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698