| 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_LOADER_H_ | 5 #ifndef MOJO_APPLICATION_MANAGER_APPLICATION_LOADER_H_ |
| 6 #define MOJO_APPLICATION_MANAGER_APPLICATION_LOADER_H_ | 6 #define MOJO_APPLICATION_MANAGER_APPLICATION_LOADER_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "mojo/application_manager/application_manager_export.h" | 9 #include "mojo/application_manager/application_manager_export.h" |
| 10 #include "mojo/public/cpp/system/core.h" | 10 #include "mojo/public/cpp/system/core.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 class MOJO_APPLICATION_MANAGER_EXPORT LoadCallbacks | 27 class MOJO_APPLICATION_MANAGER_EXPORT LoadCallbacks |
| 28 : public base::RefCounted<LoadCallbacks> { | 28 : public base::RefCounted<LoadCallbacks> { |
| 29 public: | 29 public: |
| 30 // Register the requested application with ApplicationManager. If the | 30 // Register the requested application with ApplicationManager. If the |
| 31 // returned handle is valid, it should be used to implement the | 31 // returned handle is valid, it should be used to implement the |
| 32 // mojo::Application interface. | 32 // mojo::Application interface. |
| 33 virtual ScopedMessagePipeHandle RegisterApplication() = 0; | 33 virtual ScopedMessagePipeHandle RegisterApplication() = 0; |
| 34 | 34 |
| 35 // Load the requested application with a content handler. | 35 // Load the requested application with a content handler. |
| 36 virtual void LoadWithContentHandler(const GURL& content_handler_url, | 36 virtual void LoadWithContentHandler(const GURL& content_handler_url, |
| 37 URLResponsePtr response) = 0; | 37 URLResponsePtr url_response, |
| 38 URLLoaderPtr url_loader) = 0; |
| 38 | 39 |
| 39 protected: | 40 protected: |
| 40 friend base::RefCounted<LoadCallbacks>; | 41 friend base::RefCounted<LoadCallbacks>; |
| 41 virtual ~LoadCallbacks() {} | 42 virtual ~LoadCallbacks() {} |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 // Implements RegisterApplication() by returning a handle that was specified | 45 // Implements RegisterApplication() by returning a handle that was specified |
| 45 // at construction time. LoadWithContentHandler() is not supported. | 46 // at construction time. LoadWithContentHandler() is not supported. |
| 46 class MOJO_APPLICATION_MANAGER_EXPORT SimpleLoadCallbacks | 47 class MOJO_APPLICATION_MANAGER_EXPORT SimpleLoadCallbacks |
| 47 : public LoadCallbacks { | 48 : public LoadCallbacks { |
| 48 public: | 49 public: |
| 49 SimpleLoadCallbacks(ScopedMessagePipeHandle shell_handle); | 50 SimpleLoadCallbacks(ScopedMessagePipeHandle shell_handle); |
| 50 virtual ScopedMessagePipeHandle RegisterApplication() OVERRIDE; | 51 virtual ScopedMessagePipeHandle RegisterApplication() OVERRIDE; |
| 51 virtual void LoadWithContentHandler(const GURL& content_handler_url, | 52 virtual void LoadWithContentHandler(const GURL& content_handler_url, |
| 52 URLResponsePtr response) OVERRIDE; | 53 URLResponsePtr response, |
| 54 URLLoaderPtr loader) OVERRIDE; |
| 53 | 55 |
| 54 private: | 56 private: |
| 55 ScopedMessagePipeHandle shell_handle_; | 57 ScopedMessagePipeHandle shell_handle_; |
| 56 virtual ~SimpleLoadCallbacks(); | 58 virtual ~SimpleLoadCallbacks(); |
| 57 }; | 59 }; |
| 58 | 60 |
| 59 virtual ~ApplicationLoader() {} | 61 virtual ~ApplicationLoader() {} |
| 60 | 62 |
| 61 // Load the application named |url|. Applications can be loaded two ways: | 63 // Load the application named |url|. Applications can be loaded two ways: |
| 62 // | 64 // |
| (...skipping 15 matching lines...) Expand all Loading... |
| 78 // TODO(davemoore): Change name to OnApplicationError. | 80 // TODO(davemoore): Change name to OnApplicationError. |
| 79 virtual void OnServiceError(ApplicationManager* manager, const GURL& url) = 0; | 81 virtual void OnServiceError(ApplicationManager* manager, const GURL& url) = 0; |
| 80 | 82 |
| 81 protected: | 83 protected: |
| 82 ApplicationLoader() {} | 84 ApplicationLoader() {} |
| 83 }; | 85 }; |
| 84 | 86 |
| 85 } // namespace mojo | 87 } // namespace mojo |
| 86 | 88 |
| 87 #endif // MOJO_APPLICATION_MANAGER_APPLICATION_LOADER_H_ | 89 #endif // MOJO_APPLICATION_MANAGER_APPLICATION_LOADER_H_ |
| OLD | NEW |