OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/chromeos/login/oobe_progress_bar.h" | 5 #include "chrome/browser/chromeos/login/oobe_progress_bar.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/utf_string_conversions.h" |
10 #include "gfx/canvas_skia.h" | 11 #include "gfx/canvas_skia.h" |
11 #include "grit/theme_resources.h" | 12 #include "grit/theme_resources.h" |
12 #include "third_party/skia/include/core/SkBitmap.h" | 13 #include "third_party/skia/include/core/SkBitmap.h" |
13 | 14 |
14 namespace chromeos { | 15 namespace chromeos { |
15 | 16 |
16 // static | 17 // static |
17 SkBitmap* OobeProgressBar::dot_current_ = NULL; | 18 SkBitmap* OobeProgressBar::dot_current_ = NULL; |
18 SkBitmap* OobeProgressBar::dot_empty_ = NULL; | 19 SkBitmap* OobeProgressBar::dot_empty_ = NULL; |
19 SkBitmap* OobeProgressBar::dot_filled_ = NULL; | 20 SkBitmap* OobeProgressBar::dot_filled_ = NULL; |
(...skipping 83 matching lines...) Loading... |
103 | 104 |
104 if (i != steps_.size() - 1) | 105 if (i != steps_.size() - 1) |
105 canvas->DrawBitmapInt(*line_after, ix, y + line_offset_y); | 106 canvas->DrawBitmapInt(*line_after, ix, y + line_offset_y); |
106 ix += line_after->width(); | 107 ix += line_after->width(); |
107 | 108 |
108 if (i != steps_.size() - 1) { | 109 if (i != steps_.size() - 1) { |
109 canvas->TileImageInt(*line_, ix, y + line_offset_y, | 110 canvas->TileImageInt(*line_, ix, y + line_offset_y, |
110 next_x - ix, line_->height()); | 111 next_x - ix, line_->height()); |
111 } | 112 } |
112 | 113 |
113 std::wstring str = l10n_util::GetString(steps_[i]); | 114 std::wstring str = UTF16ToWide(l10n_util::GetStringUTF16(steps_[i])); |
114 canvas->DrawStringInt(str, font_, color, | 115 canvas->DrawStringInt(str, font_, color, |
115 x + kTextPadding, y + dot->height() + kTextPadding, | 116 x + kTextPadding, y + dot->height() + kTextPadding, |
116 (next_x - x - 2 * kTextPadding), | 117 (next_x - x - 2 * kTextPadding), |
117 (bounds.height() - dot->height() - 2 * kTextPadding), | 118 (bounds.height() - dot->height() - 2 * kTextPadding), |
118 gfx::Canvas::MULTI_LINE | gfx::Canvas::TEXT_ALIGN_CENTER | | 119 gfx::Canvas::MULTI_LINE | gfx::Canvas::TEXT_ALIGN_CENTER | |
119 gfx::Canvas::TEXT_VALIGN_TOP); | 120 gfx::Canvas::TEXT_VALIGN_TOP); |
120 | 121 |
121 x = next_x; | 122 x = next_x; |
122 } | 123 } |
123 } | 124 } |
124 | 125 |
125 void OobeProgressBar::OnLocaleChanged() { | 126 void OobeProgressBar::OnLocaleChanged() { |
126 SchedulePaint(); | 127 SchedulePaint(); |
127 } | 128 } |
128 | 129 |
129 void OobeProgressBar::SetStep(int step) { | 130 void OobeProgressBar::SetStep(int step) { |
130 for (size_t i = 0; i < steps_.size(); ++i) { | 131 for (size_t i = 0; i < steps_.size(); ++i) { |
131 if (steps_[i] == step) { | 132 if (steps_[i] == step) { |
132 progress_ = i; | 133 progress_ = i; |
133 SchedulePaint(); | 134 SchedulePaint(); |
134 return; | 135 return; |
135 } | 136 } |
136 } | 137 } |
137 NOTREACHED(); | 138 NOTREACHED(); |
138 } | 139 } |
139 | 140 |
140 } // namespace chromeos | 141 } // namespace chromeos |
OLD | NEW |