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

Side by Side Diff: ash/sysui/sysui_application.cc

Issue 2024313002: Moves mash/wm/public -> ash/public (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: extra Created 4 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/sysui/sysui_application.h" 5 #include "ash/sysui/sysui_application.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "ash/desktop_background/desktop_background_controller.h" 12 #include "ash/desktop_background/desktop_background_controller.h"
13 #include "ash/host/ash_window_tree_host_init_params.h" 13 #include "ash/host/ash_window_tree_host_init_params.h"
14 #include "ash/host/ash_window_tree_host_platform.h" 14 #include "ash/host/ash_window_tree_host_platform.h"
15 #include "ash/material_design/material_design_controller.h" 15 #include "ash/material_design/material_design_controller.h"
16 #include "ash/public/interfaces/ash_window_type.mojom.h"
17 #include "ash/public/interfaces/container.mojom.h"
16 #include "ash/root_window_settings.h" 18 #include "ash/root_window_settings.h"
17 #include "ash/shell.h" 19 #include "ash/shell.h"
18 #include "ash/shell_init_params.h" 20 #include "ash/shell_init_params.h"
19 #include "ash/shell_window_ids.h" 21 #include "ash/shell_window_ids.h"
20 #include "ash/sysui/app_list_presenter_mus.h" 22 #include "ash/sysui/app_list_presenter_mus.h"
21 #include "ash/sysui/keyboard_ui_mus.h" 23 #include "ash/sysui/keyboard_ui_mus.h"
22 #include "ash/sysui/shelf_delegate_mus.h" 24 #include "ash/sysui/shelf_delegate_mus.h"
23 #include "ash/sysui/shell_delegate_mus.h" 25 #include "ash/sysui/shell_delegate_mus.h"
24 #include "ash/sysui/stub_context_factory.h" 26 #include "ash/sysui/stub_context_factory.h"
25 #include "base/bind.h" 27 #include "base/bind.h"
26 #include "base/files/file_path.h" 28 #include "base/files/file_path.h"
27 #include "base/path_service.h" 29 #include "base/path_service.h"
28 #include "base/threading/sequenced_worker_pool.h" 30 #include "base/threading/sequenced_worker_pool.h"
29 #include "components/mus/public/cpp/property_type_converters.h" 31 #include "components/mus/public/cpp/property_type_converters.h"
30 #include "mash/wm/public/interfaces/ash_window_type.mojom.h"
31 #include "mash/wm/public/interfaces/container.mojom.h"
32 #include "services/catalog/public/cpp/resource_loader.h" 32 #include "services/catalog/public/cpp/resource_loader.h"
33 #include "services/shell/public/cpp/connector.h" 33 #include "services/shell/public/cpp/connector.h"
34 #include "ui/aura/env.h" 34 #include "ui/aura/env.h"
35 #include "ui/base/resource/resource_bundle.h" 35 #include "ui/base/resource/resource_bundle.h"
36 #include "ui/base/ui_base_paths.h" 36 #include "ui/base/ui_base_paths.h"
37 #include "ui/message_center/message_center.h" 37 #include "ui/message_center/message_center.h"
38 #include "ui/platform_window/stub/stub_window.h" 38 #include "ui/platform_window/stub/stub_window.h"
39 #include "ui/views/mus/aura_init.h" 39 #include "ui/views/mus/aura_init.h"
40 #include "ui/views/mus/native_widget_mus.h" 40 #include "ui/views/mus/native_widget_mus.h"
41 #include "ui/views/mus/window_manager_connection.h" 41 #include "ui/views/mus/window_manager_connection.h"
(...skipping 11 matching lines...) Expand all
53 namespace ash { 53 namespace ash {
54 namespace sysui { 54 namespace sysui {
55 55
56 namespace { 56 namespace {
57 57
58 const char kResourceFileStrings[] = "ash_resources_strings.pak"; 58 const char kResourceFileStrings[] = "ash_resources_strings.pak";
59 const char kResourceFile100[] = "ash_resources_100_percent.pak"; 59 const char kResourceFile100[] = "ash_resources_100_percent.pak";
60 const char kResourceFile200[] = "ash_resources_200_percent.pak"; 60 const char kResourceFile200[] = "ash_resources_200_percent.pak";
61 61
62 // Tries to determine the corresponding mash container from widget init params. 62 // Tries to determine the corresponding mash container from widget init params.
63 mash::wm::mojom::Container GetContainerId( 63 mojom::Container GetContainerId(const views::Widget::InitParams& params) {
64 const views::Widget::InitParams& params) {
65 const int id = params.parent->id(); 64 const int id = params.parent->id();
66 if (id == kShellWindowId_DesktopBackgroundContainer) 65 if (id == kShellWindowId_DesktopBackgroundContainer)
67 return mash::wm::mojom::Container::USER_BACKGROUND; 66 return mojom::Container::USER_BACKGROUND;
68 if (id == kShellWindowId_ShelfContainer) 67 if (id == kShellWindowId_ShelfContainer)
69 return mash::wm::mojom::Container::USER_PRIVATE_SHELF; 68 return mojom::Container::USER_PRIVATE_SHELF;
70 if (id == kShellWindowId_StatusContainer) 69 if (id == kShellWindowId_StatusContainer)
71 return mash::wm::mojom::Container::STATUS; 70 return mojom::Container::STATUS;
72 71
73 // Determine the container based on Widget type. 72 // Determine the container based on Widget type.
74 switch (params.type) { 73 switch (params.type) {
75 case views::Widget::InitParams::Type::TYPE_BUBBLE: 74 case views::Widget::InitParams::Type::TYPE_BUBBLE:
76 return mash::wm::mojom::Container::BUBBLES; 75 return mojom::Container::BUBBLES;
77 case views::Widget::InitParams::Type::TYPE_MENU: 76 case views::Widget::InitParams::Type::TYPE_MENU:
78 return mash::wm::mojom::Container::MENUS; 77 return mojom::Container::MENUS;
79 case views::Widget::InitParams::Type::TYPE_TOOLTIP: 78 case views::Widget::InitParams::Type::TYPE_TOOLTIP:
80 return mash::wm::mojom::Container::DRAG_AND_TOOLTIPS; 79 return mojom::Container::DRAG_AND_TOOLTIPS;
81 default: 80 default:
82 return mash::wm::mojom::Container::COUNT; 81 return mojom::Container::COUNT;
83 } 82 }
84 } 83 }
85 84
86 // Tries to determine the corresponding ash window type from the ash container 85 // Tries to determine the corresponding ash window type from the ash container
87 // for the widget. 86 // for the widget.
88 mash::wm::mojom::AshWindowType GetAshWindowType(aura::Window* container) { 87 mojom::AshWindowType GetAshWindowType(aura::Window* container) {
89 DCHECK(container); 88 DCHECK(container);
90 int id = container->id(); 89 int id = container->id();
91 if (id == kShellWindowId_ShelfContainer) 90 if (id == kShellWindowId_ShelfContainer)
92 return mash::wm::mojom::AshWindowType::SHELF; 91 return mojom::AshWindowType::SHELF;
93 if (id == kShellWindowId_StatusContainer) 92 if (id == kShellWindowId_StatusContainer)
94 return mash::wm::mojom::AshWindowType::STATUS_AREA; 93 return mojom::AshWindowType::STATUS_AREA;
95 return mash::wm::mojom::AshWindowType::COUNT; 94 return mojom::AshWindowType::COUNT;
96 } 95 }
97 96
98 // Creates a StubWindow, which means this window never receives any input event, 97 // Creates a StubWindow, which means this window never receives any input event,
99 // or displays anything to the user. 98 // or displays anything to the user.
100 class AshWindowTreeHostMus : public AshWindowTreeHostPlatform { 99 class AshWindowTreeHostMus : public AshWindowTreeHostPlatform {
101 public: 100 public:
102 explicit AshWindowTreeHostMus(const gfx::Rect& initial_bounds) 101 explicit AshWindowTreeHostMus(const gfx::Rect& initial_bounds)
103 : AshWindowTreeHostPlatform() { 102 : AshWindowTreeHostPlatform() {
104 std::unique_ptr<ui::PlatformWindow> window(new ui::StubWindow(this)); 103 std::unique_ptr<ui::PlatformWindow> window(new ui::StubWindow(this));
105 window->SetBounds(initial_bounds); 104 window->SetBounds(initial_bounds);
(...skipping 28 matching lines...) Expand all
134 ViewsDelegate::GetInstance()->set_native_widget_factory( 133 ViewsDelegate::GetInstance()->set_native_widget_factory(
135 ViewsDelegate::NativeWidgetFactory()); 134 ViewsDelegate::NativeWidgetFactory());
136 } 135 }
137 136
138 private: 137 private:
139 views::NativeWidget* InitNativeWidget( 138 views::NativeWidget* InitNativeWidget(
140 const views::Widget::InitParams& params, 139 const views::Widget::InitParams& params,
141 views::internal::NativeWidgetDelegate* delegate) { 140 views::internal::NativeWidgetDelegate* delegate) {
142 std::map<std::string, std::vector<uint8_t>> properties; 141 std::map<std::string, std::vector<uint8_t>> properties;
143 if (params.parent) { 142 if (params.parent) {
144 mash::wm::mojom::Container container = GetContainerId(params); 143 mojom::Container container = GetContainerId(params);
145 if (container != mash::wm::mojom::Container::COUNT) { 144 if (container != mojom::Container::COUNT) {
146 properties[mash::wm::mojom::kWindowContainer_Property] = 145 properties[mojom::kWindowContainer_Property] =
147 mojo::ConvertTo<std::vector<uint8_t>>( 146 mojo::ConvertTo<std::vector<uint8_t>>(
148 static_cast<int32_t>(container)); 147 static_cast<int32_t>(container));
149 } 148 }
150 mash::wm::mojom::AshWindowType type = GetAshWindowType(params.parent); 149 mojom::AshWindowType type = GetAshWindowType(params.parent);
151 if (type != mash::wm::mojom::AshWindowType::COUNT) { 150 if (type != mojom::AshWindowType::COUNT) {
152 properties[mash::wm::mojom::kAshWindowType_Property] = 151 properties[ash::mojom::kAshWindowType_Property] =
msw 2016/06/01 01:51:42 q: why is ash needed here, but not for mojom::kWin
sky 2016/06/01 03:30:26 My mistake. Nuked. I also removed ash:: from every
153 mojo::ConvertTo<std::vector<uint8_t>>(static_cast<int32_t>(type)); 152 mojo::ConvertTo<std::vector<uint8_t>>(static_cast<int32_t>(type));
154 } 153 }
155 } 154 }
156 155
157 // AshInit installs a stub implementation of ui::ContextFactory, so that the 156 // AshInit installs a stub implementation of ui::ContextFactory, so that the
158 // AshWindowTreeHost instances created do not actually show anything to the 157 // AshWindowTreeHost instances created do not actually show anything to the
159 // user. However, when creating a views::Widget instance, the 158 // user. However, when creating a views::Widget instance, the
160 // WindowManagerConnection creates a WindowTreeHostMus instance, which 159 // WindowManagerConnection creates a WindowTreeHostMus instance, which
161 // creates a ui::Compositor, and it needs a real ui::ContextFactory 160 // creates a ui::Compositor, and it needs a real ui::ContextFactory
162 // implementation. So, unset the context-factory here temporarily when 161 // implementation. So, unset the context-factory here temporarily when
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 void SysUIApplication::Create( 325 void SysUIApplication::Create(
327 ::shell::Connection* connection, 326 ::shell::Connection* connection,
328 mojo::InterfaceRequest<mash::shelf::mojom::ShelfController> request) { 327 mojo::InterfaceRequest<mash::shelf::mojom::ShelfController> request) {
329 mash::shelf::mojom::ShelfController* shelf_controller = 328 mash::shelf::mojom::ShelfController* shelf_controller =
330 static_cast<ShelfDelegateMus*>(Shell::GetInstance()->GetShelfDelegate()); 329 static_cast<ShelfDelegateMus*>(Shell::GetInstance()->GetShelfDelegate());
331 shelf_controller_bindings_.AddBinding(shelf_controller, std::move(request)); 330 shelf_controller_bindings_.AddBinding(shelf_controller, std::move(request));
332 } 331 }
333 332
334 } // namespace sysui 333 } // namespace sysui
335 } // namespace ash 334 } // namespace ash
OLDNEW
« no previous file with comments | « ash/sysui/shelf_delegate_mus.cc ('k') | chrome/browser/chromeos/BUILD.gn » ('j') | mash/DEPS » ('J')

Powered by Google App Engine
This is Rietveld 408576698