| 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_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ | 5 #ifndef MOJO_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ |
| 6 #define MOJO_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ | 6 #define MOJO_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "mojo/application_manager/application_loader.h" | 14 #include "mojo/application_manager/application_loader.h" |
| 15 #include "mojo/application_manager/application_manager_export.h" | 15 #include "mojo/application_manager/application_manager_export.h" |
| 16 #include "mojo/public/interfaces/application/service_provider.mojom.h" | 16 #include "mojo/public/interfaces/application/service_provider.mojom.h" |
| 17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
| 18 | 18 |
| 19 namespace mojo { | 19 namespace mojo { |
| 20 | 20 |
| 21 class MOJO_APPLICATION_MANAGER_EXPORT ApplicationManager { | 21 class MOJO_APPLICATION_MANAGER_EXPORT ApplicationManager { |
| 22 public: | 22 public: |
| 23 class MOJO_APPLICATION_MANAGER_EXPORT Delegate { | 23 class MOJO_APPLICATION_MANAGER_EXPORT Delegate { |
| 24 public: | 24 public: |
| 25 virtual ~Delegate(); | 25 virtual ~Delegate(); |
| 26 // Send when the Applicaiton holding the handle on the other end of the | 26 // Send when the Application holding the handle on the other end of the |
| 27 // Shell pipe goes away. | 27 // Shell pipe goes away. |
| 28 virtual void OnApplicationError(const GURL& url) = 0; | 28 virtual void OnApplicationError(const GURL& url) = 0; |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 // API for testing. | 31 // API for testing. |
| 32 class MOJO_APPLICATION_MANAGER_EXPORT TestAPI { | 32 class MOJO_APPLICATION_MANAGER_EXPORT TestAPI { |
| 33 public: | 33 public: |
| 34 explicit TestAPI(ApplicationManager* manager); | 34 explicit TestAPI(ApplicationManager* manager); |
| 35 ~TestAPI(); | 35 ~TestAPI(); |
| 36 | 36 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 InterfacePtr<Interface>* ptr) { | 73 InterfacePtr<Interface>* ptr) { |
| 74 ScopedMessagePipeHandle service_handle = | 74 ScopedMessagePipeHandle service_handle = |
| 75 ConnectToServiceByName(application_url, Interface::Name_); | 75 ConnectToServiceByName(application_url, Interface::Name_); |
| 76 ptr->Bind(service_handle.Pass()); | 76 ptr->Bind(service_handle.Pass()); |
| 77 } | 77 } |
| 78 | 78 |
| 79 ScopedMessagePipeHandle ConnectToServiceByName( | 79 ScopedMessagePipeHandle ConnectToServiceByName( |
| 80 const GURL& application_url, | 80 const GURL& application_url, |
| 81 const std::string& interface_name); | 81 const std::string& interface_name); |
| 82 | 82 |
| 83 void RegisterExternalApplication(const GURL& application_url, |
| 84 ScopedMessagePipeHandle shell); |
| 85 |
| 83 void set_delegate(Delegate* delegate) { delegate_ = delegate; } | 86 void set_delegate(Delegate* delegate) { delegate_ = delegate; } |
| 84 | 87 |
| 85 // Sets the default Loader to be used if not overridden by SetLoaderForURL() | 88 // Sets the default Loader to be used if not overridden by SetLoaderForURL() |
| 86 // or SetLoaderForScheme(). | 89 // or SetLoaderForScheme(). |
| 87 void set_default_loader(scoped_ptr<ApplicationLoader> loader) { | 90 void set_default_loader(scoped_ptr<ApplicationLoader> loader) { |
| 88 default_loader_ = loader.Pass(); | 91 default_loader_ = loader.Pass(); |
| 89 } | 92 } |
| 90 // Sets a Loader to be used for a specific url. | 93 // Sets a Loader to be used for a specific url. |
| 91 void SetLoaderForURL(scoped_ptr<ApplicationLoader> loader, const GURL& url); | 94 void SetLoaderForURL(scoped_ptr<ApplicationLoader> loader, const GURL& url); |
| 92 // Sets a Loader to be used for a specific url scheme. | 95 // Sets a Loader to be used for a specific url scheme. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 URLToArgsMap url_to_args_; | 154 URLToArgsMap url_to_args_; |
| 152 | 155 |
| 153 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; | 156 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; |
| 154 | 157 |
| 155 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); | 158 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); |
| 156 }; | 159 }; |
| 157 | 160 |
| 158 } // namespace mojo | 161 } // namespace mojo |
| 159 | 162 |
| 160 #endif // MOJO_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ | 163 #endif // MOJO_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ |
| OLD | NEW |