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

Side by Side Diff: chrome/browser/ui/views/tabs/tab_drag_controller.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
« no previous file with comments | « chrome/browser/ui/views/tabs/tab.cc ('k') | chrome/browser/ui/views/tabs/tab_strip.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) 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/tabs/tab_drag_controller.h" 5 #include "chrome/browser/ui/views/tabs/tab_drag_controller.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <set> 8 #include <set>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 18 matching lines...) Expand all
29 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
30 #include "content/public/browser/invalidate_type.h" 30 #include "content/public/browser/invalidate_type.h"
31 #include "content/public/browser/notification_details.h" 31 #include "content/public/browser/notification_details.h"
32 #include "content/public/browser/notification_service.h" 32 #include "content/public/browser/notification_service.h"
33 #include "content/public/browser/notification_source.h" 33 #include "content/public/browser/notification_source.h"
34 #include "content/public/browser/notification_types.h" 34 #include "content/public/browser/notification_types.h"
35 #include "content/public/browser/user_metrics.h" 35 #include "content/public/browser/user_metrics.h"
36 #include "content/public/browser/web_contents.h" 36 #include "content/public/browser/web_contents.h"
37 #include "content/public/browser/web_contents_view.h" 37 #include "content/public/browser/web_contents_view.h"
38 #include "grit/theme_resources.h" 38 #include "grit/theme_resources.h"
39 #include "ui/base/animation/animation.h"
40 #include "ui/base/animation/animation_delegate.h"
41 #include "ui/base/animation/slide_animation.h"
42 #include "ui/base/events/event_constants.h" 39 #include "ui/base/events/event_constants.h"
43 #include "ui/base/events/event_utils.h" 40 #include "ui/base/events/event_utils.h"
44 #include "ui/base/resource/resource_bundle.h" 41 #include "ui/base/resource/resource_bundle.h"
42 #include "ui/gfx/animation/animation.h"
43 #include "ui/gfx/animation/animation_delegate.h"
44 #include "ui/gfx/animation/slide_animation.h"
45 #include "ui/gfx/canvas.h" 45 #include "ui/gfx/canvas.h"
46 #include "ui/gfx/image/image_skia.h" 46 #include "ui/gfx/image/image_skia.h"
47 #include "ui/gfx/screen.h" 47 #include "ui/gfx/screen.h"
48 #include "ui/views/focus/view_storage.h" 48 #include "ui/views/focus/view_storage.h"
49 #include "ui/views/widget/root_view.h" 49 #include "ui/views/widget/root_view.h"
50 #include "ui/views/widget/widget.h" 50 #include "ui/views/widget/widget.h"
51 51
52 #if defined(USE_ASH) 52 #if defined(USE_ASH)
53 #include "ash/shell.h" 53 #include "ash/shell.h"
54 #include "ash/wm/coordinate_conversion.h" 54 #include "ash/wm/coordinate_conversion.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 229
230 } // namespace 230 } // namespace
231 231
232 /////////////////////////////////////////////////////////////////////////////// 232 ///////////////////////////////////////////////////////////////////////////////
233 // DockDisplayer 233 // DockDisplayer
234 234
235 // DockDisplayer is responsible for giving the user a visual indication of a 235 // DockDisplayer is responsible for giving the user a visual indication of a
236 // possible dock position (as represented by DockInfo). DockDisplayer shows 236 // possible dock position (as represented by DockInfo). DockDisplayer shows
237 // a window with a DockView in it. Two animations are used that correspond to 237 // a window with a DockView in it. Two animations are used that correspond to
238 // the state of DockInfo::in_enable_area. 238 // the state of DockInfo::in_enable_area.
239 class TabDragController::DockDisplayer : public ui::AnimationDelegate { 239 class TabDragController::DockDisplayer : public gfx::AnimationDelegate {
240 public: 240 public:
241 DockDisplayer(TabDragController* controller, const DockInfo& info) 241 DockDisplayer(TabDragController* controller, const DockInfo& info)
242 : controller_(controller), 242 : controller_(controller),
243 popup_(NULL), 243 popup_(NULL),
244 popup_view_(NULL), 244 popup_view_(NULL),
245 animation_(this), 245 animation_(this),
246 hidden_(false), 246 hidden_(false),
247 in_enable_area_(info.in_enable_area()) { 247 in_enable_area_(info.in_enable_area()) {
248 popup_ = new views::Widget; 248 popup_ = new views::Widget;
249 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); 249 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 return; 289 return;
290 290
291 if (!popup_) { 291 if (!popup_) {
292 delete this; 292 delete this;
293 return; 293 return;
294 } 294 }
295 hidden_ = true; 295 hidden_ = true;
296 animation_.Hide(); 296 animation_.Hide();
297 } 297 }
298 298
299 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE { 299 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE {
300 UpdateLayeredAlpha(); 300 UpdateLayeredAlpha();
301 } 301 }
302 302
303 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE { 303 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE {
304 if (!hidden_) 304 if (!hidden_)
305 return; 305 return;
306 popup_->Close(); 306 popup_->Close();
307 delete this; 307 delete this;
308 } 308 }
309 309
310 private: 310 private:
311 void UpdateLayeredAlpha() { 311 void UpdateLayeredAlpha() {
312 double scale = in_enable_area_ ? 1 : .5; 312 double scale = in_enable_area_ ? 1 : .5;
313 popup_->SetOpacity(static_cast<unsigned char>(animation_.GetCurrentValue() * 313 popup_->SetOpacity(static_cast<unsigned char>(animation_.GetCurrentValue() *
314 scale * 255.0)); 314 scale * 255.0));
315 } 315 }
316 316
317 // TabDragController that created us. 317 // TabDragController that created us.
318 TabDragController* controller_; 318 TabDragController* controller_;
319 319
320 // Window we're showing. 320 // Window we're showing.
321 views::Widget* popup_; 321 views::Widget* popup_;
322 322
323 // NativeView of |popup_|. We cache this to avoid the possibility of 323 // NativeView of |popup_|. We cache this to avoid the possibility of
324 // invoking a method on popup_ after we close it. 324 // invoking a method on popup_ after we close it.
325 gfx::NativeView popup_view_; 325 gfx::NativeView popup_view_;
326 326
327 // Animation for when first made visible. 327 // Animation for when first made visible.
328 ui::SlideAnimation animation_; 328 gfx::SlideAnimation animation_;
329 329
330 // Have we been hidden? 330 // Have we been hidden?
331 bool hidden_; 331 bool hidden_;
332 332
333 // Value of DockInfo::in_enable_area. 333 // Value of DockInfo::in_enable_area.
334 bool in_enable_area_; 334 bool in_enable_area_;
335 }; 335 };
336 336
337 TabDragController::TabDragData::TabDragData() 337 TabDragController::TabDragData::TabDragData()
338 : contents(NULL), 338 : contents(NULL),
(...skipping 1845 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 gfx::Vector2d TabDragController::GetWindowOffset( 2184 gfx::Vector2d TabDragController::GetWindowOffset(
2185 const gfx::Point& point_in_screen) { 2185 const gfx::Point& point_in_screen) {
2186 TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ? 2186 TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ?
2187 attached_tabstrip_ : source_tabstrip_; 2187 attached_tabstrip_ : source_tabstrip_;
2188 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); 2188 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView();
2189 2189
2190 gfx::Point point = point_in_screen; 2190 gfx::Point point = point_in_screen;
2191 views::View::ConvertPointFromScreen(toplevel_view, &point); 2191 views::View::ConvertPointFromScreen(toplevel_view, &point);
2192 return point.OffsetFromOrigin(); 2192 return point.OffsetFromOrigin();
2193 } 2193 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab.cc ('k') | chrome/browser/ui/views/tabs/tab_strip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698