| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 MOJO_PUBLIC_APPLICATION_APPLICATION_IMPL_H_ | 5 #ifndef MOJO_PUBLIC_APPLICATION_APPLICATION_IMPL_H_ |
| 6 #define MOJO_PUBLIC_APPLICATION_APPLICATION_IMPL_H_ | 6 #define MOJO_PUBLIC_APPLICATION_APPLICATION_IMPL_H_ |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "mojo/public/cpp/application/application_connection.h" | 9 #include "mojo/public/cpp/application/application_connection.h" |
| 10 #include "mojo/public/cpp/application/lib/service_connector.h" | 10 #include "mojo/public/cpp/application/lib/service_connector.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // | 51 // |
| 52 // | 52 // |
| 53 class ApplicationImpl : public Application { | 53 class ApplicationImpl : public Application { |
| 54 public: | 54 public: |
| 55 ApplicationImpl(ApplicationDelegate* delegate, | 55 ApplicationImpl(ApplicationDelegate* delegate, |
| 56 InterfaceRequest<Application> request); | 56 InterfaceRequest<Application> request); |
| 57 ~ApplicationImpl() override; | 57 ~ApplicationImpl() override; |
| 58 | 58 |
| 59 Shell* shell() const { return shell_.get(); } | 59 Shell* shell() const { return shell_.get(); } |
| 60 | 60 |
| 61 const std::string& url() const { return url_; } |
| 62 |
| 61 // Returns any initial configuration arguments, passed by the Shell. | 63 // Returns any initial configuration arguments, passed by the Shell. |
| 62 const std::vector<std::string>& args() const { return args_; } | 64 const std::vector<std::string>& args() const { return args_; } |
| 63 bool HasArg(const std::string& arg) const; | 65 bool HasArg(const std::string& arg) const; |
| 64 | 66 |
| 65 // Establishes a new connection to an application. Caller does not own. | 67 // Establishes a new connection to an application. Caller does not own. |
| 66 ApplicationConnection* ConnectToApplication(const String& application_url); | 68 ApplicationConnection* ConnectToApplication(const String& application_url); |
| 67 | 69 |
| 68 // Connect to application identified by |application_url| and connect to the | 70 // Connect to application identified by |application_url| and connect to the |
| 69 // service implementation of the interface identified by |Interface|. | 71 // service implementation of the interface identified by |Interface|. |
| 70 template <typename Interface> | 72 template <typename Interface> |
| 71 void ConnectToService(const std::string& application_url, | 73 void ConnectToService(const std::string& application_url, |
| 72 InterfacePtr<Interface>* ptr) { | 74 InterfacePtr<Interface>* ptr) { |
| 73 ConnectToApplication(application_url)->ConnectToService(ptr); | 75 ConnectToApplication(application_url)->ConnectToService(ptr); |
| 74 } | 76 } |
| 75 | 77 |
| 76 // Application implementation. | 78 // Application implementation. |
| 77 void Initialize(ShellPtr shell, Array<String> args) override; | 79 void Initialize(ShellPtr shell, |
| 80 Array<String> args, |
| 81 const mojo::String& url) override; |
| 78 | 82 |
| 79 // Block until the Application is initialized, if it is not already. | 83 // Block until the Application is initialized, if it is not already. |
| 80 void WaitForInitialize(); | 84 void WaitForInitialize(); |
| 81 | 85 |
| 82 // Unbinds the Shell and Application connections. Can be used to re-bind the | 86 // Unbinds the Shell and Application connections. Can be used to re-bind the |
| 83 // handles to another implementation of ApplicationImpl, for instance when | 87 // handles to another implementation of ApplicationImpl, for instance when |
| 84 // running apptests. | 88 // running apptests. |
| 85 void UnbindConnections(InterfaceRequest<Application>* application_request, | 89 void UnbindConnections(InterfaceRequest<Application>* application_request, |
| 86 ShellPtr* shell); | 90 ShellPtr* shell); |
| 87 | 91 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 106 void RequestQuit() override; | 110 void RequestQuit() override; |
| 107 | 111 |
| 108 typedef std::vector<internal::ServiceRegistry*> ServiceRegistryList; | 112 typedef std::vector<internal::ServiceRegistry*> ServiceRegistryList; |
| 109 | 113 |
| 110 ServiceRegistryList incoming_service_registries_; | 114 ServiceRegistryList incoming_service_registries_; |
| 111 ServiceRegistryList outgoing_service_registries_; | 115 ServiceRegistryList outgoing_service_registries_; |
| 112 ApplicationDelegate* delegate_; | 116 ApplicationDelegate* delegate_; |
| 113 Binding<Application> binding_; | 117 Binding<Application> binding_; |
| 114 ShellPtr shell_; | 118 ShellPtr shell_; |
| 115 ShellPtrWatcher* shell_watch_; | 119 ShellPtrWatcher* shell_watch_; |
| 120 std::string url_; |
| 116 std::vector<std::string> args_; | 121 std::vector<std::string> args_; |
| 117 | 122 |
| 118 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); | 123 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); |
| 119 }; | 124 }; |
| 120 | 125 |
| 121 } // namespace mojo | 126 } // namespace mojo |
| 122 | 127 |
| 123 #endif // MOJO_PUBLIC_APPLICATION_APPLICATION_IMPL_H_ | 128 #endif // MOJO_PUBLIC_APPLICATION_APPLICATION_IMPL_H_ |
| OLD | NEW |