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

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

Issue 1737933002: mojo leveldb: Get profile and leveldb connected to DOMStorageContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove most of the LOGs. Created 4 years, 10 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
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 e1a0a4ecd0b4354c1125d8a0e2c8d25659f30231..aa04bb2c23b3bd05407303064f0583f137330588 100644
--- a/content/browser/mojo/mojo_shell_context.cc
+++ b/content/browser/mojo/mojo_shell_context.cc
@@ -6,17 +6,20 @@
#include <utility>
+#include "base/bind.h"
#include "base/lazy_instance.h"
#include "base/macros.h"
#include "base/path_service.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
+#include "components/leveldb/leveldb_app.h"
#include "components/profile_service/profile_app.h"
#include "content/browser/gpu/gpu_process_host.h"
#include "content/common/gpu/gpu_process_launch_causes.h"
#include "content/common/mojo/mojo_shell_connection_impl.h"
#include "content/common/mojo/static_loader.h"
#include "content/common/process_control.mojom.h"
+#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/utility_process_host.h"
@@ -158,6 +161,7 @@ class MojoShellContext::Proxy {
~Proxy() {}
void ConnectToApplication(
+ uint32_t user_id,
const std::string& name,
const std::string& requestor_name,
mojo::shell::mojom::InterfaceProviderRequest request,
@@ -166,7 +170,7 @@ class MojoShellContext::Proxy {
if (task_runner_ == base::ThreadTaskRunnerHandle::Get()) {
if (shell_context_) {
shell_context_->ConnectToApplicationOnOwnThread(
- name, requestor_name, std::move(request),
+ user_id, name, requestor_name, std::move(request),
std::move(exposed_services), callback);
}
} else {
@@ -175,9 +179,9 @@ class MojoShellContext::Proxy {
task_runner_->PostTask(
FROM_HERE,
base::Bind(&MojoShellContext::ConnectToApplicationOnOwnThread,
- base::Unretained(shell_context_), name, requestor_name,
- base::Passed(&request), base::Passed(&exposed_services),
- callback));
+ base::Unretained(shell_context_), user_id, name,
+ requestor_name, base::Passed(&request),
+ base::Passed(&exposed_services), callback));
}
}
@@ -251,6 +255,12 @@ MojoShellContext::MojoShellContext() {
"mojo:media");
#endif
+ base::Callback<scoped_ptr<mojo::ShellClient>()> leveldb_callback =
+ base::Bind(&leveldb::CreateLevelDBApp);
+ application_manager_->SetLoaderForName(
+ make_scoped_ptr(new StaticLoader(leveldb_callback)),
+ "mojo:leveldb");
+
base::Callback<scoped_ptr<mojo::ShellClient>()> profile_callback =
base::Bind(&profile::CreateProfileApp);
application_manager_->SetLoaderForName(
@@ -274,27 +284,43 @@ void MojoShellContext::ConnectToApplication(
mojo::shell::mojom::InterfaceProviderRequest request,
mojo::shell::mojom::InterfaceProviderPtr exposed_services,
const mojo::shell::mojom::Connector::ConnectCallback& callback) {
- proxy_.Get()->ConnectToApplication(name, requestor_name, std::move(request),
- std::move(exposed_services), callback);
+ // TODO(beng): kUserRoot is obviously wrong.
+ proxy_.Get()->ConnectToApplication(
+ mojo::shell::mojom::Connector::kUserRoot,
+ name, requestor_name, std::move(request),
+ std::move(exposed_services), callback);
+}
+
+// static
+void MojoShellContext::ConnectToApplicationWithContext(
+ BrowserContext* context,
+ const std::string& name,
+ const std::string& requestor_name,
+ mojo::shell::mojom::InterfaceProviderRequest request,
+ mojo::shell::mojom::InterfaceProviderPtr exposed_services,
+ const mojo::shell::mojom::Connector::ConnectCallback& callback) {
+ uint32_t user_id = BrowserContext::GetMojoUserIdFor(context);
+ proxy_.Get()->ConnectToApplication(
+ user_id, name, requestor_name, std::move(request),
+ std::move(exposed_services), callback);
}
void MojoShellContext::ConnectToApplicationOnOwnThread(
+ uint32_t user_id,
const std::string& name,
const std::string& requestor_name,
mojo::shell::mojom::InterfaceProviderRequest request,
mojo::shell::mojom::InterfaceProviderPtr exposed_services,
const mojo::shell::mojom::Connector::ConnectCallback& callback) {
scoped_ptr<mojo::shell::ConnectParams> params(new mojo::shell::ConnectParams);
- // TODO(beng): kUserRoot is obviously wrong.
// TODO(beng): We need to set a permissive filter here temporarily because
// content is known as a bogus system: name that the application
// manager doesn't understand.
- mojo::shell::Identity source_id(
- requestor_name, std::string(), mojo::shell::mojom::Connector::kUserRoot);
+ mojo::shell::Identity source_id(requestor_name, std::string(), user_id);
source_id.set_filter(mojo::shell::GetPermissiveCapabilityFilter());
params->set_source(source_id);
params->set_target(mojo::shell::Identity(
- name, std::string(), mojo::shell::mojom::Connector::kUserRoot));
+ name, std::string(), user_id));
params->set_remote_interfaces(std::move(request));
params->set_local_interfaces(std::move(exposed_services));
params->set_connect_callback(callback);

Powered by Google App Engine
This is Rietveld 408576698