OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/mus/mus_app.h" | 5 #include "components/mus/mus_app.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "components/mus/common/args.h" | 15 #include "components/mus/common/args.h" |
16 #include "components/mus/gles2/gpu_impl.h" | 16 #include "components/mus/gles2/gpu_impl.h" |
17 #include "components/mus/ws/display.h" | 17 #include "components/mus/ws/display.h" |
18 #include "components/mus/ws/display_binding.h" | 18 #include "components/mus/ws/display_binding.h" |
19 #include "components/mus/ws/display_manager.h" | 19 #include "components/mus/ws/display_manager.h" |
20 #include "components/mus/ws/user_display_manager.h" | 20 #include "components/mus/ws/user_display_manager.h" |
21 #include "components/mus/ws/window_server.h" | 21 #include "components/mus/ws/window_server.h" |
22 #include "components/mus/ws/window_server_test_impl.h" | 22 #include "components/mus/ws/window_server_test_impl.h" |
23 #include "components/mus/ws/window_tree.h" | 23 #include "components/mus/ws/window_tree.h" |
24 #include "components/mus/ws/window_tree_binding.h" | 24 #include "components/mus/ws/window_tree_binding.h" |
25 #include "components/mus/ws/window_tree_factory.h" | 25 #include "components/mus/ws/window_tree_factory.h" |
26 #include "components/mus/ws/window_tree_host_factory.h" | 26 #include "components/mus/ws/window_tree_host_factory.h" |
27 #include "components/resource_provider/public/cpp/resource_loader.h" | |
28 #include "mojo/public/c/system/main.h" | 27 #include "mojo/public/c/system/main.h" |
| 28 #include "services/catalog/public/cpp/resource_loader.h" |
29 #include "services/shell/public/cpp/connection.h" | 29 #include "services/shell/public/cpp/connection.h" |
30 #include "services/shell/public/cpp/connector.h" | 30 #include "services/shell/public/cpp/connector.h" |
31 #include "services/tracing/public/cpp/tracing_impl.h" | 31 #include "services/tracing/public/cpp/tracing_impl.h" |
32 #include "ui/base/resource/resource_bundle.h" | 32 #include "ui/base/resource/resource_bundle.h" |
33 #include "ui/base/ui_base_paths.h" | 33 #include "ui/base/ui_base_paths.h" |
34 #include "ui/events/event_switches.h" | 34 #include "ui/events/event_switches.h" |
35 #include "ui/events/platform/platform_event_source.h" | 35 #include "ui/events/platform/platform_event_source.h" |
36 #include "ui/gl/gl_surface.h" | 36 #include "ui/gl/gl_surface.h" |
37 | 37 |
38 #if defined(USE_X11) | 38 #if defined(USE_X11) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 void MandolineUIServicesApp::InitializeResources(shell::Connector* connector) { | 85 void MandolineUIServicesApp::InitializeResources(shell::Connector* connector) { |
86 if (ui::ResourceBundle::HasSharedInstance()) | 86 if (ui::ResourceBundle::HasSharedInstance()) |
87 return; | 87 return; |
88 | 88 |
89 std::set<std::string> resource_paths; | 89 std::set<std::string> resource_paths; |
90 resource_paths.insert(kResourceFileStrings); | 90 resource_paths.insert(kResourceFileStrings); |
91 resource_paths.insert(kResourceFile100); | 91 resource_paths.insert(kResourceFile100); |
92 resource_paths.insert(kResourceFile200); | 92 resource_paths.insert(kResourceFile200); |
93 | 93 |
94 resource_provider::ResourceLoader loader(connector, resource_paths); | 94 catalog::ResourceLoader loader; |
95 if (!loader.BlockUntilLoaded()) | 95 filesystem::DirectoryPtr directory; |
96 return; | 96 connector->ConnectToInterface("mojo:catalog", &directory); |
| 97 CHECK(loader.OpenFiles(std::move(directory), resource_paths)); |
| 98 |
97 ui::RegisterPathProvider(); | 99 ui::RegisterPathProvider(); |
98 | 100 |
99 // Initialize resource bundle with 1x and 2x cursor bitmaps. | 101 // Initialize resource bundle with 1x and 2x cursor bitmaps. |
100 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( | 102 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( |
101 loader.ReleaseFile(kResourceFileStrings), | 103 loader.TakeFile(kResourceFileStrings), |
102 base::MemoryMappedFile::Region::kWholeFile); | 104 base::MemoryMappedFile::Region::kWholeFile); |
103 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 105 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
104 rb.AddDataPackFromFile(loader.ReleaseFile(kResourceFile100), | 106 rb.AddDataPackFromFile(loader.TakeFile(kResourceFile100), |
105 ui::SCALE_FACTOR_100P); | 107 ui::SCALE_FACTOR_100P); |
106 rb.AddDataPackFromFile(loader.ReleaseFile(kResourceFile200), | 108 rb.AddDataPackFromFile(loader.TakeFile(kResourceFile200), |
107 ui::SCALE_FACTOR_200P); | 109 ui::SCALE_FACTOR_200P); |
108 } | 110 } |
109 | 111 |
110 MandolineUIServicesApp::UserState* MandolineUIServicesApp::GetUserState( | 112 MandolineUIServicesApp::UserState* MandolineUIServicesApp::GetUserState( |
111 shell::Connection* connection) { | 113 shell::Connection* connection) { |
112 const ws::UserId& user_id = connection->GetRemoteIdentity().user_id(); | 114 const ws::UserId& user_id = connection->GetRemoteIdentity().user_id(); |
113 auto it = user_id_to_user_state_.find(user_id); | 115 auto it = user_id_to_user_state_.find(user_id); |
114 if (it != user_id_to_user_state_.end()) | 116 if (it != user_id_to_user_state_.end()) |
115 return it->second.get(); | 117 return it->second.get(); |
116 user_id_to_user_state_[user_id] = base::WrapUnique(new UserState); | 118 user_id_to_user_state_[user_id] = base::WrapUnique(new UserState); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 new ws::WindowServerTestImpl(window_server_.get(), std::move(request)); | 269 new ws::WindowServerTestImpl(window_server_.get(), std::move(request)); |
268 } | 270 } |
269 | 271 |
270 void MandolineUIServicesApp::Create(shell::Connection* connection, | 272 void MandolineUIServicesApp::Create(shell::Connection* connection, |
271 mojom::GpuRequest request) { | 273 mojom::GpuRequest request) { |
272 DCHECK(platform_display_init_params_.gpu_state); | 274 DCHECK(platform_display_init_params_.gpu_state); |
273 new GpuImpl(std::move(request), platform_display_init_params_.gpu_state); | 275 new GpuImpl(std::move(request), platform_display_init_params_.gpu_state); |
274 } | 276 } |
275 | 277 |
276 } // namespace mus | 278 } // namespace mus |
OLD | NEW |