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/suggested_text_view.h" | 5 #include "chrome/browser/ui/views/location_bar/suggested_text_view.h" |
6 | 6 |
7 #include "chrome/browser/instant/instant_controller.h" | 7 #include "chrome/browser/instant/instant_controller.h" |
8 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" | 8 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" |
9 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 9 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
10 #include "ui/base/animation/multi_animation.h" | 10 #include "ui/base/animation/multi_animation.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 void SuggestedTextView::AnimationCanceled(const ui::Animation* animation) { | 70 void SuggestedTextView::AnimationCanceled(const ui::Animation* animation) { |
71 } | 71 } |
72 | 72 |
73 ui::Animation* SuggestedTextView::CreateAnimation() { | 73 ui::Animation* SuggestedTextView::CreateAnimation() { |
74 ui::MultiAnimation::Parts parts; | 74 ui::MultiAnimation::Parts parts; |
75 parts.push_back(ui::MultiAnimation::Part( | 75 parts.push_back(ui::MultiAnimation::Part( |
76 InstantController::kInlineAutocompletePauseTimeMS, ui::Tween::ZERO)); | 76 InstantController::kInlineAutocompletePauseTimeMS, ui::Tween::ZERO)); |
77 parts.push_back(ui::MultiAnimation::Part( | 77 parts.push_back(ui::MultiAnimation::Part( |
78 InstantController::kInlineAutocompleteFadeInTimeMS, ui::Tween::EASE_IN)); | 78 InstantController::kInlineAutocompleteFadeInTimeMS, ui::Tween::EASE_IN)); |
79 ui::MultiAnimation* animation = new ui::MultiAnimation(parts); | 79 ui::MultiAnimation* animation = new ui::MultiAnimation( |
| 80 parts, ui::MultiAnimation::GetDefaultTimerInterval()); |
80 animation->set_delegate(this); | 81 animation->set_delegate(this); |
81 animation->set_continuous(false); | 82 animation->set_continuous(false); |
82 return animation; | 83 return animation; |
83 } | 84 } |
84 | 85 |
85 void SuggestedTextView::UpdateBackgroundColor() { | 86 void SuggestedTextView::UpdateBackgroundColor() { |
86 if (!animation_.get()) { | 87 if (!animation_.get()) { |
87 // Background only painted while animating. | 88 // Background only painted while animating. |
88 return; | 89 return; |
89 } | 90 } |
90 | 91 |
91 double value = animation_->GetCurrentValue(); | 92 double value = animation_->GetCurrentValue(); |
92 SkColor bg_color = LocationBarView::GetColor(ToolbarModel::NONE, | 93 SkColor bg_color = LocationBarView::GetColor(ToolbarModel::NONE, |
93 LocationBarView::BACKGROUND); | 94 LocationBarView::BACKGROUND); |
94 #if defined(OS_WIN) | 95 #if defined(OS_WIN) |
95 SkColor s_color = color_utils::GetSysSkColor(COLOR_HIGHLIGHT); | 96 SkColor s_color = color_utils::GetSysSkColor(COLOR_HIGHLIGHT); |
96 #else | 97 #else |
97 // TODO(sky): fix me. | 98 // TODO(sky): fix me. |
98 NOTIMPLEMENTED(); | 99 NOTIMPLEMENTED(); |
99 SkColor s_color = SK_ColorLTGRAY; | 100 SkColor s_color = SK_ColorLTGRAY; |
100 #endif | 101 #endif |
101 bg_color_ = color_utils::AlphaBlend(s_color, bg_color, | 102 bg_color_ = color_utils::AlphaBlend(s_color, bg_color, |
102 ui::Tween::ValueBetween(value, 0, 255)); | 103 ui::Tween::ValueBetween(value, 0, 255)); |
103 } | 104 } |
OLD | NEW |