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/ui/views/location_bar/content_setting_image_view.h" | 5 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 saved_insets_.left() + necessary_left_margin, | 176 saved_insets_.left() + necessary_left_margin, |
177 saved_insets_.bottom(), | 177 saved_insets_.bottom(), |
178 saved_insets_.right()); | 178 saved_insets_.right()); |
179 set_border(empty_border); | 179 set_border(empty_border); |
180 } | 180 } |
181 // Paint an icon with possibly non-empty left border. | 181 // Paint an icon with possibly non-empty left border. |
182 views::ImageView::Paint(canvas); | 182 views::ImageView::Paint(canvas); |
183 if (animation_in_progress_) { | 183 if (animation_in_progress_) { |
184 // Paint text to the right of the icon. | 184 // Paint text to the right of the icon. |
185 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 185 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
186 canvas->DrawStringInt(animated_text_, | 186 canvas->DrawStringInt(UTF16ToWideHack(animated_text_), |
187 rb.GetFont(ResourceBundle::MediumFont), SK_ColorBLACK, | 187 rb.GetFont(ResourceBundle::MediumFont), SK_ColorBLACK, |
188 GetImageBounds().right() + kTextMarginPixels, y(), | 188 GetImageBounds().right() + kTextMarginPixels, y(), |
189 width() - GetImageBounds().width(), height(), | 189 width() - GetImageBounds().width(), height(), |
190 gfx::Canvas::TEXT_ALIGN_LEFT | gfx::Canvas::TEXT_VALIGN_MIDDLE); | 190 gfx::Canvas::TEXT_ALIGN_LEFT | gfx::Canvas::TEXT_VALIGN_MIDDLE); |
191 } | 191 } |
192 } | 192 } |
193 | 193 |
194 void ContentSettingImageView::PaintBackground(gfx::Canvas* canvas) { | 194 void ContentSettingImageView::PaintBackground(gfx::Canvas* canvas) { |
195 if (!animation_in_progress_) { | 195 if (!animation_in_progress_) { |
196 views::ImageView::PaintBackground(canvas); | 196 views::ImageView::PaintBackground(canvas); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 } else if (state > (1.0 - kAnimatingFraction)) { | 235 } else if (state > (1.0 - kAnimatingFraction)) { |
236 visible_text_size_ = static_cast<int>(text_size_ * (1.0 - state) / | 236 visible_text_size_ = static_cast<int>(text_size_ * (1.0 - state) / |
237 kAnimatingFraction); | 237 kAnimatingFraction); |
238 } else { | 238 } else { |
239 visible_text_size_ = text_size_; | 239 visible_text_size_ = text_size_; |
240 } | 240 } |
241 parent_->Layout(); | 241 parent_->Layout(); |
242 parent_->SchedulePaint(); | 242 parent_->SchedulePaint(); |
243 } | 243 } |
244 | 244 |
OLD | NEW |