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

Side by Side Diff: shell/application_manager/shell_impl.h

Issue 1450223002: Add an ApplicationConnector.Duplicate(). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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 SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_ 5 #ifndef SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_
6 #define SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_ 6 #define SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "mojo/common/binding_set.h" 10 #include "mojo/common/binding_set.h"
(...skipping 27 matching lines...) Expand all
38 void ConnectToClient(const GURL& requested_url, 38 void ConnectToClient(const GURL& requested_url,
39 const GURL& requestor_url, 39 const GURL& requestor_url,
40 mojo::InterfaceRequest<mojo::ServiceProvider> services, 40 mojo::InterfaceRequest<mojo::ServiceProvider> services,
41 mojo::ServiceProviderPtr exposed_services); 41 mojo::ServiceProviderPtr exposed_services);
42 42
43 mojo::Application* application() { return application_.get(); } 43 mojo::Application* application() { return application_.get(); }
44 const Identity& identity() const { return identity_; } 44 const Identity& identity() const { return identity_; }
45 base::Closure on_application_end() const { return on_application_end_; } 45 base::Closure on_application_end() const { return on_application_end_; }
46 46
47 private: 47 private:
48 // This is a per-|ShellImpl| singleton.
48 class ApplicationConnectorImpl : public mojo::ApplicationConnector { 49 class ApplicationConnectorImpl : public mojo::ApplicationConnector {
49 public: 50 public:
50 explicit ApplicationConnectorImpl(mojo::Shell* shell) : shell_(shell) {} 51 explicit ApplicationConnectorImpl(mojo::Shell* shell);
51 ~ApplicationConnectorImpl() override {} 52 ~ApplicationConnectorImpl() override;
52 53
53 void ConnectToApplication( 54 void ConnectToApplication(
54 const mojo::String& app_url, 55 const mojo::String& app_url,
55 mojo::InterfaceRequest<mojo::ServiceProvider> services, 56 mojo::InterfaceRequest<mojo::ServiceProvider> services,
56 mojo::ServiceProviderPtr exposed_services) override { 57 mojo::ServiceProviderPtr exposed_services) override;
57 shell_->ConnectToApplication(app_url, services.Pass(), 58 void Duplicate(mojo::InterfaceRequest<mojo::ApplicationConnector>
58 exposed_services.Pass()); 59 application_connector_request) override;
59 }
60 60
61 private: 61 private:
62 mojo::Shell* const shell_; 62 mojo::Shell* const shell_;
63 mojo::BindingSet<mojo::ApplicationConnector> bindings_;
64
63 DISALLOW_COPY_AND_ASSIGN(ApplicationConnectorImpl); 65 DISALLOW_COPY_AND_ASSIGN(ApplicationConnectorImpl);
64 }; 66 };
65 67
66 // mojo::Shell implementation: 68 // mojo::Shell implementation:
67 void ConnectToApplication( 69 void ConnectToApplication(
68 const mojo::String& app_url, 70 const mojo::String& app_url,
69 mojo::InterfaceRequest<mojo::ServiceProvider> services, 71 mojo::InterfaceRequest<mojo::ServiceProvider> services,
70 mojo::ServiceProviderPtr exposed_services) override; 72 mojo::ServiceProviderPtr exposed_services) override;
71 void CreateApplicationConnector( 73 void CreateApplicationConnector(
72 mojo::InterfaceRequest<mojo::ApplicationConnector> 74 mojo::InterfaceRequest<mojo::ApplicationConnector>
73 application_connector_request) override; 75 application_connector_request) override;
74 76
75 ApplicationManager* const manager_; 77 ApplicationManager* const manager_;
76 const Identity identity_; 78 const Identity identity_;
77 base::Closure on_application_end_; 79 base::Closure on_application_end_;
78 mojo::ApplicationPtr application_; 80 mojo::ApplicationPtr application_;
79 mojo::Binding<mojo::Shell> binding_; 81 mojo::Binding<mojo::Shell> binding_;
80 82
81 ApplicationConnectorImpl application_connector_impl_; 83 ApplicationConnectorImpl application_connector_impl_;
82 mojo::BindingSet<mojo::ApplicationConnector> application_connectors_;
83 84
84 DISALLOW_COPY_AND_ASSIGN(ShellImpl); 85 DISALLOW_COPY_AND_ASSIGN(ShellImpl);
85 }; 86 };
86 87
87 } // namespace shell 88 } // namespace shell
88 89
89 #endif // SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_ 90 #endif // SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_
OLDNEW
« no previous file with comments | « mojo/public/interfaces/application/application_connector.mojom ('k') | shell/application_manager/shell_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698