| 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/gtk/throbber_gtk.h" | 5 #include "chrome/browser/ui/gtk/throbber_gtk.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/ui/gtk/theme_service_gtk.h" | 8 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 9 #include "chrome/common/chrome_notification_types.h" | 9 #include "chrome/common/chrome_notification_types.h" |
| 10 #include "content/public/browser/notification_source.h" | 10 #include "content/public/browser/notification_source.h" |
| 11 #include "grit/ui_resources.h" | 11 #include "grit/ui_resources.h" |
| 12 #include "ui/base/animation/tween.h" | 12 #include "ui/base/animation/tween.h" |
| 13 #include "ui/gfx/image/cairo_cached_surface.h" | 13 #include "ui/gfx/image/cairo_cached_surface.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 // The length of a single cycle of the animation in milliseconds. | 17 // The length of a single cycle of the animation in milliseconds. |
| 18 const int kThrobberDurationMs = 750; | 18 const int kThrobberDurationMs = 750; |
| 19 | 19 |
| 20 } // namespace | 20 } // namespace |
| 21 | 21 |
| 22 ThrobberGtk::ThrobberGtk(ThemeServiceGtk* theme_service) | 22 ThrobberGtk::ThrobberGtk(GtkThemeService* theme_service) |
| 23 : theme_service_(theme_service), | 23 : theme_service_(theme_service), |
| 24 ALLOW_THIS_IN_INITIALIZER_LIST(animation_(this)), | 24 ALLOW_THIS_IN_INITIALIZER_LIST(animation_(this)), |
| 25 frames_(NULL), | 25 frames_(NULL), |
| 26 num_frames_(0) { | 26 num_frames_(0) { |
| 27 DCHECK(theme_service_); | 27 DCHECK(theme_service_); |
| 28 Init(); | 28 Init(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 ThrobberGtk::~ThrobberGtk() { | 31 ThrobberGtk::~ThrobberGtk() { |
| 32 widget_.Destroy(); | 32 widget_.Destroy(); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 void ThrobberGtk::LoadFrames() { | 94 void ThrobberGtk::LoadFrames() { |
| 95 frames_ = theme_service_->GetImageNamed(IDR_THROBBER); | 95 frames_ = theme_service_->GetImageNamed(IDR_THROBBER); |
| 96 DCHECK(frames_); | 96 DCHECK(frames_); |
| 97 const int width = frames_->ToCairo()->Width(); | 97 const int width = frames_->ToCairo()->Width(); |
| 98 const int height = frames_->ToCairo()->Height(); | 98 const int height = frames_->ToCairo()->Height(); |
| 99 DCHECK_EQ(0, width % height); | 99 DCHECK_EQ(0, width % height); |
| 100 num_frames_ = width / height; | 100 num_frames_ = width / height; |
| 101 | 101 |
| 102 gtk_widget_set_size_request(widget_.get(), height, height); | 102 gtk_widget_set_size_request(widget_.get(), height, height); |
| 103 } | 103 } |
| OLD | NEW |