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

Side by Side Diff: content/browser/mojo/mojo_shell_context.h

Issue 1737933002: mojo leveldb: Get profile and leveldb connected to DOMStorageContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge tot Created 4 years, 9 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 unified diff | Download patch
OLDNEW
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 #ifndef CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_ 5 #ifndef CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_
6 #define CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_ 6 #define CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/single_thread_task_runner.h"
15 #include "content/common/content_export.h" 16 #include "content/common/content_export.h"
16 #include "mojo/shell/public/interfaces/connector.mojom.h" 17 #include "mojo/shell/public/interfaces/connector.mojom.h"
17 #include "mojo/shell/shell.h" 18 #include "mojo/shell/shell.h"
18 19
19 namespace catalog { 20 namespace catalog {
20 class Factory; 21 class Factory;
21 } 22 }
22 23
23 namespace mojo { 24 namespace mojo {
24 class ShellClient; 25 class ShellClient;
25 } 26 }
26 27
27 namespace content { 28 namespace content {
28 29
29 // MojoShellContext hosts the browser's ApplicationManager, coordinating 30 // MojoShellContext hosts the browser's ApplicationManager, coordinating
30 // app registration and interconnection. 31 // app registration and interconnection.
31 class CONTENT_EXPORT MojoShellContext { 32 class CONTENT_EXPORT MojoShellContext {
32 public: 33 public:
33 using StaticApplicationMap = 34 using StaticApplicationMap =
34 std::map<std::string, base::Callback<scoped_ptr<mojo::ShellClient>()>>; 35 std::map<std::string, base::Callback<scoped_ptr<mojo::ShellClient>()>>;
35 36
36 MojoShellContext(); 37 MojoShellContext(scoped_refptr<base::SingleThreadTaskRunner> file_thread,
38 scoped_refptr<base::SingleThreadTaskRunner> db_thread);
37 ~MojoShellContext(); 39 ~MojoShellContext();
38 40
39 // Connects an application at |name| and gets a handle to its exposed 41 // Connects an application at |name| and gets a handle to its exposed
40 // services. This is only intended for use in browser code that's not part of 42 // services. This is only intended for use in browser code that's not part of
41 // some Mojo application. May be called from any thread. |requestor_name| is 43 // some Mojo application. May be called from any thread. |requestor_name| is
42 // given to the target application as the requestor's name upon connection. 44 // given to the target application as the requestor's name upon connection.
43 static void ConnectToApplication( 45 static void ConnectToApplication(
46 const std::string& user_id,
44 const std::string& name, 47 const std::string& name,
45 const std::string& requestor_name, 48 const std::string& requestor_name,
46 mojo::shell::mojom::InterfaceProviderRequest request, 49 mojo::shell::mojom::InterfaceProviderRequest request,
47 mojo::shell::mojom::InterfaceProviderPtr exposed_services, 50 mojo::shell::mojom::InterfaceProviderPtr exposed_services,
48 const mojo::shell::mojom::Connector::ConnectCallback& callback); 51 const mojo::shell::mojom::Connector::ConnectCallback& callback);
49 52
50 static void SetApplicationsForTest(const StaticApplicationMap* apps); 53 static void SetApplicationsForTest(const StaticApplicationMap* apps);
51 54
52 private: 55 private:
53 class Proxy; 56 class Proxy;
54 friend class Proxy; 57 friend class Proxy;
55 58
56 void ConnectToApplicationOnOwnThread( 59 void ConnectToApplicationOnOwnThread(
60 const std::string& user_id,
57 const std::string& name, 61 const std::string& name,
58 const std::string& requestor_name, 62 const std::string& requestor_name,
59 mojo::shell::mojom::InterfaceProviderRequest request, 63 mojo::shell::mojom::InterfaceProviderRequest request,
60 mojo::shell::mojom::InterfaceProviderPtr exposed_services, 64 mojo::shell::mojom::InterfaceProviderPtr exposed_services,
61 const mojo::shell::mojom::Connector::ConnectCallback& callback); 65 const mojo::shell::mojom::Connector::ConnectCallback& callback);
62 66
63 static base::LazyInstance<scoped_ptr<Proxy>> proxy_; 67 static base::LazyInstance<scoped_ptr<Proxy>> proxy_;
64 68
65 scoped_ptr<catalog::Factory> catalog_; 69 scoped_ptr<catalog::Factory> catalog_;
66 scoped_ptr<mojo::shell::Shell> shell_; 70 scoped_ptr<mojo::shell::Shell> shell_;
67 71
68 DISALLOW_COPY_AND_ASSIGN(MojoShellContext); 72 DISALLOW_COPY_AND_ASSIGN(MojoShellContext);
69 }; 73 };
70 74
71 } // namespace content 75 } // namespace content
72 76
73 #endif // CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_ 77 #endif // CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698