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

Side by Side Diff: chrome/browser/ui/views/toolbar/wrench_toolbar_button.cc

Issue 1406613002: For some vector icons, get the size from the vector definition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/views/toolbar/wrench_toolbar_button.h" 5 #include "chrome/browser/ui/views/toolbar/wrench_toolbar_button.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 color = gfx::kGoogleGreen700; 132 color = gfx::kGoogleGreen700;
133 break; 133 break;
134 case WrenchIconPainter::SEVERITY_MEDIUM: 134 case WrenchIconPainter::SEVERITY_MEDIUM:
135 color = gfx::kGoogleYellow700; 135 color = gfx::kGoogleYellow700;
136 break; 136 break;
137 case WrenchIconPainter::SEVERITY_HIGH: 137 case WrenchIconPainter::SEVERITY_HIGH:
138 color = gfx::kGoogleRed700; 138 color = gfx::kGoogleRed700;
139 break; 139 break;
140 } 140 }
141 141
142 // TODO(estade): find a home for this constant. 142 SetImage(
143 const int kButtonSize = 16; 143 views::Button::STATE_NORMAL,
144 SetImage(views::Button::STATE_NORMAL, 144 gfx::CreatePrimaryVectorIcon(gfx::VectorIconId::BROWSER_TOOLS, color));
145 gfx::CreateVectorIcon(gfx::VectorIconId::BROWSER_TOOLS, kButtonSize,
146 color));
147 } 145 }
148 146
149 const char* WrenchToolbarButton::GetClassName() const { 147 const char* WrenchToolbarButton::GetClassName() const {
150 return "WrenchToolbarButton"; 148 return "WrenchToolbarButton";
151 } 149 }
152 150
153 bool WrenchToolbarButton::GetDropFormats( 151 bool WrenchToolbarButton::GetDropFormats(
154 int* formats, 152 int* formats,
155 std::set<ui::Clipboard::FormatType>* format_types) { 153 std::set<ui::Clipboard::FormatType>* format_types) {
156 return allow_extension_dragging_ ? 154 return allow_extension_dragging_ ?
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 197
200 void WrenchToolbarButton::OnPaint(gfx::Canvas* canvas) { 198 void WrenchToolbarButton::OnPaint(gfx::Canvas* canvas) {
201 views::MenuButton::OnPaint(canvas); 199 views::MenuButton::OnPaint(canvas);
202 if (ui::MaterialDesignController::IsModeMaterial()) 200 if (ui::MaterialDesignController::IsModeMaterial())
203 return; 201 return;
204 wrench_icon_painter_->Paint(canvas, 202 wrench_icon_painter_->Paint(canvas,
205 GetThemeProvider(), 203 GetThemeProvider(),
206 gfx::Rect(size()), 204 gfx::Rect(size()),
207 WrenchIconPainter::BEZEL_NONE); 205 WrenchIconPainter::BEZEL_NONE);
208 } 206 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698