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

Side by Side Diff: ash/mus/non_client_frame_controller.cc

Issue 2613793002: Removes/promotes functions from WmWindowMus to WmWindowAura (Closed)
Patch Set: move WmWindowAuraTestApi to ash/test Created 3 years, 11 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
« no previous file with comments | « ash/mus/bridge/wm_window_mus_test_api.cc ('k') | ash/mus/test/wm_test_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ash/mus/non_client_frame_controller.h" 5 #include "ash/mus/non_client_frame_controller.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "ash/common/ash_constants.h" 13 #include "ash/common/ash_constants.h"
14 #include "ash/common/ash_layout_constants.h" 14 #include "ash/common/ash_layout_constants.h"
15 #include "ash/common/frame/custom_frame_view_ash.h" 15 #include "ash/common/frame/custom_frame_view_ash.h"
16 #include "ash/common/wm/panels/panel_frame_view.h" 16 #include "ash/common/wm/panels/panel_frame_view.h"
17 #include "ash/mus/bridge/wm_window_mus.h" 17 #include "ash/mus/bridge/wm_window_mus.h"
18 #include "ash/mus/frame/custom_frame_view_mus.h" 18 #include "ash/mus/frame/custom_frame_view_mus.h"
19 #include "ash/mus/frame/detached_title_area_renderer.h" 19 #include "ash/mus/frame/detached_title_area_renderer.h"
20 #include "ash/mus/move_event_handler.h" 20 #include "ash/mus/move_event_handler.h"
21 #include "ash/mus/property_util.h" 21 #include "ash/mus/property_util.h"
22 #include "ash/mus/shadow.h" 22 #include "ash/mus/shadow.h"
23 #include "ash/mus/window_manager.h" 23 #include "ash/mus/window_manager.h"
24 #include "ash/mus/window_properties.h" 24 #include "ash/mus/window_properties.h"
25 #include "ash/shared/immersive_fullscreen_controller_delegate.h" 25 #include "ash/shared/immersive_fullscreen_controller_delegate.h"
26 #include "ash/wm/window_properties.h"
26 #include "base/macros.h" 27 #include "base/macros.h"
27 #include "base/memory/ptr_util.h" 28 #include "base/memory/ptr_util.h"
28 #include "base/strings/utf_string_conversions.h" 29 #include "base/strings/utf_string_conversions.h"
29 #include "services/ui/public/interfaces/window_manager.mojom.h" 30 #include "services/ui/public/interfaces/window_manager.mojom.h"
30 #include "ui/aura/client/aura_constants.h" 31 #include "ui/aura/client/aura_constants.h"
31 #include "ui/aura/mus/property_converter.h" 32 #include "ui/aura/mus/property_converter.h"
32 #include "ui/aura/mus/property_utils.h" 33 #include "ui/aura/mus/property_utils.h"
33 #include "ui/aura/mus/window_manager_delegate.h" 34 #include "ui/aura/mus/window_manager_delegate.h"
34 #include "ui/aura/mus/window_port_mus.h" 35 #include "ui/aura/mus/window_port_mus.h"
35 #include "ui/aura/window.h" 36 #include "ui/aura/window.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 params.parent = parent; 301 params.parent = parent;
301 params.context = context; 302 params.context = context;
302 // TODO: properly set |params.activatable|. Should key off whether underlying 303 // TODO: properly set |params.activatable|. Should key off whether underlying
303 // (mus) window can have focus. 304 // (mus) window can have focus.
304 params.delegate = this; 305 params.delegate = this;
305 params.bounds = bounds; 306 params.bounds = bounds;
306 WmNativeWidgetAura* native_widget = new WmNativeWidgetAura( 307 WmNativeWidgetAura* native_widget = new WmNativeWidgetAura(
307 widget_, window_manager_client_, ShouldRemoveStandardFrame(*properties), 308 widget_, window_manager_client_, ShouldRemoveStandardFrame(*properties),
308 ShouldEnableImmersive(*properties)); 309 ShouldEnableImmersive(*properties));
309 window_ = native_widget->GetNativeView(); 310 window_ = native_widget->GetNativeView();
310 WmWindowMus* wm_window = WmWindowMus::Get(window_); 311 window_->SetProperty(kWidgetCreationTypeKey, WidgetCreationType::FOR_CLIENT);
311 wm_window->set_widget(widget_, WmWindowMus::WidgetCreationType::FOR_CLIENT);
312 window_->AddObserver(this); 312 window_->AddObserver(this);
313 params.native_widget = native_widget; 313 params.native_widget = native_widget;
314 aura::SetWindowType(window_, window_type); 314 aura::SetWindowType(window_, window_type);
315 aura::PropertyConverter* property_converter = 315 aura::PropertyConverter* property_converter =
316 window_manager->property_converter(); 316 window_manager->property_converter();
317 for (auto& property_pair : *properties) { 317 for (auto& property_pair : *properties) {
318 property_converter->SetPropertyFromTransportValue( 318 property_converter->SetPropertyFromTransportValue(
319 window_, property_pair.first, &property_pair.second); 319 window_, property_pair.first, &property_pair.second);
320 } 320 }
321 // Applying properties will have set the show state if specified. 321 // Applying properties will have set the show state if specified.
322 // NativeWidgetAura resets the show state from |params|, so we need to update 322 // NativeWidgetAura resets the show state from |params|, so we need to update
323 // |params|. 323 // |params|.
324 params.show_state = window_->GetProperty(aura::client::kShowStateKey); 324 params.show_state = window_->GetProperty(aura::client::kShowStateKey);
325 widget_->Init(params); 325 widget_->Init(params);
326 did_init_native_widget_ = true; 326 did_init_native_widget_ = true;
327 327
328 widget_->ShowInactive(); 328 widget_->ShowInactive();
329 329
330 const int shadow_inset = 330 const int shadow_inset =
331 Shadow::GetInteriorInsetForStyle(Shadow::STYLE_ACTIVE); 331 Shadow::GetInteriorInsetForStyle(Shadow::STYLE_ACTIVE);
332 WmWindowMus* wm_window = WmWindowMus::Get(window_);
332 const gfx::Insets extended_hit_region = 333 const gfx::Insets extended_hit_region =
333 wm_window->ShouldUseExtendedHitRegion() ? GetExtendedHitRegion() 334 wm_window->ShouldUseExtendedHitRegion() ? GetExtendedHitRegion()
334 : gfx::Insets(); 335 : gfx::Insets();
335 window_manager_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( 336 window_manager_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea(
336 window_, gfx::Vector2d(shadow_inset, shadow_inset), extended_hit_region); 337 window_, gfx::Vector2d(shadow_inset, shadow_inset), extended_hit_region);
337 } 338 }
338 339
339 // static 340 // static
340 NonClientFrameController* NonClientFrameController::Get(aura::Window* window) { 341 NonClientFrameController* NonClientFrameController::Get(aura::Window* window) {
341 return window->GetProperty(kNonClientFrameControllerKey); 342 return window->GetProperty(kNonClientFrameControllerKey);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 } 449 }
449 } 450 }
450 451
451 void NonClientFrameController::OnWindowDestroyed(aura::Window* window) { 452 void NonClientFrameController::OnWindowDestroyed(aura::Window* window) {
452 window_->RemoveObserver(this); 453 window_->RemoveObserver(this);
453 window_ = nullptr; 454 window_ = nullptr;
454 } 455 }
455 456
456 } // namespace mus 457 } // namespace mus
457 } // namespace ash 458 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/bridge/wm_window_mus_test_api.cc ('k') | ash/mus/test/wm_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698