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 10 matching lines...) Expand all Loading... |
21 #include "ui/views/controls/label.h" | 21 #include "ui/views/controls/label.h" |
22 #include "ui/views/widget/widget.h" | 22 #include "ui/views/widget/widget.h" |
23 | 23 |
24 namespace { | 24 namespace { |
25 // Time spent with animation fully open. | 25 // Time spent with animation fully open. |
26 const int kStayOpenTimeMS = 3200; | 26 const int kStayOpenTimeMS = 3200; |
27 } | 27 } |
28 | 28 |
29 | 29 |
30 // static | 30 // static |
31 const int ContentSettingImageView::kOpenTimeMS = 150; | |
32 const int ContentSettingImageView::kAnimationDurationMS = | 31 const int ContentSettingImageView::kAnimationDurationMS = |
33 (kOpenTimeMS * 2) + kStayOpenTimeMS; | 32 (IconLabelBubbleView::kOpenTimeMS * 2) + kStayOpenTimeMS; |
34 | 33 |
35 ContentSettingImageView::ContentSettingImageView( | 34 ContentSettingImageView::ContentSettingImageView( |
36 ContentSettingImageModel* image_model, | 35 ContentSettingImageModel* image_model, |
37 LocationBarView* parent, | 36 LocationBarView* parent, |
38 const gfx::FontList& font_list, | 37 const gfx::FontList& font_list, |
39 SkColor parent_background_color) | 38 SkColor parent_background_color) |
40 : IconLabelBubbleView(0, font_list, parent_background_color, false), | 39 : IconLabelBubbleView(0, font_list, parent_background_color, false), |
41 parent_(parent), | 40 parent_(parent), |
42 content_setting_image_model_(image_model), | 41 content_setting_image_model_(image_model), |
43 slide_animator_(this), | 42 slide_animator_(this), |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 bool visible) { | 281 bool visible) { |
283 // |widget| is a bubble that has just got shown / hidden. | 282 // |widget| is a bubble that has just got shown / hidden. |
284 if (!visible && !label()->visible()) | 283 if (!visible && !label()->visible()) |
285 AnimateInkDrop(views::InkDropState::DEACTIVATED, nullptr /* event */); | 284 AnimateInkDrop(views::InkDropState::DEACTIVATED, nullptr /* event */); |
286 } | 285 } |
287 | 286 |
288 void ContentSettingImageView::UpdateImage() { | 287 void ContentSettingImageView::UpdateImage() { |
289 SetImage(content_setting_image_model_->GetIcon(GetTextColor()).AsImageSkia()); | 288 SetImage(content_setting_image_model_->GetIcon(GetTextColor()).AsImageSkia()); |
290 image()->SetTooltipText(content_setting_image_model_->get_tooltip()); | 289 image()->SetTooltipText(content_setting_image_model_->get_tooltip()); |
291 } | 290 } |
OLD | NEW |