Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: chrome/browser/gtk/hover_controller_gtk.cc

Issue 6154001: Move animation code to new ui/base/animation directory.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/gtk/hover_controller_gtk.h ('k') | chrome/browser/gtk/infobar_arrow_model.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/gtk/hover_controller_gtk.h" 5 #include "chrome/browser/gtk/hover_controller_gtk.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "chrome/browser/gtk/gtk_chrome_button.h" 8 #include "chrome/browser/gtk/gtk_chrome_button.h"
9 9
10 static const gchar* kHoverControllerGtkKey = "__HOVER_CONTROLLER_GTK__"; 10 static const gchar* kHoverControllerGtkKey = "__HOVER_CONTROLLER_GTK__";
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 void HoverControllerGtk::Destroy() { 57 void HoverControllerGtk::Destroy() {
58 gtk_chrome_button_set_hover_state(GTK_CHROME_BUTTON(button_), -1.0); 58 gtk_chrome_button_set_hover_state(GTK_CHROME_BUTTON(button_), -1.0);
59 59
60 g_object_set_data(G_OBJECT(button_), kHoverControllerGtkKey, NULL); 60 g_object_set_data(G_OBJECT(button_), kHoverControllerGtkKey, NULL);
61 g_object_unref(button_); 61 g_object_unref(button_);
62 button_ = NULL; 62 button_ = NULL;
63 63
64 delete this; 64 delete this;
65 } 65 }
66 66
67 void HoverControllerGtk::AnimationProgressed(const Animation* animation) { 67 void HoverControllerGtk::AnimationProgressed(const ui::Animation* animation) {
68 if (!button_) 68 if (!button_)
69 return; 69 return;
70 70
71 // Ignore the hover animation if we are throbbing. 71 // Ignore the hover animation if we are throbbing.
72 if (animation == &hover_animation_ && throb_animation_.is_animating()) 72 if (animation == &hover_animation_ && throb_animation_.is_animating())
73 return; 73 return;
74 74
75 gtk_chrome_button_set_hover_state(GTK_CHROME_BUTTON(button_), 75 gtk_chrome_button_set_hover_state(GTK_CHROME_BUTTON(button_),
76 animation->GetCurrentValue()); 76 animation->GetCurrentValue());
77 } 77 }
78 78
79 void HoverControllerGtk::AnimationEnded(const Animation* animation) { 79 void HoverControllerGtk::AnimationEnded(const ui::Animation* animation) {
80 if (!button_) 80 if (!button_)
81 return; 81 return;
82 if (animation != &throb_animation_) 82 if (animation != &throb_animation_)
83 return; 83 return;
84 84
85 if (throb_animation_.cycles_remaining() <= 1) 85 if (throb_animation_.cycles_remaining() <= 1)
86 gtk_chrome_button_set_hover_state(GTK_CHROME_BUTTON(button_), 0); 86 gtk_chrome_button_set_hover_state(GTK_CHROME_BUTTON(button_), 0);
87 } 87 }
88 88
89 void HoverControllerGtk::AnimationCanceled(const Animation* animation) { 89 void HoverControllerGtk::AnimationCanceled(const ui::Animation* animation) {
90 AnimationEnded(animation); 90 AnimationEnded(animation);
91 } 91 }
92 92
93 gboolean HoverControllerGtk::OnEnter(GtkWidget* widget, 93 gboolean HoverControllerGtk::OnEnter(GtkWidget* widget,
94 GdkEventCrossing* event) { 94 GdkEventCrossing* event) {
95 hover_animation_.Show(); 95 hover_animation_.Show();
96 96
97 return FALSE; 97 return FALSE;
98 } 98 }
99 99
(...skipping 17 matching lines...) Expand all
117 if (!GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel(widget))) { 117 if (!GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel(widget))) {
118 gtk_widget_set_state(button_, GTK_STATE_NORMAL); 118 gtk_widget_set_state(button_, GTK_STATE_NORMAL);
119 hover_animation_.Reset(); 119 hover_animation_.Reset();
120 gtk_chrome_button_set_hover_state(GTK_CHROME_BUTTON(button_), 0.0); 120 gtk_chrome_button_set_hover_state(GTK_CHROME_BUTTON(button_), 0.0);
121 } 121 }
122 } 122 }
123 123
124 void HoverControllerGtk::OnDestroy(GtkWidget* widget) { 124 void HoverControllerGtk::OnDestroy(GtkWidget* widget) {
125 Destroy(); 125 Destroy();
126 } 126 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/hover_controller_gtk.h ('k') | chrome/browser/gtk/infobar_arrow_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698