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

Side by Side Diff: ui/views/mus/native_widget_mus.cc

Issue 2438853002: Renames aura::client::WindowTreeClient to WindowParentingClient (Closed)
Patch Set: cleanup Created 4 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
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 // This has to be before any other includes, else default is picked up. 5 // This has to be before any other includes, else default is picked up.
6 // See base/logging for details on this. 6 // See base/logging for details on this.
7 #define NOTIMPLEMENTED_POLICY 5 7 #define NOTIMPLEMENTED_POLICY 5
8 8
9 #include "ui/views/mus/native_widget_mus.h" 9 #include "ui/views/mus/native_widget_mus.h"
10 10
11 #include <map> 11 #include <map>
12 #include <utility> 12 #include <utility>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/callback.h" 15 #include "base/callback.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/message_loop/message_loop.h" 17 #include "base/message_loop/message_loop.h"
18 #include "base/run_loop.h" 18 #include "base/run_loop.h"
19 #include "base/threading/thread_task_runner_handle.h" 19 #include "base/threading/thread_task_runner_handle.h"
20 #include "services/ui/public/cpp/property_type_converters.h" 20 #include "services/ui/public/cpp/property_type_converters.h"
21 #include "services/ui/public/cpp/window.h" 21 #include "services/ui/public/cpp/window.h"
22 #include "services/ui/public/cpp/window_observer.h" 22 #include "services/ui/public/cpp/window_observer.h"
23 #include "services/ui/public/cpp/window_property.h" 23 #include "services/ui/public/cpp/window_property.h"
24 #include "services/ui/public/cpp/window_tree_client.h" 24 #include "services/ui/public/cpp/window_tree_client.h"
25 #include "services/ui/public/interfaces/cursor.mojom.h" 25 #include "services/ui/public/interfaces/cursor.mojom.h"
26 #include "services/ui/public/interfaces/window_manager.mojom.h" 26 #include "services/ui/public/interfaces/window_manager.mojom.h"
27 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" 27 #include "services/ui/public/interfaces/window_manager_constants.mojom.h"
28 #include "services/ui/public/interfaces/window_tree.mojom.h" 28 #include "services/ui/public/interfaces/window_tree.mojom.h"
29 #include "ui/aura/client/default_capture_client.h" 29 #include "ui/aura/client/default_capture_client.h"
30 #include "ui/aura/client/window_tree_client.h" 30 #include "ui/aura/client/window_parenting_client.h"
31 #include "ui/aura/layout_manager.h" 31 #include "ui/aura/layout_manager.h"
32 #include "ui/aura/mus/mus_util.h" 32 #include "ui/aura/mus/mus_util.h"
33 #include "ui/aura/window.h" 33 #include "ui/aura/window.h"
34 #include "ui/aura/window_property.h" 34 #include "ui/aura/window_property.h"
35 #include "ui/base/hit_test.h" 35 #include "ui/base/hit_test.h"
36 #include "ui/display/display.h" 36 #include "ui/display/display.h"
37 #include "ui/display/screen.h" 37 #include "ui/display/screen.h"
38 #include "ui/events/event.h" 38 #include "ui/events/event.h"
39 #include "ui/gfx/canvas.h" 39 #include "ui/gfx/canvas.h"
40 #include "ui/gfx/path.h" 40 #include "ui/gfx/path.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 const gfx::Rect& requested_bounds) override { 131 const gfx::Rect& requested_bounds) override {
132 SetChildBoundsDirect(child, requested_bounds); 132 SetChildBoundsDirect(child, requested_bounds);
133 } 133 }
134 134
135 aura::Window* outer_; 135 aura::Window* outer_;
136 aura::Window* inner_; 136 aura::Window* inner_;
137 137
138 DISALLOW_COPY_AND_ASSIGN(ContentWindowLayoutManager); 138 DISALLOW_COPY_AND_ASSIGN(ContentWindowLayoutManager);
139 }; 139 };
140 140
141 class NativeWidgetMusWindowTreeClient : public aura::client::WindowTreeClient { 141 class NativeWidgetMusWindowParentingClient
142 : public aura::client::WindowParentingClient {
142 public: 143 public:
143 explicit NativeWidgetMusWindowTreeClient(aura::Window* root_window) 144 explicit NativeWidgetMusWindowParentingClient(aura::Window* root_window)
144 : root_window_(root_window) { 145 : root_window_(root_window) {
145 aura::client::SetWindowTreeClient(root_window_, this); 146 aura::client::SetWindowParentingClient(root_window_, this);
146 } 147 }
147 ~NativeWidgetMusWindowTreeClient() override { 148 ~NativeWidgetMusWindowParentingClient() override {
148 aura::client::SetWindowTreeClient(root_window_, nullptr); 149 aura::client::SetWindowParentingClient(root_window_, nullptr);
149 } 150 }
150 151
151 // Overridden from client::WindowTreeClient: 152 // Overridden from client::WindowParentingClient:
152 aura::Window* GetDefaultParent(aura::Window* context, 153 aura::Window* GetDefaultParent(aura::Window* context,
153 aura::Window* window, 154 aura::Window* window,
154 const gfx::Rect& bounds) override { 155 const gfx::Rect& bounds) override {
155 return root_window_; 156 return root_window_;
156 } 157 }
157 158
158 private: 159 private:
159 aura::Window* root_window_; 160 aura::Window* root_window_;
160 161
161 DISALLOW_COPY_AND_ASSIGN(NativeWidgetMusWindowTreeClient); 162 DISALLOW_COPY_AND_ASSIGN(NativeWidgetMusWindowParentingClient);
162 }; 163 };
163 164
164 // A screen position client that applies the offset of the ui::Window. 165 // A screen position client that applies the offset of the ui::Window.
165 class ScreenPositionClientMus : public wm::DefaultScreenPositionClient { 166 class ScreenPositionClientMus : public wm::DefaultScreenPositionClient {
166 public: 167 public:
167 explicit ScreenPositionClientMus(ui::Window* mus_window) 168 explicit ScreenPositionClientMus(ui::Window* mus_window)
168 : mus_window_(mus_window) {} 169 : mus_window_(mus_window) {}
169 ~ScreenPositionClientMus() override {} 170 ~ScreenPositionClientMus() override {}
170 171
171 // wm::DefaultScreenPositionClient: 172 // wm::DefaultScreenPositionClient:
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 native_widget_delegate_->OnNativeWidgetDestroying(); 604 native_widget_delegate_->OnNativeWidgetDestroying();
604 605
605 tooltip_manager_.reset(); 606 tooltip_manager_.reset();
606 if (tooltip_controller_.get()) { 607 if (tooltip_controller_.get()) {
607 window_tree_host_->window()->RemovePreTargetHandler( 608 window_tree_host_->window()->RemovePreTargetHandler(
608 tooltip_controller_.get()); 609 tooltip_controller_.get());
609 aura::client::SetTooltipClient(window_tree_host_->window(), NULL); 610 aura::client::SetTooltipClient(window_tree_host_->window(), NULL);
610 tooltip_controller_.reset(); 611 tooltip_controller_.reset();
611 } 612 }
612 613
613 window_tree_client_.reset(); // Uses |content_|. 614 window_parenting_client_.reset(); // Uses |content_|.
614 capture_client_.reset(); // Uses |content_|. 615 capture_client_.reset(); // Uses |content_|.
615 616
616 window_tree_host_->RemoveObserver(this); 617 window_tree_host_->RemoveObserver(this);
617 window_tree_host_.reset(); 618 window_tree_host_.reset();
618 619
619 cursor_manager_.reset(); // Uses |window_|. 620 cursor_manager_.reset(); // Uses |window_|.
620 621
621 mus_window_observer_.reset(nullptr); 622 mus_window_observer_.reset(nullptr);
622 623
623 window_ = nullptr; 624 window_ = nullptr;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 750
750 // TODO(erg): Remove this check when ash/mus/move_event_handler.cc's 751 // TODO(erg): Remove this check when ash/mus/move_event_handler.cc's
751 // direct usage of ui::Window::SetPredefinedCursor() is switched to a 752 // direct usage of ui::Window::SetPredefinedCursor() is switched to a
752 // private method on WindowManagerClient. 753 // private method on WindowManagerClient.
753 if (!is_parallel_widget_in_window_manager()) { 754 if (!is_parallel_widget_in_window_manager()) {
754 cursor_manager_ = base::MakeUnique<wm::CursorManager>( 755 cursor_manager_ = base::MakeUnique<wm::CursorManager>(
755 base::MakeUnique<NativeCursorManagerMus>(window_)); 756 base::MakeUnique<NativeCursorManagerMus>(window_));
756 aura::client::SetCursorClient(hosted_window, cursor_manager_.get()); 757 aura::client::SetCursorClient(hosted_window, cursor_manager_.get());
757 } 758 }
758 759
759 window_tree_client_ = 760 window_parenting_client_ =
760 base::MakeUnique<NativeWidgetMusWindowTreeClient>(hosted_window); 761 base::MakeUnique<NativeWidgetMusWindowParentingClient>(hosted_window);
761 hosted_window->AddPreTargetHandler(focus_client_.get()); 762 hosted_window->AddPreTargetHandler(focus_client_.get());
762 hosted_window->SetLayoutManager( 763 hosted_window->SetLayoutManager(
763 new ContentWindowLayoutManager(hosted_window, content_)); 764 new ContentWindowLayoutManager(hosted_window, content_));
764 capture_client_ = 765 capture_client_ =
765 base::MakeUnique<MusCaptureClient>(hosted_window, content_, window_); 766 base::MakeUnique<MusCaptureClient>(hosted_window, content_, window_);
766 767
767 content_->SetType(ui::wm::WINDOW_TYPE_NORMAL); 768 content_->SetType(ui::wm::WINDOW_TYPE_NORMAL);
768 content_->Init(params.layer_type); 769 content_->Init(params.layer_type);
769 if (window_->visible()) 770 if (window_->visible())
770 content_->Show(); 771 content_->Show();
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 1568
1568 gfx::Path mask_path; 1569 gfx::Path mask_path;
1569 native_widget_delegate_->GetHitTestMask(&mask_path); 1570 native_widget_delegate_->GetHitTestMask(&mask_path);
1570 // TODO(jamescook): Use the full path for the mask. 1571 // TODO(jamescook): Use the full path for the mask.
1571 gfx::Rect mask_rect = 1572 gfx::Rect mask_rect =
1572 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); 1573 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds()));
1573 window_->SetHitTestMask(mask_rect); 1574 window_->SetHitTestMask(mask_rect);
1574 } 1575 }
1575 1576
1576 } // namespace views 1577 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/native_widget_mus.h ('k') | ui/views/widget/desktop_aura/desktop_native_widget_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698