Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(753)

Unified Diff: mojo/application_manager/application_loader.h

Issue 741453002: Make sure that Content Handled application can be connected multiple times. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix sky Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | mojo/application_manager/application_loader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/application_manager/application_loader.h
diff --git a/mojo/application_manager/application_loader.h b/mojo/application_manager/application_loader.h
index f6e4e40adb3405958d7982f852d063fbefe6faa4..d1267cc578be3a4183475d3856890203c914911b 100644
--- a/mojo/application_manager/application_loader.h
+++ b/mojo/application_manager/application_loader.h
@@ -5,7 +5,7 @@
#ifndef MOJO_APPLICATION_MANAGER_APPLICATION_LOADER_H_
#define MOJO_APPLICATION_MANAGER_APPLICATION_LOADER_H_
-#include "base/memory/ref_counted.h"
+#include "base/callback.h"
#include "mojo/application_manager/application_manager_export.h"
#include "mojo/public/cpp/system/core.h"
#include "mojo/services/public/interfaces/network/url_loader.mojom.h"
@@ -24,56 +24,26 @@ class ApplicationManager;
// apps and services.
class MOJO_APPLICATION_MANAGER_EXPORT ApplicationLoader {
public:
- class MOJO_APPLICATION_MANAGER_EXPORT LoadCallbacks
- : public base::RefCounted<LoadCallbacks> {
- public:
- // Register the requested application with ApplicationManager. If the
- // returned handle is valid, it should be used to implement the
- // mojo::Application interface.
- virtual ScopedMessagePipeHandle RegisterApplication() = 0;
-
- // Load the requested application with a content handler.
- virtual void LoadWithContentHandler(const GURL& content_handler_url,
- URLResponsePtr url_response) = 0;
-
- protected:
- friend base::RefCounted<LoadCallbacks>;
- virtual ~LoadCallbacks() {}
- };
-
- // Implements RegisterApplication() by returning a handle that was specified
- // at construction time. LoadWithContentHandler() is not supported.
- class MOJO_APPLICATION_MANAGER_EXPORT SimpleLoadCallbacks
- : public LoadCallbacks {
- public:
- SimpleLoadCallbacks(ScopedMessagePipeHandle shell_handle);
- ScopedMessagePipeHandle RegisterApplication() override;
- void LoadWithContentHandler(const GURL& content_handler_url,
- URLResponsePtr response) override;
-
- private:
- ScopedMessagePipeHandle shell_handle_;
- ~SimpleLoadCallbacks() override;
- };
-
+ typedef base::Callback<
+ void(const GURL&, ScopedMessagePipeHandle, URLResponsePtr)> LoadCallback;
virtual ~ApplicationLoader() {}
+ // Returns a callback that will should never be called.
+ static LoadCallback SimpleLoadCallback();
+
// Load the application named |url|. Applications can be loaded two ways:
//
- // 1. |url| can refer directly to a Mojo application. In this case, call
- // callbacks->RegisterApplication(). The returned handle should be used to
- // implement the mojo.Application interface. Note that the returned handle
- // can be invalid in the case where the application has already been
- // loaded.
+ // 1. |url| can refer directly to a Mojo application. In this case,
+ // shell_handle should be used to implement the mojo.Application interface.
//
// 2. |url| can refer to some content that can be handled by some other Mojo
- // application. In this case, call callbacks->LoadWithContentHandler() and
- // specify the URL of the application that should handle the content.
- // The specified application must implement the mojo.ContentHandler
- // interface.
+ // application. In this case, call callbacks and specify the URL of the
+ // application that should handle the content. The specified application
+ // must implement the mojo.ContentHandler interface.
virtual void Load(ApplicationManager* application_manager,
const GURL& url,
- scoped_refptr<LoadCallbacks> callbacks) = 0;
+ ScopedMessagePipeHandle shell_handle,
+ LoadCallback callback) = 0;
// Called when the Application exits.
virtual void OnApplicationError(ApplicationManager* manager,
« no previous file with comments | « no previous file | mojo/application_manager/application_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698