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

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

Issue 2702423004: Validate incoming window properties. (Closed)
Patch Set: sky comments Created 3 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
« no previous file with comments | « no previous file | ash/public/cpp/BUILD.gn » ('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
11 #include "ash/common/session/session_controller.h" 11 #include "ash/common/session/session_controller.h"
12 #include "ash/common/wm/container_finder.h" 12 #include "ash/common/wm/container_finder.h"
13 #include "ash/common/wm/window_state.h" 13 #include "ash/common/wm/window_state.h"
14 #include "ash/common/wm_window.h" 14 #include "ash/common/wm_window.h"
15 #include "ash/mus/accelerators/accelerator_handler.h" 15 #include "ash/mus/accelerators/accelerator_handler.h"
16 #include "ash/mus/accelerators/accelerator_ids.h" 16 #include "ash/mus/accelerators/accelerator_ids.h"
17 #include "ash/mus/bridge/wm_lookup_mus.h" 17 #include "ash/mus/bridge/wm_lookup_mus.h"
18 #include "ash/mus/bridge/wm_shell_mus.h" 18 #include "ash/mus/bridge/wm_shell_mus.h"
19 #include "ash/mus/move_event_handler.h" 19 #include "ash/mus/move_event_handler.h"
20 #include "ash/mus/non_client_frame_controller.h" 20 #include "ash/mus/non_client_frame_controller.h"
21 #include "ash/mus/property_util.h" 21 #include "ash/mus/property_util.h"
22 #include "ash/mus/screen_mus.h" 22 #include "ash/mus/screen_mus.h"
23 #include "ash/mus/shell_delegate_mus.h" 23 #include "ash/mus/shell_delegate_mus.h"
24 #include "ash/mus/top_level_window_factory.h" 24 #include "ash/mus/top_level_window_factory.h"
25 #include "ash/mus/window_properties.h" 25 #include "ash/mus/window_properties.h"
26 #include "ash/public/cpp/shelf_types.h"
26 #include "ash/public/cpp/shell_window_ids.h" 27 #include "ash/public/cpp/shell_window_ids.h"
27 #include "ash/public/cpp/window_properties.h" 28 #include "ash/public/cpp/window_properties.h"
28 #include "ash/root_window_controller.h" 29 #include "ash/root_window_controller.h"
29 #include "ash/root_window_settings.h" 30 #include "ash/root_window_settings.h"
30 #include "ash/shell.h" 31 #include "ash/shell.h"
31 #include "ash/shell_init_params.h" 32 #include "ash/shell_init_params.h"
32 #include "ash/wm/ash_focus_rules.h" 33 #include "ash/wm/ash_focus_rules.h"
33 #include "base/memory/ptr_util.h" 34 #include "base/memory/ptr_util.h"
34 #include "base/threading/sequenced_worker_pool.h" 35 #include "base/threading/sequenced_worker_pool.h"
35 #include "services/service_manager/public/cpp/connector.h" 36 #include "services/service_manager/public/cpp/connector.h"
(...skipping 22 matching lines...) Expand all
58 59
59 namespace ash { 60 namespace ash {
60 namespace mus { 61 namespace mus {
61 62
62 // TODO: need to register OSExchangeDataProviderMus. http://crbug.com/665077. 63 // TODO: need to register OSExchangeDataProviderMus. http://crbug.com/665077.
63 WindowManager::WindowManager(service_manager::Connector* connector) 64 WindowManager::WindowManager(service_manager::Connector* connector)
64 : connector_(connector), 65 : connector_(connector),
65 wm_state_(base::MakeUnique<::wm::WMState>()), 66 wm_state_(base::MakeUnique<::wm::WMState>()),
66 property_converter_(base::MakeUnique<aura::PropertyConverter>()) { 67 property_converter_(base::MakeUnique<aura::PropertyConverter>()) {
67 property_converter_->RegisterProperty( 68 property_converter_->RegisterProperty(
68 kPanelAttachedKey, ui::mojom::WindowManager::kPanelAttached_Property); 69 kPanelAttachedKey, ui::mojom::WindowManager::kPanelAttached_Property,
70 aura::PropertyConverter::CreateAcceptAnyValueCallback());
69 property_converter_->RegisterProperty( 71 property_converter_->RegisterProperty(
70 kRenderTitleAreaProperty, 72 kRenderTitleAreaProperty,
71 ui::mojom::WindowManager::kRenderParentTitleArea_Property); 73 ui::mojom::WindowManager::kRenderParentTitleArea_Property,
74 aura::PropertyConverter::CreateAcceptAnyValueCallback());
72 property_converter_->RegisterProperty( 75 property_converter_->RegisterProperty(
73 kShelfItemTypeKey, ui::mojom::WindowManager::kShelfItemType_Property); 76 kShelfItemTypeKey, ui::mojom::WindowManager::kShelfItemType_Property,
77 base::Bind(&IsValidShelfItemType));
74 property_converter_->RegisterProperty( 78 property_converter_->RegisterProperty(
75 ::wm::kShadowElevationKey, 79 ::wm::kShadowElevationKey,
76 ui::mojom::WindowManager::kShadowElevation_Property); 80 ui::mojom::WindowManager::kShadowElevation_Property,
81 base::Bind(&::wm::IsValidShadowElevation));
77 } 82 }
78 83
79 WindowManager::~WindowManager() { 84 WindowManager::~WindowManager() {
80 Shutdown(); 85 Shutdown();
81 ash::Shell::set_window_tree_client(nullptr); 86 ash::Shell::set_window_tree_client(nullptr);
82 ash::Shell::set_window_manager_client(nullptr); 87 ash::Shell::set_window_manager_client(nullptr);
83 } 88 }
84 89
85 void WindowManager::Init( 90 void WindowManager::Init(
86 std::unique_ptr<aura::WindowTreeClient> window_tree_client, 91 std::unique_ptr<aura::WindowTreeClient> window_tree_client,
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 bool WindowManager::IsWindowActive(aura::Window* window) { 467 bool WindowManager::IsWindowActive(aura::Window* window) {
463 return Shell::GetInstance()->activation_client()->GetActiveWindow() == window; 468 return Shell::GetInstance()->activation_client()->GetActiveWindow() == window;
464 } 469 }
465 470
466 void WindowManager::OnWmDeactivateWindow(aura::Window* window) { 471 void WindowManager::OnWmDeactivateWindow(aura::Window* window) {
467 Shell::GetInstance()->activation_client()->DeactivateWindow(window); 472 Shell::GetInstance()->activation_client()->DeactivateWindow(window);
468 } 473 }
469 474
470 } // namespace mus 475 } // namespace mus
471 } // namespace ash 476 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/public/cpp/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698