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

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

Issue 641683003: C++11 override style change for athena (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: rebase 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
« no previous file with comments | « athena/wm/split_view_controller.h ('k') | athena/wm/split_view_controller_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 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/split_view_controller.h" 5 #include "athena/wm/split_view_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "athena/screen/public/screen_manager.h" 9 #include "athena/screen/public/screen_manager.h"
10 #include "athena/wm/public/window_list_provider.h" 10 #include "athena/wm/public/window_list_provider.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 WINDOW_LEFT, 51 WINDOW_LEFT,
52 // Activate |right_window_|. 52 // Activate |right_window_|.
53 WINDOW_RIGHT 53 WINDOW_RIGHT
54 }; 54 };
55 55
56 // Always returns the same target. 56 // Always returns the same target.
57 class StaticViewTargeterDelegate : public views::ViewTargeterDelegate { 57 class StaticViewTargeterDelegate : public views::ViewTargeterDelegate {
58 public: 58 public:
59 explicit StaticViewTargeterDelegate(views::View* target) : target_(target) {} 59 explicit StaticViewTargeterDelegate(views::View* target) : target_(target) {}
60 60
61 virtual ~StaticViewTargeterDelegate() {} 61 ~StaticViewTargeterDelegate() override {}
62 62
63 private: 63 private:
64 // views::ViewTargeterDelegate: 64 // views::ViewTargeterDelegate:
65 virtual views::View* TargetForRect(views::View* root, 65 virtual views::View* TargetForRect(views::View* root,
66 const gfx::Rect& rect) override { 66 const gfx::Rect& rect) override {
67 return target_; 67 return target_;
68 } 68 }
69 69
70 // Not owned. 70 // Not owned.
71 views::View* target_; 71 views::View* target_;
72 72
73 DISALLOW_COPY_AND_ASSIGN(StaticViewTargeterDelegate); 73 DISALLOW_COPY_AND_ASSIGN(StaticViewTargeterDelegate);
74 }; 74 };
75 75
76 // Expands the effective target area of the window of the widget containing the 76 // Expands the effective target area of the window of the widget containing the
77 // specified view. If the view is large enough to begin with, there should be 77 // specified view. If the view is large enough to begin with, there should be
78 // no change from the default targeting behavior. 78 // no change from the default targeting behavior.
79 class PriorityWindowTargeter : public aura::WindowTargeter, 79 class PriorityWindowTargeter : public aura::WindowTargeter,
80 public aura::WindowObserver { 80 public aura::WindowObserver {
81 public: 81 public:
82 explicit PriorityWindowTargeter(views::View* priority_view) 82 explicit PriorityWindowTargeter(views::View* priority_view)
83 : priority_view_(priority_view) { 83 : priority_view_(priority_view) {
84 CHECK(priority_view->GetWidget()); 84 CHECK(priority_view->GetWidget());
85 window_ = priority_view->GetWidget()->GetNativeWindow(); 85 window_ = priority_view->GetWidget()->GetNativeWindow();
86 CHECK(window_); 86 CHECK(window_);
87 window_->AddObserver(this); 87 window_->AddObserver(this);
88 } 88 }
89 89
90 virtual ~PriorityWindowTargeter() { 90 ~PriorityWindowTargeter() override { window_->RemoveObserver(this); }
91 window_->RemoveObserver(this);
92 }
93 91
94 private: 92 private:
95 // aura::WindowTargeter: 93 // aura::WindowTargeter:
96 virtual ui::EventTarget* FindTargetForLocatedEvent( 94 ui::EventTarget* FindTargetForLocatedEvent(ui::EventTarget* root,
97 ui::EventTarget* root, 95 ui::LocatedEvent* event) override {
98 ui::LocatedEvent* event) override {
99 if (!window_ || (event->type() != ui::ET_TOUCH_PRESSED)) 96 if (!window_ || (event->type() != ui::ET_TOUCH_PRESSED))
100 return WindowTargeter::FindTargetForLocatedEvent(root, event); 97 return WindowTargeter::FindTargetForLocatedEvent(root, event);
101 CHECK_EQ(window_, priority_view_->GetWidget()->GetNativeWindow()); 98 CHECK_EQ(window_, priority_view_->GetWidget()->GetNativeWindow());
102 99
103 // Bounds of the view in root window's coordinates. 100 // Bounds of the view in root window's coordinates.
104 gfx::Rect view_bounds = priority_view_->GetBoundsInScreen(); 101 gfx::Rect view_bounds = priority_view_->GetBoundsInScreen();
105 // If there is a transform on the window's layer - apply it. 102 // If there is a transform on the window's layer - apply it.
106 gfx::Transform window_transform = window_->layer()->transform(); 103 gfx::Transform window_transform = window_->layer()->transform();
107 gfx::RectF transformed_bounds_f = view_bounds; 104 gfx::RectF transformed_bounds_f = view_bounds;
108 window_transform.TransformRect(&transformed_bounds_f); 105 window_transform.TransformRect(&transformed_bounds_f);
(...skipping 14 matching lines...) Expand all
123 gfx::UnionRects(transformed_bounds, extension_rect); 120 gfx::UnionRects(transformed_bounds, extension_rect);
124 if (extended_bounds.Contains(event->root_location())) { 121 if (extended_bounds.Contains(event->root_location())) {
125 root->ConvertEventToTarget(window_, event); 122 root->ConvertEventToTarget(window_, event);
126 return window_; 123 return window_;
127 } 124 }
128 125
129 return WindowTargeter::FindTargetForLocatedEvent(root, event); 126 return WindowTargeter::FindTargetForLocatedEvent(root, event);
130 } 127 }
131 128
132 // aura::WindowObserver: 129 // aura::WindowObserver:
133 virtual void OnWindowDestroying(aura::Window* window) override { 130 void OnWindowDestroying(aura::Window* window) override {
134 DCHECK_EQ(window, window_); 131 DCHECK_EQ(window, window_);
135 window_->RemoveObserver(this); 132 window_->RemoveObserver(this);
136 window_ = nullptr; 133 window_ = nullptr;
137 } 134 }
138 135
139 // Minimum dimension of a target to be comfortably touchable. 136 // Minimum dimension of a target to be comfortably touchable.
140 // The effective touch target area of |priority_window_| gets expanded so 137 // The effective touch target area of |priority_window_| gets expanded so
141 // that it's width and height is ayt least |kMinTouchDimension|. 138 // that it's width and height is ayt least |kMinTouchDimension|.
142 int const kMinTouchDimension = 26; 139 int const kMinTouchDimension = 26;
143 140
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 ShowDivider(); 631 ShowDivider();
635 } 632 }
636 633
637 void SplitViewController::OnSplitViewModeEnter() { 634 void SplitViewController::OnSplitViewModeEnter() {
638 } 635 }
639 636
640 void SplitViewController::OnSplitViewModeExit() { 637 void SplitViewController::OnSplitViewModeExit() {
641 } 638 }
642 639
643 } // namespace athena 640 } // namespace athena
OLDNEW
« no previous file with comments | « athena/wm/split_view_controller.h ('k') | athena/wm/split_view_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698