| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MOJO_APPLICATION_MANAGER_APPLICATION_LOADER_H_ | |
| 6 #define MOJO_APPLICATION_MANAGER_APPLICATION_LOADER_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "mojo/application_manager/application_manager_export.h" | |
| 10 #include "mojo/public/cpp/system/core.h" | |
| 11 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | |
| 12 #include "url/gurl.h" | |
| 13 | |
| 14 namespace mojo { | |
| 15 | |
| 16 class ApplicationManager; | |
| 17 | |
| 18 // Interface to allowing loading behavior to be established for schemes, | |
| 19 // specific urls or as the default. | |
| 20 // A ApplicationLoader is responsible to using whatever mechanism is appropriate | |
| 21 // to load the application at url. | |
| 22 // The handle to the shell is passed to that application so it can bind it to | |
| 23 // a Shell instance. This will give the Application a way to connect to other | |
| 24 // apps and services. | |
| 25 class MOJO_APPLICATION_MANAGER_EXPORT ApplicationLoader { | |
| 26 public: | |
| 27 typedef base::Callback< | |
| 28 void(const GURL&, ScopedMessagePipeHandle, URLResponsePtr)> LoadCallback; | |
| 29 virtual ~ApplicationLoader() {} | |
| 30 | |
| 31 // Returns a callback that will should never be called. | |
| 32 static LoadCallback SimpleLoadCallback(); | |
| 33 | |
| 34 // Load the application named |url|. Applications can be loaded two ways: | |
| 35 // | |
| 36 // 1. |url| can refer directly to a Mojo application. In this case, | |
| 37 // shell_handle should be used to implement the mojo.Application interface. | |
| 38 // | |
| 39 // 2. |url| can refer to some content that can be handled by some other Mojo | |
| 40 // application. In this case, call callbacks and specify the URL of the | |
| 41 // application that should handle the content. The specified application | |
| 42 // must implement the mojo.ContentHandler interface. | |
| 43 virtual void Load(ApplicationManager* application_manager, | |
| 44 const GURL& url, | |
| 45 ScopedMessagePipeHandle shell_handle, | |
| 46 LoadCallback callback) = 0; | |
| 47 | |
| 48 // Called when the Application exits. | |
| 49 virtual void OnApplicationError(ApplicationManager* manager, | |
| 50 const GURL& url) = 0; | |
| 51 | |
| 52 protected: | |
| 53 ApplicationLoader() {} | |
| 54 }; | |
| 55 | |
| 56 } // namespace mojo | |
| 57 | |
| 58 #endif // MOJO_APPLICATION_MANAGER_APPLICATION_LOADER_H_ | |
| OLD | NEW |