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

Unified Diff: components/profile_service/profile_app.h

Issue 1741953002: mojo: Sketch a profile application. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't add a boolean to BrowserContext; allocate an object instead. 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
« no previous file with comments | « components/profile_service/DEPS ('k') | components/profile_service/profile_app.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/profile_service/profile_app.h
diff --git a/components/profile_service/profile_app.h b/components/profile_service/profile_app.h
new file mode 100644
index 0000000000000000000000000000000000000000..80c0130d5d4a4a6ea7048ff149dc8a7b2948fde4
--- /dev/null
+++ b/components/profile_service/profile_app.h
@@ -0,0 +1,89 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_PROFILE_SERVICE_PROFILE_APP_H_
+#define COMPONENTS_PROFILE_SERVICE_PROFILE_APP_H_
+
+#include "components/filesystem/lock_table.h"
+#include "components/leveldb/public/interfaces/leveldb.mojom.h"
+#include "components/profile_service/public/interfaces/profile.mojom.h"
+#include "mojo/public/cpp/bindings/binding_set.h"
+#include "mojo/services/tracing/public/cpp/tracing_impl.h"
+#include "mojo/shell/public/cpp/interface_factory.h"
+#include "mojo/shell/public/cpp/shell_client.h"
+
+namespace filesystem {
+class LockTable;
+}
+
+namespace profile {
+
+scoped_ptr<mojo::ShellClient> CreateProfileApp();
+
+// Application which hands off per-profile services.
+//
+// This Application serves ProfileService, and serves LevelDBService since most
+// of the users of leveldb will want to write directly to the Directory
+// provided by the ProfileService; we want file handling to be done in the same
+// process to minimize IPC.
+//
+// In the future, this application will probably also offer any service that
+// most Profile using applications will need, such as preferences.
+class ProfileApp : public mojo::ShellClient,
+ public mojo::InterfaceFactory<ProfileService>,
+ public mojo::InterfaceFactory<leveldb::LevelDBService> {
+ public:
+ ProfileApp();
+ ~ProfileApp() override;
+
+ // Currently, ProfileApp is run from within the chrome process. This means it
+ // that the ApplicationLoader is registered during MojoShellContext startup,
+ // even though the application itself is not started. As soon as a
+ // BrowserContext is created, the BrowserContext will choose a |user_id| for
+ // itself and call us to register the mapping from |user_id| to
+ // |profile_data_dir|.
+ //
+ // This data is then accessed when we get our Initialize() call.
+ //
+ // TODO(erg): This is a temporary hack until we redo how we initialize mojo
+ // applications inside of chrome in general; this system won't work once
+ // ProfileApp gets put in its own sandboxed process.
+ static void AssociateMojoUserIDWithProfileDir(
+ uint32_t user_id,
+ const base::FilePath& profile_data_dir);
+
+ private:
+ // |ShellClient| override:
+ void Initialize(mojo::Connector* connector,
+ const std::string& url,
+ uint32_t id,
+ uint32_t user_id) override;
+ bool AcceptConnection(mojo::Connection* connection) override;
+
+ // |InterfaceFactory<ProfileService>| implementation:
+ void Create(mojo::Connection* connection,
+ mojo::InterfaceRequest<ProfileService> request) override;
+
+ // |InterfaceFactory<LevelDBService>| implementation:
+ void Create(mojo::Connection* connection,
+ mojo::InterfaceRequest<leveldb::LevelDBService> request) override;
+
+ mojo::TracingImpl tracing_;
+
+ scoped_ptr<ProfileService> profile_service_;
+ mojo::BindingSet<ProfileService> profile_bindings_;
+
+ scoped_ptr<leveldb::LevelDBService> leveldb_service_;
+ mojo::BindingSet<leveldb::LevelDBService> leveldb_bindings_;
+
+ scoped_ptr<filesystem::LockTable> lock_table_;
+
+ base::FilePath profile_data_dir_;
+
+ DISALLOW_COPY_AND_ASSIGN(ProfileApp);
+};
+
+} // namespace profile
+
+#endif // COMPONENTS_PROFILE_SERVICE_PROFILE_APP_H_
« no previous file with comments | « components/profile_service/DEPS ('k') | components/profile_service/profile_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698