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

Unified Diff: ui/views/button_drag_utils.cc

Issue 2750253002: Reland 4e4eae4cbe6136b538a: Make download item drags look like bookmark (Closed)
Patch Set: with fix Created 3 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/button_drag_utils.cc
diff --git a/ui/views/button_drag_utils.cc b/ui/views/button_drag_utils.cc
index 5eaf6db6720bd5996bd65043c7143510cc879855..c3bf393665994c88fb0912d92cc18120ac01859c 100644
--- a/ui/views/button_drag_utils.cc
+++ b/ui/views/button_drag_utils.cc
@@ -32,31 +32,32 @@ void SetURLAndDragImage(const GURL& url,
const base::string16& title,
const gfx::ImageSkia& icon,
const gfx::Point* press_pt,
- ui::OSExchangeData* data,
- views::Widget* widget) {
- DCHECK(url.is_valid() && data);
+ const views::Widget& widget,
+ ui::OSExchangeData* data) {
+ DCHECK(url.is_valid());
+ DCHECK(data);
data->SetURL(url, title);
- SetDragImage(url, title, icon, press_pt, data, widget);
+ SetDragImage(url, title, icon, press_pt, widget, data);
}
void SetDragImage(const GURL& url,
const base::string16& title,
const gfx::ImageSkia& icon,
const gfx::Point* press_pt,
- ui::OSExchangeData* data,
- views::Widget* widget) {
+ const views::Widget& widget,
+ ui::OSExchangeData* data) {
// Create a button to render the drag image for us.
views::LabelButton button(NULL,
title.empty() ? base::UTF8ToUTF16(url.spec())
: title);
button.SetTextSubpixelRenderingEnabled(false);
- const ui::NativeTheme* theme = widget->GetNativeTheme();
+ const ui::NativeTheme* theme = widget.GetNativeTheme();
button.SetTextColor(views::Button::STATE_NORMAL,
theme->GetSystemColor(ui::NativeTheme::kColorId_TextfieldDefaultColor));
SkColor bg_color = theme->GetSystemColor(
ui::NativeTheme::kColorId_TextfieldDefaultBackground);
- if (widget->IsTranslucentWindowOpacitySupported()) {
+ if (widget.IsTranslucentWindowOpacitySupported()) {
button.SetTextShadows(gfx::ShadowValues(
10, gfx::ShadowValue(gfx::Vector2d(0, 0), 2.0f, bg_color)));
} else {
@@ -82,7 +83,7 @@ void SetDragImage(const GURL& url,
press_point = gfx::Vector2d(size.width() / 2, size.height() / 2);
SkBitmap bitmap;
- float raster_scale = ScaleFactorForDragFromWidget(widget);
+ float raster_scale = ScaleFactorForDragFromWidget(&widget);
SkColor color = SK_ColorTRANSPARENT;
button.Paint(ui::CanvasPainter(&bitmap, size, raster_scale, color).context());
gfx::ImageSkia image(gfx::ImageSkiaRep(bitmap, raster_scale));

Powered by Google App Engine
This is Rietveld 408576698