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

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

Issue 1639563003: Renames WindowManagerConfig to FrameDecorationValues and moves to Display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 years, 10 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 "ui/views/mus/native_widget_mus.h" 5 #include "ui/views/mus/native_widget_mus.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/thread_task_runner_handle.h" 8 #include "base/thread_task_runner_handle.h"
9 #include "components/mus/public/cpp/property_type_converters.h" 9 #include "components/mus/public/cpp/property_type_converters.h"
10 #include "components/mus/public/cpp/window.h" 10 #include "components/mus/public/cpp/window.h"
11 #include "components/mus/public/cpp/window_property.h" 11 #include "components/mus/public/cpp/window_property.h"
12 #include "components/mus/public/cpp/window_tree_connection.h"
12 #include "mojo/converters/geometry/geometry_type_converters.h" 13 #include "mojo/converters/geometry/geometry_type_converters.h"
13 #include "ui/aura/client/default_capture_client.h" 14 #include "ui/aura/client/default_capture_client.h"
14 #include "ui/aura/client/window_tree_client.h" 15 #include "ui/aura/client/window_tree_client.h"
15 #include "ui/aura/env.h" 16 #include "ui/aura/env.h"
16 #include "ui/aura/layout_manager.h" 17 #include "ui/aura/layout_manager.h"
17 #include "ui/aura/mus/mus_util.h" 18 #include "ui/aura/mus/mus_util.h"
18 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
19 #include "ui/aura/window_property.h" 20 #include "ui/aura/window_property.h"
20 #include "ui/base/hit_test.h" 21 #include "ui/base/hit_test.h"
21 #include "ui/gfx/canvas.h" 22 #include "ui/gfx/canvas.h"
22 #include "ui/native_theme/native_theme_aura.h" 23 #include "ui/native_theme/native_theme_aura.h"
23 #include "ui/views/mus/platform_window_mus.h" 24 #include "ui/views/mus/platform_window_mus.h"
24 #include "ui/views/mus/surface_context_factory.h" 25 #include "ui/views/mus/surface_context_factory.h"
25 #include "ui/views/mus/window_manager_constants_converters.h" 26 #include "ui/views/mus/window_manager_constants_converters.h"
26 #include "ui/views/mus/window_manager_frame_values.h" 27 #include "ui/views/mus/window_manager_frame_values.h"
27 #include "ui/views/mus/window_tree_host_mus.h" 28 #include "ui/views/mus/window_tree_host_mus.h"
28 #include "ui/views/widget/widget_delegate.h" 29 #include "ui/views/widget/widget_delegate.h"
29 #include "ui/views/window/custom_frame_view.h" 30 #include "ui/views/window/custom_frame_view.h"
30 #include "ui/wm/core/base_focus_rules.h" 31 #include "ui/wm/core/base_focus_rules.h"
31 #include "ui/wm/core/capture_controller.h" 32 #include "ui/wm/core/capture_controller.h"
32 #include "ui/wm/core/focus_controller.h" 33 #include "ui/wm/core/focus_controller.h"
33 34
34 DECLARE_WINDOW_PROPERTY_TYPE(mus::Window*); 35 DECLARE_WINDOW_PROPERTY_TYPE(mus::Window*);
35 36
36 namespace views { 37 namespace views {
37 namespace { 38 namespace {
38 39
39 DEFINE_WINDOW_PROPERTY_KEY(mus::Window*, kMusWindow, nullptr); 40 DEFINE_WINDOW_PROPERTY_KEY(mus::Window*, kMusWindow, nullptr);
40 41
42 MUS_DEFINE_WINDOW_PROPERTY_KEY(NativeWidgetMus*, kNativeWidgetMusKey, nullptr);
43
41 // TODO: figure out what this should be. 44 // TODO: figure out what this should be.
42 class FocusRulesImpl : public wm::BaseFocusRules { 45 class FocusRulesImpl : public wm::BaseFocusRules {
43 public: 46 public:
44 FocusRulesImpl() {} 47 FocusRulesImpl() {}
45 ~FocusRulesImpl() override {} 48 ~FocusRulesImpl() override {}
46 49
47 bool SupportsChildActivation(aura::Window* window) const override { 50 bool SupportsChildActivation(aura::Window* window) const override {
48 return true; 51 return true;
49 } 52 }
50 53
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 : window_(window), 181 : window_(window),
179 shell_(shell), 182 shell_(shell),
180 native_widget_delegate_(delegate), 183 native_widget_delegate_(delegate),
181 surface_type_(surface_type), 184 surface_type_(surface_type),
182 show_state_before_fullscreen_(ui::PLATFORM_WINDOW_STATE_UNKNOWN), 185 show_state_before_fullscreen_(ui::PLATFORM_WINDOW_STATE_UNKNOWN),
183 ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET), 186 ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET),
184 content_(new aura::Window(this)), 187 content_(new aura::Window(this)),
185 close_widget_factory_(this) { 188 close_widget_factory_(this) {
186 // TODO(fsamuel): Figure out lifetime of |window_|. 189 // TODO(fsamuel): Figure out lifetime of |window_|.
187 aura::SetMusWindow(content_, window_); 190 aura::SetMusWindow(content_, window_);
191
192 window->SetLocalProperty(kNativeWidgetMusKey, this);
188 } 193 }
189 194
190 NativeWidgetMus::~NativeWidgetMus() { 195 NativeWidgetMus::~NativeWidgetMus() {
191 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) 196 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET)
192 delete native_widget_delegate_; 197 delete native_widget_delegate_;
193 else 198 else
194 CloseNow(); 199 CloseNow();
195 } 200 }
196 201
202 // static
203 void NativeWidgetMus::NotifyFrameChanged(
204 mus::WindowTreeConnection* connection) {
205 for (mus::Window* window : connection->GetRoots()) {
206 NativeWidgetMus* native_widget =
207 window->GetLocalProperty(kNativeWidgetMusKey);
208 if (native_widget && native_widget->GetWidget()->non_client_view()) {
209 native_widget->GetWidget()->non_client_view()->Layout();
210 native_widget->GetWidget()->non_client_view()->SchedulePaint();
211 native_widget->UpdateClientArea();
212 }
213 }
214 }
215
197 void NativeWidgetMus::OnPlatformWindowClosed() { 216 void NativeWidgetMus::OnPlatformWindowClosed() {
198 native_widget_delegate_->OnNativeWidgetDestroying(); 217 native_widget_delegate_->OnNativeWidgetDestroying();
199 218
200 window_tree_client_.reset(); // Uses |content_|. 219 window_tree_client_.reset(); // Uses |content_|.
201 capture_client_.reset(); // Uses |content_|. 220 capture_client_.reset(); // Uses |content_|.
202 221
203 window_tree_host_->RemoveObserver(this); 222 window_tree_host_->RemoveObserver(this);
204 window_tree_host_.reset(); 223 window_tree_host_.reset();
205 224
206 window_ = nullptr; 225 window_ = nullptr;
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 849
831 void NativeWidgetMus::OnGestureEvent(ui::GestureEvent* event) { 850 void NativeWidgetMus::OnGestureEvent(ui::GestureEvent* event) {
832 native_widget_delegate_->OnGestureEvent(event); 851 native_widget_delegate_->OnGestureEvent(event);
833 } 852 }
834 853
835 void NativeWidgetMus::OnHostCloseRequested(const aura::WindowTreeHost* host) { 854 void NativeWidgetMus::OnHostCloseRequested(const aura::WindowTreeHost* host) {
836 GetWidget()->Close(); 855 GetWidget()->Close();
837 } 856 }
838 857
839 } // namespace views 858 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698