| 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/volume_bubble.h" | 5 #include "chrome/browser/chromeos/volume_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/chromeos/volume_bubble_view.h" | 10 #include "chrome/browser/chromeos/volume_bubble_view.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // volume change. This metric must be specific to the given | 76 // volume change. This metric must be specific to the given |
| 77 // architecture. crosbug.com/4028 | 77 // architecture. crosbug.com/4028 |
| 78 gfx::Rect bounds; | 78 gfx::Rect bounds; |
| 79 widget->GetBounds(&bounds, false); | 79 widget->GetBounds(&bounds, false); |
| 80 const gfx::Size view_size = view_->GetPreferredSize(); | 80 const gfx::Size view_size = view_->GetPreferredSize(); |
| 81 // Note that (x, y) is the point of the center of the bubble. | 81 // Note that (x, y) is the point of the center of the bubble. |
| 82 const int x = view_size.width() / 2 + | 82 const int x = view_size.width() / 2 + |
| 83 kVolumeBubbleXRatio * (bounds.width() - view_size.width()); | 83 kVolumeBubbleXRatio * (bounds.width() - view_size.width()); |
| 84 const int y = bounds.height() - view_size.height() / 2 - | 84 const int y = bounds.height() - view_size.height() / 2 - |
| 85 kVolumeBubbleBottomGap; | 85 kVolumeBubbleBottomGap; |
| 86 bubble_ = InfoBubble::Show(widget, gfx::Rect(x, y, 0, 20), | 86 bubble_ = InfoBubble::ShowFocusless(widget, gfx::Rect(x, y, 0, 20), |
| 87 BubbleBorder::FLOAT, view_, this); | 87 BubbleBorder::FLOAT, view_, this); |
| 88 } else { | 88 } else { |
| 89 DCHECK(view_); | 89 DCHECK(view_); |
| 90 timeout_timer_.Stop(); | 90 timeout_timer_.Stop(); |
| 91 } | 91 } |
| 92 if (animation_.is_animating()) | 92 if (animation_.is_animating()) |
| 93 animation_.End(); | 93 animation_.End(); |
| 94 animation_.Reset(); | 94 animation_.Reset(); |
| 95 animation_.Show(); | 95 animation_.Show(); |
| 96 timeout_timer_.Start(base::TimeDelta::FromSeconds(kBubbleShowTimeoutSec), | 96 timeout_timer_.Start(base::TimeDelta::FromSeconds(kBubbleShowTimeoutSec), |
| 97 this, &VolumeBubble::OnTimeout); | 97 this, &VolumeBubble::OnTimeout); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 117 void VolumeBubble::AnimationProgressed(const Animation* animation) { | 117 void VolumeBubble::AnimationProgressed(const Animation* animation) { |
| 118 if (view_) { | 118 if (view_) { |
| 119 view_->Update( | 119 view_->Update( |
| 120 Tween::ValueBetween(animation->GetCurrentValue(), | 120 Tween::ValueBetween(animation->GetCurrentValue(), |
| 121 previous_percent_, | 121 previous_percent_, |
| 122 current_percent_)); | 122 current_percent_)); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 | 125 |
| 126 } // namespace chromeos | 126 } // namespace chromeos |
| OLD | NEW |