| 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/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 void MandolineUIServicesApp::InitializeResources(mojo::Connector* connector) { | 83 void MandolineUIServicesApp::InitializeResources(mojo::Connector* connector) { |
| 84 if (ui::ResourceBundle::HasSharedInstance()) | 84 if (ui::ResourceBundle::HasSharedInstance()) |
| 85 return; | 85 return; |
| 86 | 86 |
| 87 std::set<std::string> resource_paths; | 87 std::set<std::string> resource_paths; |
| 88 resource_paths.insert(kResourceFileStrings); | 88 resource_paths.insert(kResourceFileStrings); |
| 89 resource_paths.insert(kResourceFile100); | 89 resource_paths.insert(kResourceFile100); |
| 90 resource_paths.insert(kResourceFile200); | 90 resource_paths.insert(kResourceFile200); |
| 91 | 91 |
| 92 resource_provider::ResourceLoader resource_loader(connector, resource_paths); | 92 resource_provider::ResourceLoader loader(connector, resource_paths); |
| 93 if (!resource_loader.BlockUntilLoaded()) | 93 if (!loader.BlockUntilLoaded()) |
| 94 return; | 94 return; |
| 95 CHECK(resource_loader.loaded()); | |
| 96 ui::RegisterPathProvider(); | 95 ui::RegisterPathProvider(); |
| 97 | 96 |
| 98 // Initialize resource bundle with 1x and 2x cursor bitmaps. | 97 // Initialize resource bundle with 1x and 2x cursor bitmaps. |
| 99 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( | 98 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( |
| 100 resource_loader.ReleaseFile(kResourceFileStrings), | 99 loader.ReleaseFile(kResourceFileStrings), |
| 101 base::MemoryMappedFile::Region::kWholeFile); | 100 base::MemoryMappedFile::Region::kWholeFile); |
| 102 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( | 101 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 103 resource_loader.ReleaseFile(kResourceFile100), ui::SCALE_FACTOR_100P); | 102 rb.AddDataPackFromFile(loader.ReleaseFile(kResourceFile100), |
| 104 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( | 103 ui::SCALE_FACTOR_100P); |
| 105 resource_loader.ReleaseFile(kResourceFile200), ui::SCALE_FACTOR_200P); | 104 rb.AddDataPackFromFile(loader.ReleaseFile(kResourceFile200), |
| 105 ui::SCALE_FACTOR_200P); |
| 106 } | 106 } |
| 107 | 107 |
| 108 MandolineUIServicesApp::UserState* MandolineUIServicesApp::GetUserState( | 108 MandolineUIServicesApp::UserState* MandolineUIServicesApp::GetUserState( |
| 109 mojo::Connection* connection) { | 109 mojo::Connection* connection) { |
| 110 const ws::UserId& user_id = connection->GetRemoteIdentity().user_id(); | 110 const ws::UserId& user_id = connection->GetRemoteIdentity().user_id(); |
| 111 auto it = user_id_to_user_state_.find(user_id); | 111 auto it = user_id_to_user_state_.find(user_id); |
| 112 if (it != user_id_to_user_state_.end()) | 112 if (it != user_id_to_user_state_.end()) |
| 113 return it->second.get(); | 113 return it->second.get(); |
| 114 user_id_to_user_state_[user_id] = make_scoped_ptr(new UserState); | 114 user_id_to_user_state_[user_id] = make_scoped_ptr(new UserState); |
| 115 return user_id_to_user_state_[user_id].get(); | 115 return user_id_to_user_state_[user_id].get(); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 user_state->window_tree_host_factory->AddBinding(std::move(request)); | 250 user_state->window_tree_host_factory->AddBinding(std::move(request)); |
| 251 } | 251 } |
| 252 | 252 |
| 253 void MandolineUIServicesApp::Create(mojo::Connection* connection, | 253 void MandolineUIServicesApp::Create(mojo::Connection* connection, |
| 254 mojom::GpuRequest request) { | 254 mojom::GpuRequest request) { |
| 255 DCHECK(platform_display_init_params_.gpu_state); | 255 DCHECK(platform_display_init_params_.gpu_state); |
| 256 new GpuImpl(std::move(request), platform_display_init_params_.gpu_state); | 256 new GpuImpl(std::move(request), platform_display_init_params_.gpu_state); |
| 257 } | 257 } |
| 258 | 258 |
| 259 } // namespace mus | 259 } // namespace mus |
| OLD | NEW |