OLD | NEW |
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 28 matching lines...) Expand all Loading... |
39 // Always returns the same target. | 39 // Always returns the same target. |
40 class StaticViewTargeterDelegate : public views::ViewTargeterDelegate { | 40 class StaticViewTargeterDelegate : public views::ViewTargeterDelegate { |
41 public: | 41 public: |
42 explicit StaticViewTargeterDelegate(views::View* target) : target_(target) {} | 42 explicit StaticViewTargeterDelegate(views::View* target) : target_(target) {} |
43 | 43 |
44 virtual ~StaticViewTargeterDelegate() {} | 44 virtual ~StaticViewTargeterDelegate() {} |
45 | 45 |
46 private: | 46 private: |
47 // views::ViewTargeterDelegate: | 47 // views::ViewTargeterDelegate: |
48 virtual views::View* TargetForRect(views::View* root, | 48 virtual views::View* TargetForRect(views::View* root, |
49 const gfx::Rect& rect) OVERRIDE { | 49 const gfx::Rect& rect) override { |
50 return target_; | 50 return target_; |
51 } | 51 } |
52 | 52 |
53 // Not owned. | 53 // Not owned. |
54 views::View* target_; | 54 views::View* target_; |
55 | 55 |
56 DISALLOW_COPY_AND_ASSIGN(StaticViewTargeterDelegate); | 56 DISALLOW_COPY_AND_ASSIGN(StaticViewTargeterDelegate); |
57 }; | 57 }; |
58 | 58 |
59 // Expands the effective target area of the window of the widget containing the | 59 // Expands the effective target area of the window of the widget containing the |
(...skipping 11 matching lines...) Expand all Loading... |
71 } | 71 } |
72 | 72 |
73 virtual ~PriorityWindowTargeter() { | 73 virtual ~PriorityWindowTargeter() { |
74 window_->RemoveObserver(this); | 74 window_->RemoveObserver(this); |
75 } | 75 } |
76 | 76 |
77 private: | 77 private: |
78 // aura::WindowTargeter: | 78 // aura::WindowTargeter: |
79 virtual ui::EventTarget* FindTargetForLocatedEvent( | 79 virtual ui::EventTarget* FindTargetForLocatedEvent( |
80 ui::EventTarget* root, | 80 ui::EventTarget* root, |
81 ui::LocatedEvent* event) OVERRIDE { | 81 ui::LocatedEvent* event) override { |
82 if (!window_ || (event->type() != ui::ET_TOUCH_PRESSED)) | 82 if (!window_ || (event->type() != ui::ET_TOUCH_PRESSED)) |
83 return WindowTargeter::FindTargetForLocatedEvent(root, event); | 83 return WindowTargeter::FindTargetForLocatedEvent(root, event); |
84 CHECK_EQ(window_, priority_view_->GetWidget()->GetNativeWindow()); | 84 CHECK_EQ(window_, priority_view_->GetWidget()->GetNativeWindow()); |
85 | 85 |
86 // Bounds of the view in root window's coordinates. | 86 // Bounds of the view in root window's coordinates. |
87 gfx::Rect view_bounds = priority_view_->GetBoundsInScreen(); | 87 gfx::Rect view_bounds = priority_view_->GetBoundsInScreen(); |
88 // If there is a transform on the window's layer - apply it. | 88 // If there is a transform on the window's layer - apply it. |
89 gfx::Transform window_transform = window_->layer()->transform(); | 89 gfx::Transform window_transform = window_->layer()->transform(); |
90 gfx::RectF transformed_bounds_f = view_bounds; | 90 gfx::RectF transformed_bounds_f = view_bounds; |
91 window_transform.TransformRect(&transformed_bounds_f); | 91 window_transform.TransformRect(&transformed_bounds_f); |
(...skipping 14 matching lines...) Expand all Loading... |
106 gfx::UnionRects(transformed_bounds, extension_rect); | 106 gfx::UnionRects(transformed_bounds, extension_rect); |
107 if (extended_bounds.Contains(event->root_location())) { | 107 if (extended_bounds.Contains(event->root_location())) { |
108 root->ConvertEventToTarget(window_, event); | 108 root->ConvertEventToTarget(window_, event); |
109 return window_; | 109 return window_; |
110 } | 110 } |
111 | 111 |
112 return WindowTargeter::FindTargetForLocatedEvent(root, event); | 112 return WindowTargeter::FindTargetForLocatedEvent(root, event); |
113 } | 113 } |
114 | 114 |
115 // aura::WindowObserver: | 115 // aura::WindowObserver: |
116 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE { | 116 virtual void OnWindowDestroying(aura::Window* window) override { |
117 DCHECK_EQ(window, window_); | 117 DCHECK_EQ(window, window_); |
118 window_->RemoveObserver(this); | 118 window_->RemoveObserver(this); |
119 window_ = NULL; | 119 window_ = NULL; |
120 } | 120 } |
121 | 121 |
122 // Minimum dimension of a target to be comfortably touchable. | 122 // Minimum dimension of a target to be comfortably touchable. |
123 // The effective touch target area of |priority_window_| gets expanded so | 123 // The effective touch target area of |priority_window_| gets expanded so |
124 // that it's width and height is ayt least |kMinTouchDimension|. | 124 // that it's width and height is ayt least |kMinTouchDimension|. |
125 int const kMinTouchDimension = 26; | 125 int const kMinTouchDimension = 26; |
126 | 126 |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 ShowDivider(); | 602 ShowDivider(); |
603 } | 603 } |
604 | 604 |
605 void SplitViewController::OnSplitViewModeEnter() { | 605 void SplitViewController::OnSplitViewModeEnter() { |
606 } | 606 } |
607 | 607 |
608 void SplitViewController::OnSplitViewModeExit() { | 608 void SplitViewController::OnSplitViewModeExit() { |
609 } | 609 } |
610 | 610 |
611 } // namespace athena | 611 } // namespace athena |
OLD | NEW |