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

Side by Side Diff: ui/views/button_drag_utils.cc

Issue 1461923002: Change name of NativeTheme::instance() to make it clear it's web only. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
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 "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/drag_utils.h" 8 #include "ui/base/dragdrop/drag_utils.h"
9 #include "ui/base/dragdrop/os_exchange_data.h" 9 #include "ui/base/dragdrop/os_exchange_data.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
(...skipping 29 matching lines...) Expand all
40 const base::string16& title, 40 const base::string16& title,
41 const gfx::ImageSkia& icon, 41 const gfx::ImageSkia& icon,
42 const gfx::Point* press_pt, 42 const gfx::Point* press_pt,
43 ui::OSExchangeData* data, 43 ui::OSExchangeData* data,
44 views::Widget* widget) { 44 views::Widget* widget) {
45 // Create a button to render the drag image for us. 45 // Create a button to render the drag image for us.
46 views::LabelButton button(NULL, 46 views::LabelButton button(NULL,
47 title.empty() ? base::UTF8ToUTF16(url.spec()) 47 title.empty() ? base::UTF8ToUTF16(url.spec())
48 : title); 48 : title);
49 button.SetTextSubpixelRenderingEnabled(false); 49 button.SetTextSubpixelRenderingEnabled(false);
50 const ui::NativeTheme* theme = 50 const ui::NativeTheme* theme = widget->GetNativeTheme();
51 widget ? widget->GetNativeTheme() : ui::NativeTheme::instance();
Evan Stade 2015/11/19 23:29:14 I looked at the call sites and I think |widget| is
52 button.SetTextColor(views::Button::STATE_NORMAL, 51 button.SetTextColor(views::Button::STATE_NORMAL,
53 theme->GetSystemColor(ui::NativeTheme::kColorId_LabelEnabledColor)); 52 theme->GetSystemColor(ui::NativeTheme::kColorId_LabelEnabledColor));
54 gfx::ShadowValues shadows( 53 gfx::ShadowValues shadows(
55 10, 54 10,
56 gfx::ShadowValue(gfx::Vector2d(0, 0), 1.0f, 55 gfx::ShadowValue(gfx::Vector2d(0, 0), 1.0f,
57 theme->GetSystemColor( 56 theme->GetSystemColor(
58 ui::NativeTheme::kColorId_LabelBackgroundColor))); 57 ui::NativeTheme::kColorId_LabelBackgroundColor)));
59 button.SetTextShadows(shadows); 58 button.SetTextShadows(shadows);
60 button.SetMaxSize(gfx::Size(kLinkDragImageMaxWidth, 0)); 59 button.SetMaxSize(gfx::Size(kLinkDragImageMaxWidth, 0));
61 if (icon.isNull()) { 60 if (icon.isNull()) {
(...skipping 13 matching lines...) Expand all
75 press_point = gfx::Vector2d(prefsize.width() / 2, prefsize.height() / 2); 74 press_point = gfx::Vector2d(prefsize.width() / 2, prefsize.height() / 2);
76 75
77 // Render the image. 76 // Render the image.
78 scoped_ptr<gfx::Canvas> canvas( 77 scoped_ptr<gfx::Canvas> canvas(
79 views::GetCanvasForDragImage(widget, prefsize)); 78 views::GetCanvasForDragImage(widget, prefsize));
80 button.Paint(ui::CanvasPainter(canvas.get(), 1.f).context()); 79 button.Paint(ui::CanvasPainter(canvas.get(), 1.f).context());
81 drag_utils::SetDragImageOnDataObject(*canvas, press_point, data); 80 drag_utils::SetDragImageOnDataObject(*canvas, press_point, data);
82 } 81 }
83 82
84 } // namespace button_drag_utils 83 } // namespace button_drag_utils
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698