| 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/status_bubble_views.h" | 5 #include "chrome/browser/ui/views/status_bubble_views.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 void OnTimer(); | 161 void OnTimer(); |
| 162 void CancelTimer(); | 162 void CancelTimer(); |
| 163 void RestartTimer(base::TimeDelta delay); | 163 void RestartTimer(base::TimeDelta delay); |
| 164 | 164 |
| 165 // Manage the fades and starting and stopping the animations correctly. | 165 // Manage the fades and starting and stopping the animations correctly. |
| 166 void StartFade(double start, double end, int duration); | 166 void StartFade(double start, double end, int duration); |
| 167 void StartHiding(); | 167 void StartHiding(); |
| 168 void StartShowing(); | 168 void StartShowing(); |
| 169 | 169 |
| 170 // views::View: | 170 // views::View: |
| 171 const char* GetClassName() const override; |
| 171 void OnPaint(gfx::Canvas* canvas) override; | 172 void OnPaint(gfx::Canvas* canvas) override; |
| 172 | 173 |
| 173 BubbleState state_; | 174 BubbleState state_; |
| 174 BubbleStyle style_; | 175 BubbleStyle style_; |
| 175 | 176 |
| 176 scoped_ptr<StatusViewAnimation> animation_; | 177 scoped_ptr<StatusViewAnimation> animation_; |
| 177 | 178 |
| 178 // Handle to the widget that contains us. | 179 // Handle to the widget that contains us. |
| 179 views::Widget* popup_; | 180 views::Widget* popup_; |
| 180 | 181 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 | 344 |
| 344 void StatusBubbleViews::StatusView::OnAnimationEnded() { | 345 void StatusBubbleViews::StatusView::OnAnimationEnded() { |
| 345 if (state_ == BUBBLE_HIDING_FADE) { | 346 if (state_ == BUBBLE_HIDING_FADE) { |
| 346 state_ = BUBBLE_HIDDEN; | 347 state_ = BUBBLE_HIDDEN; |
| 347 popup_->Hide(); | 348 popup_->Hide(); |
| 348 } else if (state_ == BUBBLE_SHOWING_FADE) { | 349 } else if (state_ == BUBBLE_SHOWING_FADE) { |
| 349 state_ = BUBBLE_SHOWN; | 350 state_ = BUBBLE_SHOWN; |
| 350 } | 351 } |
| 351 } | 352 } |
| 352 | 353 |
| 354 const char* StatusBubbleViews::StatusView::GetClassName() const { |
| 355 return "StatusBubbleViews::StatusView"; |
| 356 } |
| 357 |
| 353 void StatusBubbleViews::StatusView::OnPaint(gfx::Canvas* canvas) { | 358 void StatusBubbleViews::StatusView::OnPaint(gfx::Canvas* canvas) { |
| 354 SkPaint paint; | 359 SkPaint paint; |
| 355 paint.setStyle(SkPaint::kFill_Style); | 360 paint.setStyle(SkPaint::kFill_Style); |
| 356 paint.setAntiAlias(true); | 361 paint.setAntiAlias(true); |
| 357 SkColor toolbar_color = theme_service_->GetColor( | 362 SkColor toolbar_color = theme_service_->GetColor( |
| 358 ThemeProperties::COLOR_TOOLBAR); | 363 ThemeProperties::COLOR_TOOLBAR); |
| 359 paint.setColor(toolbar_color); | 364 paint.setColor(toolbar_color); |
| 360 | 365 |
| 361 gfx::Rect popup_bounds = popup_->GetWindowBoundsInScreen(); | 366 gfx::Rect popup_bounds = popup_->GetWindowBoundsInScreen(); |
| 362 | 367 |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 void StatusBubbleViews::SetBubbleWidth(int width) { | 872 void StatusBubbleViews::SetBubbleWidth(int width) { |
| 868 size_.set_width(width); | 873 size_.set_width(width); |
| 869 SetBounds(original_position_.x(), original_position_.y(), | 874 SetBounds(original_position_.x(), original_position_.y(), |
| 870 size_.width(), size_.height()); | 875 size_.width(), size_.height()); |
| 871 } | 876 } |
| 872 | 877 |
| 873 void StatusBubbleViews::CancelExpandTimer() { | 878 void StatusBubbleViews::CancelExpandTimer() { |
| 874 if (expand_timer_factory_.HasWeakPtrs()) | 879 if (expand_timer_factory_.HasWeakPtrs()) |
| 875 expand_timer_factory_.InvalidateWeakPtrs(); | 880 expand_timer_factory_.InvalidateWeakPtrs(); |
| 876 } | 881 } |
| OLD | NEW |