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/controls/progress_bar.h" | 5 #include "ui/views/controls/progress_bar.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
161 current_value_ = value; | 161 current_value_ = value; |
162 SchedulePaint(); | 162 SchedulePaint(); |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
166 void ProgressBar::SetTooltipText(const string16& tooltip_text) { | 166 void ProgressBar::SetTooltipText(const string16& tooltip_text) { |
167 tooltip_text_ = tooltip_text; | 167 tooltip_text_ = tooltip_text; |
168 } | 168 } |
169 | 169 |
170 bool ProgressBar::GetTooltipText(const gfx::Point& p, string16* tooltip) const { | 170 bool ProgressBar::GetTooltipText(const gfx::Point& p, string16* tooltip) const { |
171 DCHECK(tooltip); | 171 if (tooltip_text_.empty()) |
Peter Kasting
2012/10/15 19:03:10
Why remove this?
|
Peter Kasting
2012/10/15 19:03:10
This is a behavior change: the old code still assi
tfarina
2012/10/15 19:15:49
The impact would be minimal, ProgressBar control i
Peter Kasting
2012/10/15 19:19:54
As long as the callers work fine with the behavior
|
172 if (tooltip == NULL) | |
173 return false; | 172 return false; |
174 tooltip->assign(tooltip_text_); | 173 |
175 return !tooltip_text_.empty(); | 174 *tooltip = tooltip_text_; |
175 return true; | |
176 } | 176 } |
177 | 177 |
178 void ProgressBar::GetAccessibleState(ui::AccessibleViewState* state) { | 178 void ProgressBar::GetAccessibleState(ui::AccessibleViewState* state) { |
179 state->role = ui::AccessibilityTypes::ROLE_PROGRESSBAR; | 179 state->role = ui::AccessibilityTypes::ROLE_PROGRESSBAR; |
180 state->state = ui::AccessibilityTypes::STATE_READONLY; | 180 state->state = ui::AccessibilityTypes::STATE_READONLY; |
181 } | 181 } |
182 | 182 |
183 gfx::Size ProgressBar::GetPreferredSize() { | 183 gfx::Size ProgressBar::GetPreferredSize() { |
184 return gfx::Size(100, 16); | 184 return gfx::Size(100, 16); |
185 } | 185 } |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
295 if (progress_width > 1) { | 295 if (progress_width > 1) { |
296 FillRoundRect(canvas, 0, 0, progress_width, height(), kCornerRadius, | 296 FillRoundRect(canvas, 0, 0, progress_width, height(), kCornerRadius, |
297 kBarColorStart, kBarColorEnd, false); | 297 kBarColorStart, kBarColorEnd, false); |
298 } | 298 } |
299 StrokeRoundRect(canvas, 0, 0, width(), height(), kCornerRadius, | 299 StrokeRoundRect(canvas, 0, 0, width(), height(), kCornerRadius, |
300 kBorderColor, kBorderWidth); | 300 kBorderColor, kBorderWidth); |
301 #endif | 301 #endif |
302 } | 302 } |
303 | 303 |
304 } // namespace views | 304 } // namespace views |
OLD | NEW |