OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/views/location_bar/location_bar_view.h" | 8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
9 #include "gfx/canvas.h" | 9 #include "gfx/canvas.h" |
10 #include "gfx/color_utils.h" | 10 #include "gfx/color_utils.h" |
11 #include "ui/base/animation/multi_animation.h" | 11 #include "ui/base/animation/multi_animation.h" |
12 | 12 |
13 SuggestedTextView::SuggestedTextView(LocationBarView* location_bar) | 13 SuggestedTextView::SuggestedTextView(LocationBarView* location_bar) |
14 : location_bar_(location_bar), | 14 : location_bar_(location_bar), |
15 bg_color_(0) { | 15 bg_color_(0) { |
16 } | 16 } |
17 | 17 |
18 SuggestedTextView::~SuggestedTextView() { | 18 SuggestedTextView::~SuggestedTextView() { |
19 } | 19 } |
20 | 20 |
21 void SuggestedTextView::StartAnimation() { | 21 void SuggestedTextView::StartAnimation() { |
22 if (!InstantController::IsEnabled(location_bar_->profile(), | |
23 InstantController::PREDICTIVE_TYPE)) { | |
24 return; | |
25 } | |
26 StopAnimation(); | 22 StopAnimation(); |
27 | 23 |
28 animation_.reset(CreateAnimation()); | 24 animation_.reset(CreateAnimation()); |
29 animation_->Start(); | 25 animation_->Start(); |
30 UpdateBackgroundColor(); | 26 UpdateBackgroundColor(); |
31 } | 27 } |
32 | 28 |
33 void SuggestedTextView::StopAnimation() { | 29 void SuggestedTextView::StopAnimation() { |
34 if (animation_.get()) { | 30 if (animation_.get()) { |
35 // Reset the delegate so that we don't attempt to commit in AnimationEnded. | 31 // Reset the delegate so that we don't attempt to commit in AnimationEnded. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 #if defined(OS_WIN) | 90 #if defined(OS_WIN) |
95 SkColor s_color = color_utils::GetSysSkColor(COLOR_HIGHLIGHT); | 91 SkColor s_color = color_utils::GetSysSkColor(COLOR_HIGHLIGHT); |
96 #else | 92 #else |
97 // TODO(sky): fix me. | 93 // TODO(sky): fix me. |
98 NOTIMPLEMENTED(); | 94 NOTIMPLEMENTED(); |
99 SkColor s_color = SK_ColorLTGRAY; | 95 SkColor s_color = SK_ColorLTGRAY; |
100 #endif | 96 #endif |
101 bg_color_ = color_utils::AlphaBlend(s_color, bg_color, | 97 bg_color_ = color_utils::AlphaBlend(s_color, bg_color, |
102 ui::Tween::ValueBetween(value, 0, 255)); | 98 ui::Tween::ValueBetween(value, 0, 255)); |
103 } | 99 } |
OLD | NEW |