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

Unified Diff: content/browser/mojo/mojo_shell_context.cc

Issue 2342523003: Revert of Enforce capability spec renderer <--> browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/mojo/merge_dictionary_unittest.cc ('k') | content/browser/ppapi_plugin_process_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/mojo/mojo_shell_context.cc
diff --git a/content/browser/mojo/mojo_shell_context.cc b/content/browser/mojo/mojo_shell_context.cc
index 54b760cec7d97f1a4bdb0c904ed59f43904755b5..95f6ac6b7387649ffb331b67d0d9bda904edb547 100644
--- a/content/browser/mojo/mojo_shell_context.cc
+++ b/content/browser/mojo/mojo_shell_context.cc
@@ -9,13 +9,12 @@
#include <utility>
#include "base/bind.h"
-#include "base/json/json_reader.h"
#include "base/lazy_instance.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/single_thread_task_runner.h"
#include "content/browser/gpu/gpu_process_host.h"
-#include "content/browser/mojo/merge_dictionary.h"
+#include "content/common/mojo/constants.h"
#include "content/common/mojo/mojo_shell_connection_impl.h"
#include "content/grit/content_resources.h"
#include "content/public/browser/browser_thread.h"
@@ -24,7 +23,6 @@
#include "content/public/browser/utility_process_host_client.h"
#include "content/public/common/content_client.h"
#include "content/public/common/mojo_shell_connection.h"
-#include "content/public/common/service_names.h"
#include "mojo/edk/embedder/embedder.h"
#include "services/catalog/catalog.h"
#include "services/catalog/manifest_provider.h"
@@ -103,39 +101,6 @@
#endif // ENABLE_MOJO_MEDIA_IN_GPU_PROCESS
-void MergeDictionary(base::DictionaryValue* target,
- const base::DictionaryValue* source) {
- for (base::DictionaryValue::Iterator it(*source); !it.IsAtEnd();
- it.Advance()) {
- const base::Value* merge_value = &it.value();
- // Check whether we have to merge dictionaries.
- if (merge_value->IsType(base::Value::TYPE_DICTIONARY)) {
- base::DictionaryValue* sub_dict;
- if (target->GetDictionaryWithoutPathExpansion(it.key(), &sub_dict)) {
- MergeDictionary(
- sub_dict,
- static_cast<const base::DictionaryValue*>(merge_value));
- continue;
- }
- }
- if (merge_value->IsType(base::Value::TYPE_LIST)) {
- const base::ListValue* merge_list = nullptr;
- if (merge_value->GetAsList(&merge_list)) {
- base::ListValue* target_list = nullptr;
- DCHECK(target->GetListWithoutPathExpansion(it.key(), &target_list));
- for (size_t i = 0; i < merge_list->GetSize(); ++i) {
- std::string value;
- DCHECK(merge_list->GetString(i, &value));
- target_list->AppendString(value);
- }
- }
- } else {
- // All other cases: Make a copy and hook it up.
- target->SetWithoutPathExpansion(it.key(), merge_value->DeepCopy());
- }
- }
-}
-
// A ManifestProvider which resolves application names to builtin manifest
// resources for the catalog service to consume.
class BuiltinManifestProvider : public catalog::ManifestProvider {
@@ -161,28 +126,15 @@
private:
// catalog::ManifestProvider:
- std::unique_ptr<base::Value> GetManifest(const std::string& name) override {
- auto manifest_it = manifests_->find(name);
- std::unique_ptr<base::Value> manifest_root;
- if (manifest_it != manifests_->end())
- manifest_root = base::JSONReader::Read(manifest_it->second);
-
- base::DictionaryValue* manifest_dictionary = nullptr;
- if (manifest_root && !manifest_root->GetAsDictionary(&manifest_dictionary))
- return nullptr;
-
- std::unique_ptr<base::Value> overlay_root =
- GetContentClient()->browser()->GetServiceManifestOverlay(name);
- if (overlay_root) {
- if (!manifest_root) {
- manifest_root = std::move(overlay_root);
- } else {
- base::DictionaryValue* overlay_dictionary = nullptr;
- if (overlay_root->GetAsDictionary(&overlay_dictionary))
- MergeDictionary(manifest_dictionary, overlay_dictionary);
- }
+ bool GetApplicationManifest(const base::StringPiece& name,
+ std::string* manifest_contents) override {
+ auto manifest_it = manifests_->find(name.as_string());
+ if (manifest_it != manifests_->end()) {
+ *manifest_contents = manifest_it->second;
+ DCHECK(!manifest_contents->empty());
+ return true;
}
- return manifest_root;
+ return false;
}
std::unique_ptr<ContentBrowserClient::MojoApplicationManifestMap> manifests_;
« no previous file with comments | « content/browser/mojo/merge_dictionary_unittest.cc ('k') | content/browser/ppapi_plugin_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698