| OLD | NEW |
| 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 "ash/wm/workspace/multi_window_resize_controller.h" | 5 #include "ash/wm/common/workspace/multi_window_resize_controller.h" |
| 6 | 6 |
| 7 #include "ash/ash_constants.h" | 7 #include "ash/ash_constants.h" |
| 8 #include "ash/frame/custom_frame_view_ash.h" | 8 #include "ash/frame/custom_frame_view_ash.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
| 11 #include "ash/test/shell_test_api.h" | 11 #include "ash/test/shell_test_api.h" |
| 12 #include "ash/wm/aura/wm_window_aura.h" |
| 12 #include "ash/wm/window_util.h" | 13 #include "ash/wm/window_util.h" |
| 13 #include "ash/wm/workspace/workspace_event_handler_test_helper.h" | 14 #include "ash/wm/workspace/workspace_event_handler_test_helper.h" |
| 14 #include "ash/wm/workspace_controller.h" | 15 #include "ash/wm/workspace_controller.h" |
| 15 #include "ash/wm/workspace_controller_test_helper.h" | 16 #include "ash/wm/workspace_controller_test_helper.h" |
| 17 #include "base/stl_util.h" |
| 16 #include "ui/aura/test/test_window_delegate.h" | 18 #include "ui/aura/test/test_window_delegate.h" |
| 17 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
| 18 #include "ui/base/hit_test.h" | 20 #include "ui/base/hit_test.h" |
| 19 #include "ui/events/test/event_generator.h" | 21 #include "ui/events/test/event_generator.h" |
| 20 #include "ui/views/widget/widget.h" | 22 #include "ui/views/widget/widget.h" |
| 21 #include "ui/views/widget/widget_delegate.h" | 23 #include "ui/views/widget/widget_delegate.h" |
| 22 | 24 |
| 23 namespace ash { | 25 namespace ash { |
| 24 | 26 |
| 25 namespace { | 27 namespace { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 return resize_controller_->show_timer_.IsRunning(); | 88 return resize_controller_->show_timer_.IsRunning(); |
| 87 } | 89 } |
| 88 | 90 |
| 89 void Hide() { | 91 void Hide() { |
| 90 resize_controller_->Hide(); | 92 resize_controller_->Hide(); |
| 91 } | 93 } |
| 92 | 94 |
| 93 bool HasTarget(aura::Window* window) { | 95 bool HasTarget(aura::Window* window) { |
| 94 if (!resize_controller_->windows_.is_valid()) | 96 if (!resize_controller_->windows_.is_valid()) |
| 95 return false; | 97 return false; |
| 96 if ((resize_controller_->windows_.window1 == window || | 98 wm::WmWindow* wm_window = wm::WmWindowAura::Get(window); |
| 97 resize_controller_->windows_.window2 == window)) | 99 if ((resize_controller_->windows_.window1 == wm_window || |
| 100 resize_controller_->windows_.window2 == wm_window)) |
| 98 return true; | 101 return true; |
| 99 for (size_t i = 0; | 102 return ContainsValue(resize_controller_->windows_.other_windows, wm_window); |
| 100 i < resize_controller_->windows_.other_windows.size(); ++i) { | |
| 101 if (resize_controller_->windows_.other_windows[i] == window) | |
| 102 return true; | |
| 103 } | |
| 104 return false; | |
| 105 } | 103 } |
| 106 | 104 |
| 107 bool IsOverWindows(const gfx::Point& loc) { | 105 bool IsOverWindows(const gfx::Point& loc) { |
| 108 return resize_controller_->IsOverWindows(loc); | 106 return resize_controller_->IsOverWindows(loc); |
| 109 } | 107 } |
| 110 | 108 |
| 111 views::Widget* resize_widget() { | 109 views::Widget* resize_widget() { |
| 112 return resize_controller_->resize_widget_.get(); | 110 return resize_controller_->resize_widget_.get(); |
| 113 } | 111 } |
| 114 | 112 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 | 364 |
| 367 // Clicking outside the resize handle should immediately hide the resize | 365 // Clicking outside the resize handle should immediately hide the resize |
| 368 // handle. | 366 // handle. |
| 369 EXPECT_FALSE(resize_widget_bounds_in_screen.Contains(w1_center_in_screen)); | 367 EXPECT_FALSE(resize_widget_bounds_in_screen.Contains(w1_center_in_screen)); |
| 370 generator.MoveMouseTo(w1_center_in_screen); | 368 generator.MoveMouseTo(w1_center_in_screen); |
| 371 generator.ClickLeftButton(); | 369 generator.ClickLeftButton(); |
| 372 EXPECT_FALSE(IsShowing()); | 370 EXPECT_FALSE(IsShowing()); |
| 373 } | 371 } |
| 374 | 372 |
| 375 } // namespace ash | 373 } // namespace ash |
| OLD | NEW |