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

Side by Side Diff: ui/app_list/views/apps_grid_view.cc

Issue 681873002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « ui/app_list/views/apps_grid_view.h ('k') | ui/app_list/views/apps_grid_view_unittest.cc » ('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 "ui/app_list/views/apps_grid_view.h" 5 #include "ui/app_list/views/apps_grid_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 class RowMoveAnimationDelegate : public gfx::AnimationDelegate { 127 class RowMoveAnimationDelegate : public gfx::AnimationDelegate {
128 public: 128 public:
129 RowMoveAnimationDelegate(views::View* view, 129 RowMoveAnimationDelegate(views::View* view,
130 ui::Layer* layer, 130 ui::Layer* layer,
131 const gfx::Rect& layer_target) 131 const gfx::Rect& layer_target)
132 : view_(view), 132 : view_(view),
133 layer_(layer), 133 layer_(layer),
134 layer_start_(layer ? layer->bounds() : gfx::Rect()), 134 layer_start_(layer ? layer->bounds() : gfx::Rect()),
135 layer_target_(layer_target) { 135 layer_target_(layer_target) {
136 } 136 }
137 virtual ~RowMoveAnimationDelegate() {} 137 ~RowMoveAnimationDelegate() override {}
138 138
139 // gfx::AnimationDelegate overrides: 139 // gfx::AnimationDelegate overrides:
140 virtual void AnimationProgressed(const gfx::Animation* animation) override { 140 void AnimationProgressed(const gfx::Animation* animation) override {
141 view_->layer()->SetOpacity(animation->GetCurrentValue()); 141 view_->layer()->SetOpacity(animation->GetCurrentValue());
142 view_->layer()->ScheduleDraw(); 142 view_->layer()->ScheduleDraw();
143 143
144 if (layer_) { 144 if (layer_) {
145 layer_->SetOpacity(1 - animation->GetCurrentValue()); 145 layer_->SetOpacity(1 - animation->GetCurrentValue());
146 layer_->SetBounds(animation->CurrentValueBetween(layer_start_, 146 layer_->SetBounds(animation->CurrentValueBetween(layer_start_,
147 layer_target_)); 147 layer_target_));
148 layer_->ScheduleDraw(); 148 layer_->ScheduleDraw();
149 } 149 }
150 } 150 }
151 virtual void AnimationEnded(const gfx::Animation* animation) override { 151 void AnimationEnded(const gfx::Animation* animation) override {
152 view_->layer()->SetOpacity(1.0f); 152 view_->layer()->SetOpacity(1.0f);
153 view_->SchedulePaint(); 153 view_->SchedulePaint();
154 } 154 }
155 virtual void AnimationCanceled(const gfx::Animation* animation) override { 155 void AnimationCanceled(const gfx::Animation* animation) override {
156 view_->layer()->SetOpacity(1.0f); 156 view_->layer()->SetOpacity(1.0f);
157 view_->SchedulePaint(); 157 view_->SchedulePaint();
158 } 158 }
159 159
160 private: 160 private:
161 // The view that needs to be wrapped. Owned by views hierarchy. 161 // The view that needs to be wrapped. Owned by views hierarchy.
162 views::View* view_; 162 views::View* view_;
163 163
164 scoped_ptr<ui::Layer> layer_; 164 scoped_ptr<ui::Layer> layer_;
165 const gfx::Rect layer_start_; 165 const gfx::Rect layer_start_;
166 const gfx::Rect layer_target_; 166 const gfx::Rect layer_target_;
167 167
168 DISALLOW_COPY_AND_ASSIGN(RowMoveAnimationDelegate); 168 DISALLOW_COPY_AND_ASSIGN(RowMoveAnimationDelegate);
169 }; 169 };
170 170
171 // ItemRemoveAnimationDelegate is used to show animation for removing an item. 171 // ItemRemoveAnimationDelegate is used to show animation for removing an item.
172 // This happens when user drags an item into a folder. The dragged item will 172 // This happens when user drags an item into a folder. The dragged item will
173 // be removed from the original list after it is dropped into the folder. 173 // be removed from the original list after it is dropped into the folder.
174 class ItemRemoveAnimationDelegate : public gfx::AnimationDelegate { 174 class ItemRemoveAnimationDelegate : public gfx::AnimationDelegate {
175 public: 175 public:
176 explicit ItemRemoveAnimationDelegate(views::View* view) 176 explicit ItemRemoveAnimationDelegate(views::View* view)
177 : view_(view) { 177 : view_(view) {
178 } 178 }
179 179
180 virtual ~ItemRemoveAnimationDelegate() { 180 ~ItemRemoveAnimationDelegate() override {}
181 }
182 181
183 // gfx::AnimationDelegate overrides: 182 // gfx::AnimationDelegate overrides:
184 virtual void AnimationProgressed(const gfx::Animation* animation) override { 183 void AnimationProgressed(const gfx::Animation* animation) override {
185 view_->layer()->SetOpacity(1 - animation->GetCurrentValue()); 184 view_->layer()->SetOpacity(1 - animation->GetCurrentValue());
186 view_->layer()->ScheduleDraw(); 185 view_->layer()->ScheduleDraw();
187 } 186 }
188 187
189 private: 188 private:
190 scoped_ptr<views::View> view_; 189 scoped_ptr<views::View> view_;
191 190
192 DISALLOW_COPY_AND_ASSIGN(ItemRemoveAnimationDelegate); 191 DISALLOW_COPY_AND_ASSIGN(ItemRemoveAnimationDelegate);
193 }; 192 };
194 193
195 // ItemMoveAnimationDelegate observes when an item finishes animating when it is 194 // ItemMoveAnimationDelegate observes when an item finishes animating when it is
196 // not moving between rows. This is to ensure an item is repainted for the 195 // not moving between rows. This is to ensure an item is repainted for the
197 // "zoom out" case when releasing an item being dragged. 196 // "zoom out" case when releasing an item being dragged.
198 class ItemMoveAnimationDelegate : public gfx::AnimationDelegate { 197 class ItemMoveAnimationDelegate : public gfx::AnimationDelegate {
199 public: 198 public:
200 ItemMoveAnimationDelegate(views::View* view) : view_(view) {} 199 ItemMoveAnimationDelegate(views::View* view) : view_(view) {}
201 200
202 virtual void AnimationEnded(const gfx::Animation* animation) override { 201 void AnimationEnded(const gfx::Animation* animation) override {
203 view_->SchedulePaint(); 202 view_->SchedulePaint();
204 } 203 }
205 virtual void AnimationCanceled(const gfx::Animation* animation) override { 204 void AnimationCanceled(const gfx::Animation* animation) override {
206 view_->SchedulePaint(); 205 view_->SchedulePaint();
207 } 206 }
208 207
209 private: 208 private:
210 views::View* view_; 209 views::View* view_;
211 210
212 DISALLOW_COPY_AND_ASSIGN(ItemMoveAnimationDelegate); 211 DISALLOW_COPY_AND_ASSIGN(ItemMoveAnimationDelegate);
213 }; 212 };
214 213
215 // Returns true if the |item| is a folder item. 214 // Returns true if the |item| is a folder item.
(...skipping 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after
2170 2169
2171 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, 2170 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index,
2172 bool is_target_folder) { 2171 bool is_target_folder) {
2173 AppListItemView* target_view = 2172 AppListItemView* target_view =
2174 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot); 2173 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot);
2175 if (target_view) 2174 if (target_view)
2176 target_view->SetAsAttemptedFolderTarget(is_target_folder); 2175 target_view->SetAsAttemptedFolderTarget(is_target_folder);
2177 } 2176 }
2178 2177
2179 } // namespace app_list 2178 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/apps_grid_view.h ('k') | ui/app_list/views/apps_grid_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698