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

Side by Side Diff: components/exo/shell_surface.cc

Issue 1913473002: Makes WorkspaceWindowResizer use ash/wm/common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@root_controller_observer
Patch Set: merge to trunk Created 4 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/exo/shell_surface.h" 5 #include "components/exo/shell_surface.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/wm/aura/wm_window_aura.h"
9 #include "ash/wm/window_resizer.h" 10 #include "ash/wm/window_resizer.h"
10 #include "ash/wm/window_state.h" 11 #include "ash/wm/window_state.h"
11 #include "ash/wm/window_state_aura.h" 12 #include "ash/wm/window_state_aura.h"
12 #include "base/logging.h" 13 #include "base/logging.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
15 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
16 #include "base/trace_event/trace_event.h" 17 #include "base/trace_event/trace_event.h"
17 #include "base/trace_event/trace_event_argument.h" 18 #include "base/trace_event/trace_event_argument.h"
18 #include "components/exo/surface.h" 19 #include "components/exo/surface.h"
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 // Cannot start another drag if one is already taking place. 756 // Cannot start another drag if one is already taking place.
756 if (resizer_) 757 if (resizer_)
757 return; 758 return;
758 759
759 if (widget_->GetNativeWindow()->HasCapture()) 760 if (widget_->GetNativeWindow()->HasCapture())
760 return; 761 return;
761 762
762 aura::Window* root_window = widget_->GetNativeWindow()->GetRootWindow(); 763 aura::Window* root_window = widget_->GetNativeWindow()->GetRootWindow();
763 gfx::Point drag_location = 764 gfx::Point drag_location =
764 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); 765 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot();
765 aura::Window::ConvertPointToTarget( 766 aura::Window::ConvertPointToTarget(ash::wm::WmWindowAura::Get(root_window),
766 root_window, widget_->GetNativeWindow()->parent(), &drag_location); 767 widget_->GetNativeWindow()->parent(),
768 &drag_location);
767 769
768 // Set the cursor before calling CreateWindowResizer(), as that will 770 // Set the cursor before calling CreateWindowResizer(), as that will
769 // eventually call LockCursor() and prevent the cursor from changing. 771 // eventually call LockCursor() and prevent the cursor from changing.
770 aura::client::CursorClient* cursor_client = 772 aura::client::CursorClient* cursor_client =
771 aura::client::GetCursorClient(root_window); 773 aura::client::GetCursorClient(root_window);
772 DCHECK(cursor_client); 774 DCHECK(cursor_client);
773 775
774 switch (component) { 776 switch (component) {
775 case HTCAPTION: 777 case HTCAPTION:
776 cursor_client->SetCursor(ui::kCursorPointer); 778 cursor_client->SetCursor(ui::kCursorPointer);
(...skipping 20 matching lines...) Expand all
797 cursor_client->SetCursor(ui::kCursorWestResize); 799 cursor_client->SetCursor(ui::kCursorWestResize);
798 break; 800 break;
799 case HTTOPLEFT: 801 case HTTOPLEFT:
800 cursor_client->SetCursor(ui::kCursorNorthWestResize); 802 cursor_client->SetCursor(ui::kCursorNorthWestResize);
801 break; 803 break;
802 default: 804 default:
803 NOTREACHED(); 805 NOTREACHED();
804 break; 806 break;
805 } 807 }
806 808
807 resizer_ = ash::CreateWindowResizer(widget_->GetNativeWindow(), drag_location, 809 resizer_ = ash::CreateWindowResizer(
808 component, 810 ash::wm::WmWindowAura::Get(widget_->GetNativeWindow()), drag_location,
809 aura::client::WINDOW_MOVE_SOURCE_MOUSE); 811 component, aura::client::WINDOW_MOVE_SOURCE_MOUSE);
810 if (!resizer_) 812 if (!resizer_)
811 return; 813 return;
812 814
813 // Apply pending origin offsets and resize direction before starting a new 815 // Apply pending origin offsets and resize direction before starting a new
814 // resize operation. These can still be pending if the client has acknowledged 816 // resize operation. These can still be pending if the client has acknowledged
815 // the configure request but not yet called Commit(). 817 // the configure request but not yet called Commit().
816 origin_ += pending_origin_offset_; 818 origin_ += pending_origin_offset_;
817 pending_origin_offset_ = gfx::Vector2d(); 819 pending_origin_offset_ = gfx::Vector2d();
818 resize_component_ = pending_resize_component_; 820 resize_component_ = pending_resize_component_;
819 821
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 DCHECK(!ignore_window_bounds_changes_); 924 DCHECK(!ignore_window_bounds_changes_);
923 ignore_window_bounds_changes_ = true; 925 ignore_window_bounds_changes_ = true;
924 widget_->SetBounds(new_widget_bounds); 926 widget_->SetBounds(new_widget_bounds);
925 ignore_window_bounds_changes_ = false; 927 ignore_window_bounds_changes_ = false;
926 928
927 // A change to the widget size requires surface bounds to be re-adjusted. 929 // A change to the widget size requires surface bounds to be re-adjusted.
928 surface_->SetBounds(gfx::Rect(GetSurfaceOrigin(), surface_->layer()->size())); 930 surface_->SetBounds(gfx::Rect(GetSurfaceOrigin(), surface_->layer()->size()));
929 } 931 }
930 932
931 } // namespace exo 933 } // namespace exo
OLDNEW
« ash/wm/workspace/workspace_window_resizer.cc ('K') | « ash/wm/workspace_controller_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698