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

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

Issue 2759643003: Add system modals to the proper container in mus+ash. (Closed)
Patch Set: Remove extra code. Created 3 years, 9 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/window_manager.h ('k') | mash/simple_wm/simple_wm.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/window_manager.h" 5 #include "ash/mus/window_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 20 matching lines...) Expand all
31 #include "ash/shell_init_params.h" 31 #include "ash/shell_init_params.h"
32 #include "ash/wm/ash_focus_rules.h" 32 #include "ash/wm/ash_focus_rules.h"
33 #include "base/memory/ptr_util.h" 33 #include "base/memory/ptr_util.h"
34 #include "base/threading/sequenced_worker_pool.h" 34 #include "base/threading/sequenced_worker_pool.h"
35 #include "services/service_manager/public/cpp/connector.h" 35 #include "services/service_manager/public/cpp/connector.h"
36 #include "services/ui/common/accelerator_util.h" 36 #include "services/ui/common/accelerator_util.h"
37 #include "services/ui/common/types.h" 37 #include "services/ui/common/types.h"
38 #include "services/ui/public/cpp/property_type_converters.h" 38 #include "services/ui/public/cpp/property_type_converters.h"
39 #include "services/ui/public/interfaces/constants.mojom.h" 39 #include "services/ui/public/interfaces/constants.mojom.h"
40 #include "services/ui/public/interfaces/window_manager.mojom.h" 40 #include "services/ui/public/interfaces/window_manager.mojom.h"
41 #include "ui/aura/client/aura_constants.h"
41 #include "ui/aura/client/window_parenting_client.h" 42 #include "ui/aura/client/window_parenting_client.h"
42 #include "ui/aura/env.h" 43 #include "ui/aura/env.h"
43 #include "ui/aura/mus/capture_synchronizer.h" 44 #include "ui/aura/mus/capture_synchronizer.h"
44 #include "ui/aura/mus/property_converter.h" 45 #include "ui/aura/mus/property_converter.h"
45 #include "ui/aura/mus/window_tree_client.h" 46 #include "ui/aura/mus/window_tree_client.h"
46 #include "ui/aura/mus/window_tree_host_mus.h" 47 #include "ui/aura/mus/window_tree_host_mus.h"
47 #include "ui/aura/window.h" 48 #include "ui/aura/window.h"
48 #include "ui/base/class_property.h" 49 #include "ui/base/class_property.h"
49 #include "ui/base/hit_test.h" 50 #include "ui/base/hit_test.h"
50 #include "ui/display/display_observer.h" 51 #include "ui/display/display_observer.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 bool WindowManager::OnWmSetProperty( 315 bool WindowManager::OnWmSetProperty(
315 aura::Window* window, 316 aura::Window* window,
316 const std::string& name, 317 const std::string& name,
317 std::unique_ptr<std::vector<uint8_t>>* new_data) { 318 std::unique_ptr<std::vector<uint8_t>>* new_data) {
318 if (property_converter_->IsTransportNameRegistered(name)) 319 if (property_converter_->IsTransportNameRegistered(name))
319 return true; 320 return true;
320 DVLOG(1) << "unknown property changed, ignoring " << name; 321 DVLOG(1) << "unknown property changed, ignoring " << name;
321 return false; 322 return false;
322 } 323 }
323 324
325 void WindowManager::OnWmSetModalType(aura::Window* window, ui::ModalType type) {
sky 2017/03/17 21:37:46 I'm a little surprised we need this, but I guess t
326 ui::ModalType old_type = window->GetProperty(aura::client::kModalKey);
327 if (type == old_type)
328 return;
329
330 window->SetProperty(aura::client::kModalKey, type);
331 if (type != ui::MODAL_TYPE_SYSTEM && old_type != ui::MODAL_TYPE_SYSTEM)
332 return;
333
334 if (window->parent())
335 window->parent()->RemoveChild(window);
336 int32_t new_container_id = type == ui::MODAL_TYPE_SYSTEM
sky 2017/03/17 21:37:46 Can you use GetDefaultParent? In container_finder?
Hadi 2017/03/20 15:03:29 Done.
337 ? kShellWindowId_SystemModalContainer
338 : kShellWindowId_DefaultContainer;
339 Shell::GetContainer(Shell::GetPrimaryRootWindow(), new_container_id)
340 ->AddChild(window);
341 }
342
324 void WindowManager::OnWmSetCanFocus(aura::Window* window, bool can_focus) { 343 void WindowManager::OnWmSetCanFocus(aura::Window* window, bool can_focus) {
325 NonClientFrameController* non_client_frame_controller = 344 NonClientFrameController* non_client_frame_controller =
326 NonClientFrameController::Get(window); 345 NonClientFrameController::Get(window);
327 if (non_client_frame_controller) 346 if (non_client_frame_controller)
328 non_client_frame_controller->set_can_activate(can_focus); 347 non_client_frame_controller->set_can_activate(can_focus);
329 } 348 }
330 349
331 aura::Window* WindowManager::OnWmCreateTopLevelWindow( 350 aura::Window* WindowManager::OnWmCreateTopLevelWindow(
332 ui::mojom::WindowType window_type, 351 ui::mojom::WindowType window_type,
333 std::map<std::string, std::vector<uint8_t>>* properties) { 352 std::map<std::string, std::vector<uint8_t>>* properties) {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 bool WindowManager::IsWindowActive(aura::Window* window) { 474 bool WindowManager::IsWindowActive(aura::Window* window) {
456 return Shell::GetInstance()->activation_client()->GetActiveWindow() == window; 475 return Shell::GetInstance()->activation_client()->GetActiveWindow() == window;
457 } 476 }
458 477
459 void WindowManager::OnWmDeactivateWindow(aura::Window* window) { 478 void WindowManager::OnWmDeactivateWindow(aura::Window* window) {
460 Shell::GetInstance()->activation_client()->DeactivateWindow(window); 479 Shell::GetInstance()->activation_client()->DeactivateWindow(window);
461 } 480 }
462 481
463 } // namespace mus 482 } // namespace mus
464 } // namespace ash 483 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/window_manager.h ('k') | mash/simple_wm/simple_wm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698