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

Side by Side Diff: athena/wm/window_overview_mode.cc

Issue 641683003: C++11 override style change for athena (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 6 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "athena/wm/window_overview_mode.h" 5 #include "athena/wm/window_overview_mode.h"
6 6
7 #include <complex> 7 #include <complex>
8 #include <vector> 8 #include <vector>
9 9
10 #include "athena/wm/overview_toolbar.h" 10 #include "athena/wm/overview_toolbar.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 254
255 WindowOverviewState* target_state = 255 WindowOverviewState* target_state =
256 target_window->GetProperty(kWindowOverviewState); 256 target_window->GetProperty(kWindowOverviewState);
257 setter.SetWindowProgress(target_state->progress); 257 setter.SetWindowProgress(target_state->progress);
258 } 258 }
259 259
260 // Always returns the same target. 260 // Always returns the same target.
261 class StaticWindowTargeter : public aura::WindowTargeter { 261 class StaticWindowTargeter : public aura::WindowTargeter {
262 public: 262 public:
263 explicit StaticWindowTargeter(aura::Window* target) : target_(target) {} 263 explicit StaticWindowTargeter(aura::Window* target) : target_(target) {}
264 virtual ~StaticWindowTargeter() {} 264 ~StaticWindowTargeter() override {}
265 265
266 private: 266 private:
267 // aura::WindowTargeter: 267 // aura::WindowTargeter:
268 virtual ui::EventTarget* FindTargetForEvent(ui::EventTarget* root, 268 ui::EventTarget* FindTargetForEvent(ui::EventTarget* root,
269 ui::Event* event) override { 269 ui::Event* event) override {
270 return target_; 270 return target_;
271 } 271 }
272 272
273 virtual ui::EventTarget* FindTargetForLocatedEvent( 273 ui::EventTarget* FindTargetForLocatedEvent(
274 ui::EventTarget* root, 274 ui::EventTarget* root,
275 ui::LocatedEvent* event) override { 275 ui::LocatedEvent* event) override {
276 return target_; 276 return target_;
277 } 277 }
278 278
279 aura::Window* target_; 279 aura::Window* target_;
280 DISALLOW_COPY_AND_ASSIGN(StaticWindowTargeter); 280 DISALLOW_COPY_AND_ASSIGN(StaticWindowTargeter);
281 }; 281 };
282 282
283 class WindowOverviewModeImpl : public WindowOverviewMode, 283 class WindowOverviewModeImpl : public WindowOverviewMode,
(...skipping 18 matching lines...) Expand all
302 container_->set_target_handler(this); 302 container_->set_target_handler(this);
303 303
304 // Prepare the desired transforms for all the windows, and set the initial 304 // Prepare the desired transforms for all the windows, and set the initial
305 // state on the windows. 305 // state on the windows.
306 ComputeTerminalStatesForAllWindows(); 306 ComputeTerminalStatesForAllWindows();
307 SetInitialWindowStates(); 307 SetInitialWindowStates();
308 308
309 window_list_provider_->AddObserver(this); 309 window_list_provider_->AddObserver(this);
310 } 310 }
311 311
312 virtual ~WindowOverviewModeImpl() { 312 ~WindowOverviewModeImpl() override {
313 window_list_provider_->RemoveObserver(this); 313 window_list_provider_->RemoveObserver(this);
314 container_->set_target_handler(container_->delegate()); 314 container_->set_target_handler(container_->delegate());
315 RemoveAnimationObserver(); 315 RemoveAnimationObserver();
316 const aura::Window::Windows& windows = 316 const aura::Window::Windows& windows =
317 window_list_provider_->GetWindowList(); 317 window_list_provider_->GetWindowList();
318 if (windows.empty()) 318 if (windows.empty())
319 return; 319 return;
320 for (aura::Window* window : windows) 320 for (aura::Window* window : windows)
321 RestoreWindowState(window, split_view_controller_); 321 RestoreWindowState(window, split_view_controller_);
322 } 322 }
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 split_view_controller_->left_window(), 690 split_view_controller_->left_window(),
691 split_view_controller_->right_window(), 691 split_view_controller_->right_window(),
692 window); 692 window);
693 } else { 693 } else {
694 delegate_->OnSelectWindow(window); 694 delegate_->OnSelectWindow(window);
695 } 695 }
696 } 696 }
697 } 697 }
698 698
699 // ui::EventHandler: 699 // ui::EventHandler:
700 virtual void OnMouseEvent(ui::MouseEvent* mouse) override { 700 void OnMouseEvent(ui::MouseEvent* mouse) override {
701 if (mouse->type() == ui::ET_MOUSE_PRESSED) { 701 if (mouse->type() == ui::ET_MOUSE_PRESSED) {
702 aura::Window* select = SelectWindowAt(mouse); 702 aura::Window* select = SelectWindowAt(mouse);
703 if (select) { 703 if (select) {
704 mouse->SetHandled(); 704 mouse->SetHandled();
705 SelectWindow(select); 705 SelectWindow(select);
706 } 706 }
707 } else if (mouse->type() == ui::ET_MOUSEWHEEL) { 707 } else if (mouse->type() == ui::ET_MOUSEWHEEL) {
708 DoScroll(static_cast<ui::MouseWheelEvent*>(mouse)->y_offset()); 708 DoScroll(static_cast<ui::MouseWheelEvent*>(mouse)->y_offset());
709 } 709 }
710 } 710 }
711 711
712 virtual void OnScrollEvent(ui::ScrollEvent* scroll) override { 712 void OnScrollEvent(ui::ScrollEvent* scroll) override {
713 if (scroll->type() == ui::ET_SCROLL) 713 if (scroll->type() == ui::ET_SCROLL)
714 DoScroll(scroll->y_offset()); 714 DoScroll(scroll->y_offset());
715 } 715 }
716 716
717 virtual void OnGestureEvent(ui::GestureEvent* gesture) override { 717 void OnGestureEvent(ui::GestureEvent* gesture) override {
718 if (gesture->type() == ui::ET_GESTURE_TAP) { 718 if (gesture->type() == ui::ET_GESTURE_TAP) {
719 aura::Window* select = SelectWindowAt(gesture); 719 aura::Window* select = SelectWindowAt(gesture);
720 if (select) { 720 if (select) {
721 gesture->SetHandled(); 721 gesture->SetHandled();
722 SelectWindow(select); 722 SelectWindow(select);
723 } 723 }
724 } else if (gesture->type() == ui::ET_GESTURE_SCROLL_BEGIN) { 724 } else if (gesture->type() == ui::ET_GESTURE_SCROLL_BEGIN) {
725 if (std::abs(gesture->details().scroll_x_hint()) > 725 if (std::abs(gesture->details().scroll_x_hint()) >
726 std::abs(gesture->details().scroll_y_hint()) * 2) { 726 std::abs(gesture->details().scroll_y_hint()) * 2) {
727 dragged_start_location_ = gesture->location(); 727 dragged_start_location_ = gesture->location();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 if (fling_) { 769 if (fling_) {
770 fling_.reset(); 770 fling_.reset();
771 RemoveAnimationObserver(); 771 RemoveAnimationObserver();
772 gesture->SetHandled(); 772 gesture->SetHandled();
773 } 773 }
774 dragged_window_ = NULL; 774 dragged_window_ = NULL;
775 } 775 }
776 } 776 }
777 777
778 // ui::CompositorAnimationObserver: 778 // ui::CompositorAnimationObserver:
779 virtual void OnAnimationStep(base::TimeTicks timestamp) override { 779 void OnAnimationStep(base::TimeTicks timestamp) override {
780 CHECK(fling_); 780 CHECK(fling_);
781 gfx::Vector2dF delta; 781 gfx::Vector2dF delta;
782 bool fling_active = fling_->ComputeScrollDeltaAtTime(timestamp, &delta); 782 bool fling_active = fling_->ComputeScrollDeltaAtTime(timestamp, &delta);
783 783
784 if (!delta.IsZero()) 784 if (!delta.IsZero())
785 DoScroll(delta.y()); 785 DoScroll(delta.y());
786 786
787 if (!fling_active) { 787 if (!fling_active) {
788 fling_.reset(); 788 fling_.reset();
789 RemoveAnimationObserver(); 789 RemoveAnimationObserver();
790 } 790 }
791 } 791 }
792 792
793 // WindowListProviderObserver: 793 // WindowListProviderObserver:
794 virtual void OnWindowStackingChanged() override { 794 void OnWindowStackingChanged() override {
795 // Recompute the states of all windows. There isn't enough information at 795 // Recompute the states of all windows. There isn't enough information at
796 // this point to do anything more clever. 796 // this point to do anything more clever.
797 ComputeTerminalStatesForAllWindows(); 797 ComputeTerminalStatesForAllWindows();
798 SetInitialWindowStates(); 798 SetInitialWindowStates();
799 } 799 }
800 800
801 virtual void OnWindowRemoved(aura::Window* removed_window, 801 void OnWindowRemoved(aura::Window* removed_window,
802 int index) override { 802 int index) override {
803 const aura::Window::Windows& windows = 803 const aura::Window::Windows& windows =
804 window_list_provider_->GetWindowList(); 804 window_list_provider_->GetWindowList();
805 if (windows.empty()) 805 if (windows.empty())
806 return; 806 return;
807 CHECK_LE(index, static_cast<int>(windows.size())); 807 CHECK_LE(index, static_cast<int>(windows.size()));
808 if (index == 0) { 808 if (index == 0) {
809 // The back-most window has been removed. Move all the remaining windows 809 // The back-most window has been removed. Move all the remaining windows
810 // one step backwards. 810 // one step backwards.
811 for (int i = windows.size() - 1; i > 0; --i) { 811 for (int i = windows.size() - 1; i > 0; --i) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 aura::Window* container, 859 aura::Window* container,
860 WindowListProvider* window_list_provider, 860 WindowListProvider* window_list_provider,
861 SplitViewController* split_view_controller, 861 SplitViewController* split_view_controller,
862 WindowOverviewModeDelegate* delegate) { 862 WindowOverviewModeDelegate* delegate) {
863 return scoped_ptr<WindowOverviewMode>( 863 return scoped_ptr<WindowOverviewMode>(
864 new WindowOverviewModeImpl(container, window_list_provider, 864 new WindowOverviewModeImpl(container, window_list_provider,
865 split_view_controller, delegate)); 865 split_view_controller, delegate));
866 } 866 }
867 867
868 } // namespace athena 868 } // namespace athena
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698