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/workspace/multi_window_resize_controller.h" |
6 | 6 |
7 #include "ash/screen_ash.h" | 7 #include "ash/screen_util.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/wm/coordinate_conversion.h" | 10 #include "ash/wm/coordinate_conversion.h" |
11 #include "ash/wm/window_animations.h" | 11 #include "ash/wm/window_animations.h" |
12 #include "ash/wm/workspace/workspace_event_handler.h" | 12 #include "ash/wm/workspace/workspace_event_handler.h" |
13 #include "ash/wm/workspace/workspace_window_resizer.h" | 13 #include "ash/wm/workspace/workspace_window_resizer.h" |
14 #include "grit/ash_resources.h" | 14 #include "grit/ash_resources.h" |
15 #include "ui/aura/client/screen_position_client.h" | 15 #include "ui/aura/client/screen_position_client.h" |
16 #include "ui/aura/root_window.h" | 16 #include "ui/aura/root_window.h" |
17 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 internal::kShellWindowId_AlwaysOnTopContainer); | 391 internal::kShellWindowId_AlwaysOnTopContainer); |
392 params.can_activate = false; | 392 params.can_activate = false; |
393 ResizeView* view = new ResizeView(this, windows_.direction); | 393 ResizeView* view = new ResizeView(this, windows_.direction); |
394 resize_widget_->set_focus_on_creation(false); | 394 resize_widget_->set_focus_on_creation(false); |
395 resize_widget_->Init(params); | 395 resize_widget_->Init(params); |
396 views::corewm::SetWindowVisibilityAnimationType( | 396 views::corewm::SetWindowVisibilityAnimationType( |
397 resize_widget_->GetNativeWindow(), | 397 resize_widget_->GetNativeWindow(), |
398 views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); | 398 views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); |
399 resize_widget_->GetNativeWindow()->SetName("MultiWindowResizeController"); | 399 resize_widget_->GetNativeWindow()->SetName("MultiWindowResizeController"); |
400 resize_widget_->SetContentsView(view); | 400 resize_widget_->SetContentsView(view); |
401 show_bounds_in_screen_ = ScreenAsh::ConvertRectToScreen( | 401 show_bounds_in_screen_ = ScreenUtil::ConvertRectToScreen( |
402 windows_.window1->parent(), | 402 windows_.window1->parent(), |
403 CalculateResizeWidgetBounds(show_location_in_parent_)); | 403 CalculateResizeWidgetBounds(show_location_in_parent_)); |
404 resize_widget_->SetBounds(show_bounds_in_screen_); | 404 resize_widget_->SetBounds(show_bounds_in_screen_); |
405 resize_widget_->Show(); | 405 resize_widget_->Show(); |
406 mouse_watcher_.reset(new views::MouseWatcher( | 406 mouse_watcher_.reset(new views::MouseWatcher( |
407 new ResizeMouseWatcherHost(this), | 407 new ResizeMouseWatcherHost(this), |
408 this)); | 408 this)); |
409 mouse_watcher_->set_notify_on_exit_time( | 409 mouse_watcher_->set_notify_on_exit_time( |
410 base::TimeDelta::FromMilliseconds(kHideDelayMS)); | 410 base::TimeDelta::FromMilliseconds(kHideDelayMS)); |
411 mouse_watcher_->Start(); | 411 mouse_watcher_->Start(); |
(...skipping 28 matching lines...) Expand all Loading... |
440 aura::client::WINDOW_MOVE_SOURCE_MOUSE); | 440 aura::client::WINDOW_MOVE_SOURCE_MOUSE); |
441 window_resizer_.reset(WorkspaceWindowResizer::Create(window_state, windows)); | 441 window_resizer_.reset(WorkspaceWindowResizer::Create(window_state, windows)); |
442 } | 442 } |
443 | 443 |
444 void MultiWindowResizeController::Resize(const gfx::Point& location_in_screen, | 444 void MultiWindowResizeController::Resize(const gfx::Point& location_in_screen, |
445 int event_flags) { | 445 int event_flags) { |
446 gfx::Point location_in_parent(location_in_screen); | 446 gfx::Point location_in_parent(location_in_screen); |
447 aura::client::GetScreenPositionClient(windows_.window1->GetRootWindow())-> | 447 aura::client::GetScreenPositionClient(windows_.window1->GetRootWindow())-> |
448 ConvertPointFromScreen(windows_.window1->parent(), &location_in_parent); | 448 ConvertPointFromScreen(windows_.window1->parent(), &location_in_parent); |
449 window_resizer_->Drag(location_in_parent, event_flags); | 449 window_resizer_->Drag(location_in_parent, event_flags); |
450 gfx::Rect bounds = ScreenAsh::ConvertRectToScreen( | 450 gfx::Rect bounds = ScreenUtil::ConvertRectToScreen( |
451 windows_.window1->parent(), | 451 windows_.window1->parent(), |
452 CalculateResizeWidgetBounds(location_in_parent)); | 452 CalculateResizeWidgetBounds(location_in_parent)); |
453 | 453 |
454 if (windows_.direction == LEFT_RIGHT) | 454 if (windows_.direction == LEFT_RIGHT) |
455 bounds.set_y(show_bounds_in_screen_.y()); | 455 bounds.set_y(show_bounds_in_screen_.y()); |
456 else | 456 else |
457 bounds.set_x(show_bounds_in_screen_.x()); | 457 bounds.set_x(show_bounds_in_screen_.x()); |
458 resize_widget_->SetBounds(bounds); | 458 resize_widget_->SetBounds(bounds); |
459 } | 459 } |
460 | 460 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 | 538 |
539 gfx::Point window_loc(location_in_screen); | 539 gfx::Point window_loc(location_in_screen); |
540 aura::Window::ConvertPointToTarget( | 540 aura::Window::ConvertPointToTarget( |
541 window->GetRootWindow(), window, &window_loc); | 541 window->GetRootWindow(), window, &window_loc); |
542 return window->HitTest(window_loc) && | 542 return window->HitTest(window_loc) && |
543 window->delegate()->GetNonClientComponent(window_loc) == component; | 543 window->delegate()->GetNonClientComponent(window_loc) == component; |
544 } | 544 } |
545 | 545 |
546 } // namespace internal | 546 } // namespace internal |
547 } // namespace ash | 547 } // namespace ash |
OLD | NEW |