| OLD | NEW |
| 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 "content/browser/mojo/mojo_shell_context.h" | 5 #include "content/browser/mojo/mojo_shell_context.h" |
| 6 | 6 |
| 7 #include <unordered_map> | 7 #include <unordered_map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 private: | 142 private: |
| 143 // catalog::ManifestProvider: | 143 // catalog::ManifestProvider: |
| 144 bool GetApplicationManifest(const base::StringPiece& name, | 144 bool GetApplicationManifest(const base::StringPiece& name, |
| 145 std::string* manifest_contents) override { | 145 std::string* manifest_contents) override { |
| 146 auto it = manifest_resources_.find(name.as_string()); | 146 auto it = manifest_resources_.find(name.as_string()); |
| 147 if (it == manifest_resources_.end()) | 147 if (it == manifest_resources_.end()) |
| 148 return false; | 148 return false; |
| 149 *manifest_contents = GetContentClient()->GetDataResource( | 149 *manifest_contents = GetContentClient()->GetDataResource( |
| 150 it->second, ui::ScaleFactor::SCALE_FACTOR_NONE).as_string(); | 150 it->second, ui::ScaleFactor::SCALE_FACTOR_NONE).as_string(); |
| 151 DCHECK(!manifest_contents->empty()); |
| 151 return true; | 152 return true; |
| 152 } | 153 } |
| 153 | 154 |
| 154 std::unordered_map<std::string, int> manifest_resources_; | 155 std::unordered_map<std::string, int> manifest_resources_; |
| 155 | 156 |
| 156 DISALLOW_COPY_AND_ASSIGN(BuiltinManifestProvider); | 157 DISALLOW_COPY_AND_ASSIGN(BuiltinManifestProvider); |
| 157 }; | 158 }; |
| 158 | 159 |
| 159 // Thread-safe proxy providing access to the shell context from any thread. | 160 // Thread-safe proxy providing access to the shell context from any thread. |
| 160 class MojoShellContext::Proxy { | 161 class MojoShellContext::Proxy { |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 shell::Identity source_id(requestor_name, user_id); | 336 shell::Identity source_id(requestor_name, user_id); |
| 336 params->set_source(source_id); | 337 params->set_source(source_id); |
| 337 params->set_target(shell::Identity(name, user_id)); | 338 params->set_target(shell::Identity(name, user_id)); |
| 338 params->set_remote_interfaces(std::move(request)); | 339 params->set_remote_interfaces(std::move(request)); |
| 339 params->set_local_interfaces(std::move(exposed_services)); | 340 params->set_local_interfaces(std::move(exposed_services)); |
| 340 params->set_connect_callback(callback); | 341 params->set_connect_callback(callback); |
| 341 shell_->Connect(std::move(params)); | 342 shell_->Connect(std::move(params)); |
| 342 } | 343 } |
| 343 | 344 |
| 344 } // namespace content | 345 } // namespace content |
| OLD | NEW |