| OLD | NEW |
| 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 "ui/views/button_drag_utils.h" | 5 #include "ui/views/button_drag_utils.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "ui/base/dragdrop/os_exchange_data.h" | 8 #include "ui/base/dragdrop/os_exchange_data.h" |
| 9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
| 10 #include "ui/compositor/canvas_painter.h" | 10 #include "ui/compositor/canvas_painter.h" |
| 11 #include "ui/gfx/canvas.h" | 11 #include "ui/gfx/canvas.h" |
| 12 #include "ui/gfx/geometry/point.h" | 12 #include "ui/gfx/geometry/point.h" |
| 13 #include "ui/gfx/geometry/vector2d.h" | 13 #include "ui/gfx/geometry/vector2d.h" |
| 14 #include "ui/gfx/image/image.h" | 14 #include "ui/gfx/image/image.h" |
| 15 #include "ui/resources/grit/ui_resources.h" | 15 #include "ui/resources/grit/ui_resources.h" |
| 16 #include "ui/views/background.h" | 16 #include "ui/views/background.h" |
| 17 #include "ui/views/border.h" | 17 #include "ui/views/border.h" |
| 18 #include "ui/views/controls/button/label_button.h" | 18 #include "ui/views/controls/button/label_button.h" |
| 19 #include "ui/views/controls/button/label_button_border.h" | 19 #include "ui/views/controls/button/label_button_border.h" |
| 20 #include "ui/views/drag_utils.h" | 20 #include "ui/views/drag_utils.h" |
| 21 #include "ui/views/resources/grit/views_resources.h" | |
| 22 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
| 23 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 24 | 23 |
| 25 namespace button_drag_utils { | 24 namespace button_drag_utils { |
| 26 | 25 |
| 27 // Maximum width of the link drag image in pixels. | 26 // Maximum width of the link drag image in pixels. |
| 28 static const int kLinkDragImageMaxWidth = 150; | 27 static const int kLinkDragImageMaxWidth = 150; |
| 29 | 28 |
| 30 void SetURLAndDragImage(const GURL& url, | 29 void SetURLAndDragImage(const GURL& url, |
| 31 const base::string16& title, | 30 const base::string16& title, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 82 |
| 84 SkBitmap bitmap; | 83 SkBitmap bitmap; |
| 85 float raster_scale = ScaleFactorForDragFromWidget(&widget); | 84 float raster_scale = ScaleFactorForDragFromWidget(&widget); |
| 86 SkColor color = SK_ColorTRANSPARENT; | 85 SkColor color = SK_ColorTRANSPARENT; |
| 87 button.Paint(ui::CanvasPainter(&bitmap, size, raster_scale, color).context()); | 86 button.Paint(ui::CanvasPainter(&bitmap, size, raster_scale, color).context()); |
| 88 gfx::ImageSkia image(gfx::ImageSkiaRep(bitmap, raster_scale)); | 87 gfx::ImageSkia image(gfx::ImageSkiaRep(bitmap, raster_scale)); |
| 89 data->provider().SetDragImage(image, press_point); | 88 data->provider().SetDragImage(image, press_point); |
| 90 } | 89 } |
| 91 | 90 |
| 92 } // namespace button_drag_utils | 91 } // namespace button_drag_utils |
| OLD | NEW |