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 "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 "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/themes/theme_properties.h" | 8 #include "chrome/browser/themes/theme_properties.h" |
9 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 9 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
10 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" | 10 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 SkColor ContentSettingImageView::GetTextColor() const { | 169 SkColor ContentSettingImageView::GetTextColor() const { |
170 return GetNativeTheme()->GetSystemColor( | 170 return GetNativeTheme()->GetSystemColor( |
171 ui::NativeTheme::kColorId_TextfieldDefaultColor); | 171 ui::NativeTheme::kColorId_TextfieldDefaultColor); |
172 } | 172 } |
173 | 173 |
174 SkColor ContentSettingImageView::GetBorderColor() const { | 174 SkColor ContentSettingImageView::GetBorderColor() const { |
175 return gfx::kGoogleYellow700; | 175 return gfx::kGoogleYellow700; |
176 } | 176 } |
177 | 177 |
178 bool ContentSettingImageView::ShouldShowBackground() const { | 178 bool ContentSettingImageView::ShouldShowBackground() const { |
179 return (!IsShrinking() || label()->width() > 0) && | 179 return (!IsShrinking() || |
| 180 (width() >= MinimumWidthForImageWithBackgroundShown())) && |
180 (slide_animator_.is_animating() || pause_animation_); | 181 (slide_animator_.is_animating() || pause_animation_); |
181 } | 182 } |
182 | 183 |
183 double ContentSettingImageView::WidthMultiplier() const { | 184 double ContentSettingImageView::WidthMultiplier() const { |
184 double state = pause_animation_ ? pause_animation_state_ | 185 double state = pause_animation_ ? pause_animation_state_ |
185 : slide_animator_.GetCurrentValue(); | 186 : slide_animator_.GetCurrentValue(); |
186 // The fraction of the animation we'll spend animating the string into view, | 187 // The fraction of the animation we'll spend animating the string into view, |
187 // which is also the fraction we'll spend animating it closed; total | 188 // which is also the fraction we'll spend animating it closed; total |
188 // animation (slide out, show, then slide in) is 1.0. | 189 // animation (slide out, show, then slide in) is 1.0. |
189 const double kOpenFraction = | 190 const double kOpenFraction = |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 bubble_view_->SetArrowPaintType(views::BubbleBorder::PAINT_TRANSPARENT); | 285 bubble_view_->SetArrowPaintType(views::BubbleBorder::PAINT_TRANSPARENT); |
285 } | 286 } |
286 bubble_widget->Show(); | 287 bubble_widget->Show(); |
287 } | 288 } |
288 } | 289 } |
289 | 290 |
290 void ContentSettingImageView::UpdateImage() { | 291 void ContentSettingImageView::UpdateImage() { |
291 SetImage(content_setting_image_model_->GetIcon(GetTextColor()).AsImageSkia()); | 292 SetImage(content_setting_image_model_->GetIcon(GetTextColor()).AsImageSkia()); |
292 image()->SetTooltipText(content_setting_image_model_->get_tooltip()); | 293 image()->SetTooltipText(content_setting_image_model_->get_tooltip()); |
293 } | 294 } |
OLD | NEW |