| 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" | 27 #include "components/resource_provider/public/cpp/resource_loader.h" |
| 28 #include "mojo/public/c/system/main.h" | 28 #include "mojo/public/c/system/main.h" |
| 29 #include "services/catalog/public/cpp/resource_loader.h" |
| 29 #include "services/shell/public/cpp/connection.h" | 30 #include "services/shell/public/cpp/connection.h" |
| 30 #include "services/shell/public/cpp/connector.h" | 31 #include "services/shell/public/cpp/connector.h" |
| 31 #include "services/tracing/public/cpp/tracing_impl.h" | 32 #include "services/tracing/public/cpp/tracing_impl.h" |
| 32 #include "ui/base/resource/resource_bundle.h" | 33 #include "ui/base/resource/resource_bundle.h" |
| 33 #include "ui/base/ui_base_paths.h" | 34 #include "ui/base/ui_base_paths.h" |
| 34 #include "ui/events/event_switches.h" | 35 #include "ui/events/event_switches.h" |
| 35 #include "ui/events/platform/platform_event_source.h" | 36 #include "ui/events/platform/platform_event_source.h" |
| 36 #include "ui/gl/gl_surface.h" | 37 #include "ui/gl/gl_surface.h" |
| 37 | 38 |
| 38 #if defined(USE_X11) | 39 #if defined(USE_X11) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 85 |
| 85 void MandolineUIServicesApp::InitializeResources(shell::Connector* connector) { | 86 void MandolineUIServicesApp::InitializeResources(shell::Connector* connector) { |
| 86 if (ui::ResourceBundle::HasSharedInstance()) | 87 if (ui::ResourceBundle::HasSharedInstance()) |
| 87 return; | 88 return; |
| 88 | 89 |
| 89 std::set<std::string> resource_paths; | 90 std::set<std::string> resource_paths; |
| 90 resource_paths.insert(kResourceFileStrings); | 91 resource_paths.insert(kResourceFileStrings); |
| 91 resource_paths.insert(kResourceFile100); | 92 resource_paths.insert(kResourceFile100); |
| 92 resource_paths.insert(kResourceFile200); | 93 resource_paths.insert(kResourceFile200); |
| 93 | 94 |
| 94 resource_provider::ResourceLoader loader(connector, resource_paths); | 95 catalog::ResourceLoader loader(connector, resource_paths); |
| 95 if (!loader.BlockUntilLoaded()) | |
| 96 return; | |
| 97 ui::RegisterPathProvider(); | 96 ui::RegisterPathProvider(); |
| 98 | 97 |
| 99 // Initialize resource bundle with 1x and 2x cursor bitmaps. | 98 // Initialize resource bundle with 1x and 2x cursor bitmaps. |
| 100 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( | 99 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( |
| 101 loader.ReleaseFile(kResourceFileStrings), | 100 loader.TakeFile(kResourceFileStrings), |
| 102 base::MemoryMappedFile::Region::kWholeFile); | 101 base::MemoryMappedFile::Region::kWholeFile); |
| 103 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 102 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 104 rb.AddDataPackFromFile(loader.ReleaseFile(kResourceFile100), | 103 rb.AddDataPackFromFile(loader.TakeFile(kResourceFile100), |
| 105 ui::SCALE_FACTOR_100P); | 104 ui::SCALE_FACTOR_100P); |
| 106 rb.AddDataPackFromFile(loader.ReleaseFile(kResourceFile200), | 105 rb.AddDataPackFromFile(loader.TakeFile(kResourceFile200), |
| 107 ui::SCALE_FACTOR_200P); | 106 ui::SCALE_FACTOR_200P); |
| 108 } | 107 } |
| 109 | 108 |
| 110 MandolineUIServicesApp::UserState* MandolineUIServicesApp::GetUserState( | 109 MandolineUIServicesApp::UserState* MandolineUIServicesApp::GetUserState( |
| 111 shell::Connection* connection) { | 110 shell::Connection* connection) { |
| 112 const ws::UserId& user_id = connection->GetRemoteIdentity().user_id(); | 111 const ws::UserId& user_id = connection->GetRemoteIdentity().user_id(); |
| 113 auto it = user_id_to_user_state_.find(user_id); | 112 auto it = user_id_to_user_state_.find(user_id); |
| 114 if (it != user_id_to_user_state_.end()) | 113 if (it != user_id_to_user_state_.end()) |
| 115 return it->second.get(); | 114 return it->second.get(); |
| 116 user_id_to_user_state_[user_id] = base::WrapUnique(new UserState); | 115 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)); | 266 new ws::WindowServerTestImpl(window_server_.get(), std::move(request)); |
| 268 } | 267 } |
| 269 | 268 |
| 270 void MandolineUIServicesApp::Create(shell::Connection* connection, | 269 void MandolineUIServicesApp::Create(shell::Connection* connection, |
| 271 mojom::GpuRequest request) { | 270 mojom::GpuRequest request) { |
| 272 DCHECK(platform_display_init_params_.gpu_state); | 271 DCHECK(platform_display_init_params_.gpu_state); |
| 273 new GpuImpl(std::move(request), platform_display_init_params_.gpu_state); | 272 new GpuImpl(std::move(request), platform_display_init_params_.gpu_state); |
| 274 } | 273 } |
| 275 | 274 |
| 276 } // namespace mus | 275 } // namespace mus |
| OLD | NEW |