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

Side by Side Diff: chrome/browser/views/tabs/tab_overview_grid.cc

Issue 126185: Improved tab overview animations with better animation and wiring to... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/views/tabs/tab_overview_grid.h" 5 #include "chrome/browser/views/tabs/tab_overview_grid.h"
6 6
7 #include "chrome/browser/views/tabs/tab_overview_cell.h" 7 #include "chrome/browser/views/tabs/tab_overview_cell.h"
8 #include "chrome/browser/views/tabs/tab_overview_controller.h" 8 #include "chrome/browser/views/tabs/tab_overview_controller.h"
9 #include "chrome/browser/views/tabs/tab_overview_drag_controller.h" 9 #include "chrome/browser/views/tabs/tab_overview_drag_controller.h"
10 #include "views/screen.h"
10 11
11 TabOverviewGrid::TabOverviewGrid(TabOverviewController* controller) 12 TabOverviewGrid::TabOverviewGrid(TabOverviewController* controller)
12 : controller_(controller) { 13 : controller_(controller) {
13 } 14 }
14 15
15 TabOverviewGrid::~TabOverviewGrid() { 16 TabOverviewGrid::~TabOverviewGrid() {
16 } 17 }
17 18
18 bool TabOverviewGrid::modifying_model() const { 19 bool TabOverviewGrid::modifying_model() const {
19 return drag_controller_.get() && drag_controller_->modifying_model(); 20 return drag_controller_.get() && drag_controller_->modifying_model();
20 } 21 }
21 22
22 TabOverviewCell* TabOverviewGrid::GetTabOverviewCellAt(int index) { 23 TabOverviewCell* TabOverviewGrid::GetTabOverviewCellAt(int index) {
23 return static_cast<TabOverviewCell*>(GetChildViewAt(index)); 24 return static_cast<TabOverviewCell*>(GetChildViewAt(index));
24 } 25 }
25 26
26 void TabOverviewGrid::CancelDrag() { 27 void TabOverviewGrid::CancelDrag() {
27 drag_controller_.reset(NULL); 28 drag_controller_.reset(NULL);
28 } 29 }
29 30
31 void TabOverviewGrid::UpdateDragController() {
32 if (drag_controller_.get()) {
33 gfx::Point mouse_loc = views::Screen::GetCursorScreenPoint();
34 ConvertPointToView(NULL, this, &mouse_loc);
35 drag_controller_->Drag(mouse_loc);
36 }
37 }
38
30 bool TabOverviewGrid::OnMousePressed(const views::MouseEvent& event) { 39 bool TabOverviewGrid::OnMousePressed(const views::MouseEvent& event) {
31 if (drag_controller_.get()) 40 if (drag_controller_.get())
32 return true; 41 return true;
33 42
34 if (!event.IsLeftMouseButton()) 43 if (!event.IsLeftMouseButton())
35 return false; 44 return false;
36 45
37 drag_controller_.reset(new TabOverviewDragController(controller_)); 46 drag_controller_.reset(new TabOverviewDragController(controller_));
38 if (!drag_controller_->Configure(event.location())) { 47 if (!drag_controller_->Configure(event.location())) {
39 drag_controller_.reset(NULL); 48 drag_controller_.reset(NULL);
(...skipping 14 matching lines...) Expand all
54 bool canceled) { 63 bool canceled) {
55 if (!drag_controller_.get()) 64 if (!drag_controller_.get())
56 return; 65 return;
57 66
58 if (canceled) 67 if (canceled)
59 drag_controller_->RevertDrag(); 68 drag_controller_->RevertDrag();
60 else 69 else
61 drag_controller_->CommitDrag(event.location()); 70 drag_controller_->CommitDrag(event.location());
62 drag_controller_.reset(NULL); 71 drag_controller_.reset(NULL);
63 } 72 }
73
74 void TabOverviewGrid::AnimationEnded(const Animation* animation) {
75 Grid::AnimationEnded(animation);
76 controller_->GridAnimationEnded();
77 }
78
79 void TabOverviewGrid::AnimationProgressed(const Animation* animation) {
80 Grid::AnimationProgressed(animation);
81 controller_->GridAnimationProgressed();
82 }
83
84 void TabOverviewGrid::AnimationCanceled(const Animation* animation) {
85 Grid::AnimationCanceled(animation);
86 controller_->GridAnimationCanceled();
87 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698