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

Side by Side Diff: chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc

Issue 23531053: ui/base/animation -> ui/gfx/animation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge 2 trunk Created 7 years, 3 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
OLDNEW
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/notifications/balloon_view_gtk.h" 5 #include "chrome/browser/ui/gtk/notifications/balloon_view_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 19 matching lines...) Expand all
30 #include "chrome/browser/ui/gtk/menu_gtk.h" 30 #include "chrome/browser/ui/gtk/menu_gtk.h"
31 #include "chrome/browser/ui/gtk/notifications/balloon_view_host_gtk.h" 31 #include "chrome/browser/ui/gtk/notifications/balloon_view_host_gtk.h"
32 #include "chrome/browser/ui/gtk/rounded_window.h" 32 #include "chrome/browser/ui/gtk/rounded_window.h"
33 #include "chrome/common/extensions/extension.h" 33 #include "chrome/common/extensions/extension.h"
34 #include "content/public/browser/notification_source.h" 34 #include "content/public/browser/notification_source.h"
35 #include "content/public/browser/render_view_host.h" 35 #include "content/public/browser/render_view_host.h"
36 #include "content/public/browser/render_widget_host_view.h" 36 #include "content/public/browser/render_widget_host_view.h"
37 #include "content/public/browser/web_contents.h" 37 #include "content/public/browser/web_contents.h"
38 #include "grit/generated_resources.h" 38 #include "grit/generated_resources.h"
39 #include "grit/theme_resources.h" 39 #include "grit/theme_resources.h"
40 #include "ui/base/animation/slide_animation.h"
41 #include "ui/base/gtk/gtk_hig_constants.h" 40 #include "ui/base/gtk/gtk_hig_constants.h"
42 #include "ui/base/l10n/l10n_util.h" 41 #include "ui/base/l10n/l10n_util.h"
43 #include "ui/base/resource/resource_bundle.h" 42 #include "ui/base/resource/resource_bundle.h"
43 #include "ui/gfx/animation/slide_animation.h"
44 #include "ui/gfx/canvas.h" 44 #include "ui/gfx/canvas.h"
45 #include "ui/gfx/insets.h" 45 #include "ui/gfx/insets.h"
46 #include "ui/gfx/native_widget_types.h" 46 #include "ui/gfx/native_widget_types.h"
47 47
48 namespace { 48 namespace {
49 49
50 // Margin, in pixels, between the notification frame and the contents 50 // Margin, in pixels, between the notification frame and the contents
51 // of the notification. 51 // of the notification.
52 const int kTopMargin = 0; 52 const int kTopMargin = 0;
53 const int kBottomMargin = 1; 53 const int kBottomMargin = 1;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 gtk_window_get_position(GTK_WINDOW(frame_container_), &start_x, &start_y); 170 gtk_window_get_position(GTK_WINDOW(frame_container_), &start_x, &start_y);
171 gtk_window_get_size(GTK_WINDOW(frame_container_), &start_w, &start_h); 171 gtk_window_get_size(GTK_WINDOW(frame_container_), &start_w, &start_h);
172 172
173 int end_x = balloon_->GetPosition().x(); 173 int end_x = balloon_->GetPosition().x();
174 int end_y = balloon_->GetPosition().y(); 174 int end_y = balloon_->GetPosition().y();
175 int end_w = GetDesiredTotalWidth(); 175 int end_w = GetDesiredTotalWidth();
176 int end_h = GetDesiredTotalHeight(); 176 int end_h = GetDesiredTotalHeight();
177 177
178 anim_frame_start_ = gfx::Rect(start_x, start_y, start_w, start_h); 178 anim_frame_start_ = gfx::Rect(start_x, start_y, start_w, start_h);
179 anim_frame_end_ = gfx::Rect(end_x, end_y, end_w, end_h); 179 anim_frame_end_ = gfx::Rect(end_x, end_y, end_w, end_h);
180 animation_.reset(new ui::SlideAnimation(this)); 180 animation_.reset(new gfx::SlideAnimation(this));
181 animation_->Show(); 181 animation_->Show();
182 } 182 }
183 183
184 void BalloonViewImpl::AnimationProgressed(const ui::Animation* animation) { 184 void BalloonViewImpl::AnimationProgressed(const gfx::Animation* animation) {
185 DCHECK_EQ(animation, animation_.get()); 185 DCHECK_EQ(animation, animation_.get());
186 186
187 // Linear interpolation from start to end position. 187 // Linear interpolation from start to end position.
188 double end = animation->GetCurrentValue(); 188 double end = animation->GetCurrentValue();
189 double start = 1.0 - end; 189 double start = 1.0 - end;
190 190
191 gfx::Rect frame_position( 191 gfx::Rect frame_position(
192 static_cast<int>(start * anim_frame_start_.x() + 192 static_cast<int>(start * anim_frame_start_.x() +
193 end * anim_frame_end_.x()), 193 end * anim_frame_end_.x()),
194 static_cast<int>(start * anim_frame_start_.y() + 194 static_cast<int>(start * anim_frame_start_.y() +
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 base::Bind( 469 base::Bind(
470 &BalloonViewImpl::DelayedClose, weak_factory_.GetWeakPtr(), false)); 470 &BalloonViewImpl::DelayedClose, weak_factory_.GetWeakPtr(), false));
471 } 471 }
472 } 472 }
473 473
474 gboolean BalloonViewImpl::OnDestroy(GtkWidget* widget) { 474 gboolean BalloonViewImpl::OnDestroy(GtkWidget* widget) {
475 frame_container_ = NULL; 475 frame_container_ = NULL;
476 Close(false); 476 Close(false);
477 return FALSE; // Propagate. 477 return FALSE; // Propagate.
478 } 478 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/notifications/balloon_view_gtk.h ('k') | chrome/browser/ui/gtk/slide_animator_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698