| 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_SHELL_APPLICATION_MANAGER_H_ | 5 #ifndef MOJO_SHELL_APPLICATION_MANAGER_H_ |
| 6 #define MOJO_SHELL_APPLICATION_MANAGER_H_ | 6 #define MOJO_SHELL_APPLICATION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "mojo/common/weak_interface_ptr_set.h" | 15 #include "mojo/common/weak_interface_ptr_set.h" |
| 16 #include "mojo/public/cpp/bindings/interface_ptr_info.h" | 16 #include "mojo/public/cpp/bindings/interface_ptr_info.h" |
| 17 #include "mojo/public/cpp/bindings/interface_request.h" | 17 #include "mojo/public/cpp/bindings/interface_request.h" |
| 18 #include "mojo/shell/application_loader.h" | 18 #include "mojo/shell/application_loader.h" |
| 19 #include "mojo/shell/capability_filter.h" | 19 #include "mojo/shell/capability_filter.h" |
| 20 #include "mojo/shell/connect_to_application_params.h" | 20 #include "mojo/shell/connect_to_application_params.h" |
| 21 #include "mojo/shell/fetcher.h" | 21 #include "mojo/shell/fetcher.h" |
| 22 #include "mojo/shell/identity.h" | 22 #include "mojo/shell/identity.h" |
| 23 #include "mojo/shell/native_runner.h" | 23 #include "mojo/shell/native_runner.h" |
| 24 #include "mojo/shell/public/interfaces/application.mojom.h" | |
| 25 #include "mojo/shell/public/interfaces/application_manager.mojom.h" | 24 #include "mojo/shell/public/interfaces/application_manager.mojom.h" |
| 26 #include "mojo/shell/public/interfaces/service_provider.mojom.h" | 25 #include "mojo/shell/public/interfaces/service_provider.mojom.h" |
| 27 #include "mojo/shell/public/interfaces/shell.mojom.h" | 26 #include "mojo/shell/public/interfaces/shell.mojom.h" |
| 27 #include "mojo/shell/public/interfaces/shell_client.mojom.h" |
| 28 #include "url/gurl.h" | 28 #include "url/gurl.h" |
| 29 | 29 |
| 30 namespace base { | 30 namespace base { |
| 31 class FilePath; | 31 class FilePath; |
| 32 class SequencedWorkerPool; | 32 class SequencedWorkerPool; |
| 33 } | 33 } |
| 34 | 34 |
| 35 namespace mojo { | 35 namespace mojo { |
| 36 namespace shell { | 36 namespace shell { |
| 37 | 37 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 void ApplicationPIDAvailable(uint32_t id, base::ProcessId pid); | 107 void ApplicationPIDAvailable(uint32_t id, base::ProcessId pid); |
| 108 | 108 |
| 109 private: | 109 private: |
| 110 using IdentityToInstanceMap = std::map<Identity, ApplicationInstance*>; | 110 using IdentityToInstanceMap = std::map<Identity, ApplicationInstance*>; |
| 111 using URLToLoaderMap = std::map<GURL, ApplicationLoader*>; | 111 using URLToLoaderMap = std::map<GURL, ApplicationLoader*>; |
| 112 | 112 |
| 113 // Takes the contents of |params| only when it returns true. | 113 // Takes the contents of |params| only when it returns true. |
| 114 bool ConnectToRunningApplication( | 114 bool ConnectToRunningApplication( |
| 115 scoped_ptr<ConnectToApplicationParams>* params); | 115 scoped_ptr<ConnectToApplicationParams>* params); |
| 116 | 116 |
| 117 InterfaceRequest<mojom::Application> CreateAndConnectToInstance( | 117 InterfaceRequest<mojom::ShellClient> CreateAndConnectToInstance( |
| 118 scoped_ptr<ConnectToApplicationParams> params, | 118 scoped_ptr<ConnectToApplicationParams> params, |
| 119 ApplicationInstance** instance); | 119 ApplicationInstance** instance); |
| 120 InterfaceRequest<mojom::Application> CreateInstance( | 120 InterfaceRequest<mojom::ShellClient> CreateInstance( |
| 121 const Identity& target_id, | 121 const Identity& target_id, |
| 122 const base::Closure& on_application_end, | 122 const base::Closure& on_application_end, |
| 123 ApplicationInstance** resulting_instance); | 123 ApplicationInstance** resulting_instance); |
| 124 | 124 |
| 125 // Called once |fetcher| has found app. |params->app_url()| is the url of | 125 // Called once |fetcher| has found app. |params->app_url()| is the url of |
| 126 // the requested application before any mappings/resolution have been applied. | 126 // the requested application before any mappings/resolution have been applied. |
| 127 // The corresponding URLRequest struct in |params| has been taken. | 127 // The corresponding URLRequest struct in |params| has been taken. |
| 128 void HandleFetchCallback(scoped_ptr<ConnectToApplicationParams> params, | 128 void HandleFetchCallback(scoped_ptr<ConnectToApplicationParams> params, |
| 129 scoped_ptr<Fetcher> fetcher); | 129 scoped_ptr<Fetcher> fetcher); |
| 130 | 130 |
| 131 void RunNativeApplication( | 131 void RunNativeApplication(InterfaceRequest<mojom::ShellClient> request, |
| 132 InterfaceRequest<mojom::Application> application_request, | 132 bool start_sandboxed, |
| 133 bool start_sandboxed, | 133 scoped_ptr<Fetcher> fetcher, |
| 134 scoped_ptr<Fetcher> fetcher, | 134 ApplicationInstance* instance, |
| 135 ApplicationInstance* instance, | 135 const base::FilePath& file_path, |
| 136 const base::FilePath& file_path, | 136 bool path_exists); |
| 137 bool path_exists); | |
| 138 | 137 |
| 139 // Returns the appropriate loader for |url|, or the default loader if there is | 138 // Returns the appropriate loader for |url|, or the default loader if there is |
| 140 // no loader configured for the URL. | 139 // no loader configured for the URL. |
| 141 ApplicationLoader* GetLoaderForURL(const GURL& url); | 140 ApplicationLoader* GetLoaderForURL(const GURL& url); |
| 142 | 141 |
| 143 void CleanupRunner(NativeRunner* runner); | 142 void CleanupRunner(NativeRunner* runner); |
| 144 | 143 |
| 145 mojom::ApplicationInfoPtr CreateApplicationInfoForInstance( | 144 mojom::ApplicationInfoPtr CreateApplicationInfoForInstance( |
| 146 ApplicationInstance* instance) const; | 145 ApplicationInstance* instance) const; |
| 147 | 146 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 162 | 161 |
| 163 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); | 162 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); |
| 164 }; | 163 }; |
| 165 | 164 |
| 166 mojom::Shell::ConnectToApplicationCallback EmptyConnectCallback(); | 165 mojom::Shell::ConnectToApplicationCallback EmptyConnectCallback(); |
| 167 | 166 |
| 168 } // namespace shell | 167 } // namespace shell |
| 169 } // namespace mojo | 168 } // namespace mojo |
| 170 | 169 |
| 171 #endif // MOJO_SHELL_APPLICATION_MANAGER_H_ | 170 #endif // MOJO_SHELL_APPLICATION_MANAGER_H_ |
| OLD | NEW |