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

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

Issue 1882423004: Move shell service to toplevel shell namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_BROWSER_SHELL_CONNECTION_H_ 5 #ifndef CONTENT_BROWSER_MOJO_BROWSER_SHELL_CONNECTION_H_
6 #define CONTENT_BROWSER_MOJO_BROWSER_SHELL_CONNECTION_H_ 6 #define CONTENT_BROWSER_MOJO_BROWSER_SHELL_CONNECTION_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <unordered_map> 10 #include <unordered_map>
(...skipping 11 matching lines...) Expand all
22 #include "services/shell/public/cpp/shell_connection.h" 22 #include "services/shell/public/cpp/shell_connection.h"
23 #include "services/shell/public/interfaces/shell_client.mojom.h" 23 #include "services/shell/public/interfaces/shell_client.mojom.h"
24 #include "services/shell/public/interfaces/shell_client_factory.mojom.h" 24 #include "services/shell/public/interfaces/shell_client_factory.mojom.h"
25 25
26 namespace content { 26 namespace content {
27 27
28 // A connection from the browser process to the Mojo shell. There may be 28 // A connection from the browser process to the Mojo shell. There may be
29 // multiple connections in a single browser process. Each connection may have 29 // multiple connections in a single browser process. Each connection may have
30 // its own identity, e.g., a connection with unique user ID per BrowserContext. 30 // its own identity, e.g., a connection with unique user ID per BrowserContext.
31 class BrowserShellConnection 31 class BrowserShellConnection
32 : public mojo::ShellClient, 32 : public shell::ShellClient,
33 public mojo::InterfaceFactory<mojo::shell::mojom::ShellClientFactory>, 33 public shell::InterfaceFactory<shell::mojom::ShellClientFactory>,
34 public mojo::shell::mojom::ShellClientFactory { 34 public shell::mojom::ShellClientFactory {
35 public: 35 public:
36 explicit BrowserShellConnection( 36 explicit BrowserShellConnection(shell::mojom::ShellClientRequest request);
37 mojo::shell::mojom::ShellClientRequest request);
38 ~BrowserShellConnection() override; 37 ~BrowserShellConnection() override;
39 38
40 mojo::Connector* GetConnector(); 39 shell::Connector* GetConnector();
41 40
42 // Adds an embedded application to this connection's ShellClientFactory. 41 // Adds an embedded application to this connection's ShellClientFactory.
43 // |callback| will be used to create a new instance of the application on 42 // |callback| will be used to create a new instance of the application on
44 // |task_runner|'s thread if no instance is running when an incoming 43 // |task_runner|'s thread if no instance is running when an incoming
45 // connection is made to |name|. If |task_runner| is null, the calling thread 44 // connection is made to |name|. If |task_runner| is null, the calling thread
46 // will be used to run the application. 45 // will be used to run the application.
47 void AddEmbeddedApplication( 46 void AddEmbeddedApplication(
48 const base::StringPiece& name, 47 const base::StringPiece& name,
49 const EmbeddedApplicationRunner::FactoryCallback& callback, 48 const EmbeddedApplicationRunner::FactoryCallback& callback,
50 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); 49 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
51 50
52 private: 51 private:
53 // mojo::ShellClient: 52 // shell::ShellClient:
54 bool AcceptConnection(mojo::Connection* connection) override; 53 bool AcceptConnection(shell::Connection* connection) override;
55 54
56 // mojo::InterfaceFactory<mojo::shell::mojom::ShellClientFactory>: 55 // shell::InterfaceFactory<shell::mojom::ShellClientFactory>:
57 void Create(mojo::Connection* connection, 56 void Create(shell::Connection* connection,
58 mojo::shell::mojom::ShellClientFactoryRequest request) override; 57 shell::mojom::ShellClientFactoryRequest request) override;
59 58
60 // mojo::shell::mojom::ShellClientFactory: 59 // shell::mojom::ShellClientFactory:
61 void CreateShellClient(mojo::shell::mojom::ShellClientRequest request, 60 void CreateShellClient(shell::mojom::ShellClientRequest request,
62 const mojo::String& name) override; 61 const mojo::String& name) override;
63 62
64 std::unique_ptr<mojo::ShellConnection> shell_connection_; 63 std::unique_ptr<shell::ShellConnection> shell_connection_;
65 mojo::BindingSet<mojo::shell::mojom::ShellClientFactory> factory_bindings_; 64 mojo::BindingSet<shell::mojom::ShellClientFactory> factory_bindings_;
66 std::unordered_map<std::string, std::unique_ptr<EmbeddedApplicationRunner>> 65 std::unordered_map<std::string, std::unique_ptr<EmbeddedApplicationRunner>>
67 embedded_apps_; 66 embedded_apps_;
68 67
69 DISALLOW_COPY_AND_ASSIGN(BrowserShellConnection); 68 DISALLOW_COPY_AND_ASSIGN(BrowserShellConnection);
70 }; 69 };
71 70
72 } // namespace content 71 } // namespace content
73 72
74 #endif // CONTENT_BROWSER_MOJO_BROWSER_SHELL_CONNECTION_H_ 73 #endif // CONTENT_BROWSER_MOJO_BROWSER_SHELL_CONNECTION_H_
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | content/browser/mojo/browser_shell_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698