| 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/chromeos/setting_level_bubble.h" | 5 #include "chrome/browser/chromeos/setting_level_bubble.h" |
| 6 | 6 |
| 7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
| 8 | 8 |
| 9 #include "base/timer.h" | 9 #include "base/timer.h" |
| 10 #include "chrome/browser/browser_list.h" | 10 #include "chrome/browser/browser_list.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 view_->SetIcon(icon); | 108 view_->SetIcon(icon); |
| 109 } | 109 } |
| 110 if (animation_.is_animating()) | 110 if (animation_.is_animating()) |
| 111 animation_.End(); | 111 animation_.End(); |
| 112 animation_.Reset(); | 112 animation_.Reset(); |
| 113 animation_.Show(); | 113 animation_.Show(); |
| 114 timeout_timer_.Start(base::TimeDelta::FromSeconds(kBubbleShowTimeoutSec), | 114 timeout_timer_.Start(base::TimeDelta::FromSeconds(kBubbleShowTimeoutSec), |
| 115 this, &SettingLevelBubble::OnTimeout); | 115 this, &SettingLevelBubble::OnTimeout); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void SettingLevelBubble::OnTimeout() { | 118 void SettingLevelBubble::HideBubble() { |
| 119 if (bubble_) | 119 if (bubble_) |
| 120 bubble_->Close(); | 120 bubble_->Close(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void SettingLevelBubble::OnTimeout() { |
| 124 HideBubble(); |
| 125 } |
| 126 |
| 123 void SettingLevelBubble::InfoBubbleClosing(InfoBubble* info_bubble, bool) { | 127 void SettingLevelBubble::InfoBubbleClosing(InfoBubble* info_bubble, bool) { |
| 124 DCHECK(info_bubble == bubble_); | 128 DCHECK(info_bubble == bubble_); |
| 125 timeout_timer_.Stop(); | 129 timeout_timer_.Stop(); |
| 126 animation_.Stop(); | 130 animation_.Stop(); |
| 127 bubble_ = NULL; | 131 bubble_ = NULL; |
| 128 view_ = NULL; | 132 view_ = NULL; |
| 129 } | 133 } |
| 130 | 134 |
| 131 void SettingLevelBubble::AnimationEnded(const Animation* animation) { | 135 void SettingLevelBubble::AnimationEnded(const Animation* animation) { |
| 132 previous_percent_ = current_percent_; | 136 previous_percent_ = current_percent_; |
| 133 } | 137 } |
| 134 | 138 |
| 135 void SettingLevelBubble::AnimationProgressed(const Animation* animation) { | 139 void SettingLevelBubble::AnimationProgressed(const Animation* animation) { |
| 136 if (view_) { | 140 if (view_) { |
| 137 view_->Update( | 141 view_->Update( |
| 138 Tween::ValueBetween(animation->GetCurrentValue(), | 142 Tween::ValueBetween(animation->GetCurrentValue(), |
| 139 previous_percent_, | 143 previous_percent_, |
| 140 current_percent_)); | 144 current_percent_)); |
| 141 } | 145 } |
| 142 } | 146 } |
| 143 | 147 |
| 144 } // namespace chromeos | 148 } // namespace chromeos |
| OLD | NEW |