| OLD | NEW | 
|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_CONNECT_TO_APPLICATION_PARAMS_H_ | 5 #ifndef MOJO_SHELL_CONNECT_TO_APPLICATION_PARAMS_H_ | 
| 6 #define MOJO_SHELL_CONNECT_TO_APPLICATION_PARAMS_H_ | 6 #define MOJO_SHELL_CONNECT_TO_APPLICATION_PARAMS_H_ | 
| 7 | 7 | 
| 8 #include <string> | 8 #include <string> | 
| 9 #include <utility> | 9 #include <utility> | 
| 10 | 10 | 
| 11 #include "base/callback.h" | 11 #include "base/callback.h" | 
| 12 #include "base/macros.h" | 12 #include "base/macros.h" | 
| 13 #include "mojo/public/cpp/bindings/interface_request.h" | 13 #include "mojo/public/cpp/bindings/interface_request.h" | 
| 14 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | 14 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | 
| 15 #include "mojo/shell/identity.h" | 15 #include "mojo/shell/identity.h" | 
| 16 #include "mojo/shell/public/interfaces/service_provider.mojom.h" | 16 #include "mojo/shell/public/interfaces/interface_provider.mojom.h" | 
| 17 #include "mojo/shell/public/interfaces/shell.mojom.h" | 17 #include "mojo/shell/public/interfaces/shell.mojom.h" | 
| 18 #include "url/gurl.h" | 18 #include "url/gurl.h" | 
| 19 | 19 | 
| 20 namespace mojo { | 20 namespace mojo { | 
| 21 namespace shell { | 21 namespace shell { | 
| 22 | 22 | 
| 23 class ApplicationInstance; | 23 class ApplicationInstance; | 
| 24 | 24 | 
| 25 // This class represents a request for the application manager to connect to an | 25 // This class represents a request for the application manager to connect to an | 
| 26 // application. | 26 // application. | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
| 43   const Identity& target() const { return target_; } | 43   const Identity& target() const { return target_; } | 
| 44 | 44 | 
| 45   const URLRequest* target_url_request() const { | 45   const URLRequest* target_url_request() const { | 
| 46     return target_url_request_.get(); | 46     return target_url_request_.get(); | 
| 47   } | 47   } | 
| 48   // NOTE: This doesn't reset |target_|. | 48   // NOTE: This doesn't reset |target_|. | 
| 49   URLRequestPtr TakeTargetURLRequest() { | 49   URLRequestPtr TakeTargetURLRequest() { | 
| 50     return std::move(target_url_request_); | 50     return std::move(target_url_request_); | 
| 51   } | 51   } | 
| 52 | 52 | 
| 53   void set_services(InterfaceRequest<ServiceProvider> value) { | 53   void set_remote_interfaces(InterfaceRequest<InterfaceProvider> value) { | 
| 54     services_ = std::move(value); | 54     remote_interfaces_ = std::move(value); | 
| 55   } | 55   } | 
| 56   InterfaceRequest<ServiceProvider> TakeServices() { | 56   InterfaceRequest<InterfaceProvider> TakeRemoteInterfaces() { | 
| 57     return std::move(services_); | 57     return std::move(remote_interfaces_); | 
| 58   } | 58   } | 
| 59 | 59 | 
| 60   void set_exposed_services(ServiceProviderPtr value) { | 60   void set_local_interfaces(InterfaceProviderPtr value) { | 
| 61     exposed_services_ = std::move(value); | 61     local_interfaces_ = std::move(value); | 
| 62   } | 62   } | 
| 63   ServiceProviderPtr TakeExposedServices() { | 63   InterfaceProviderPtr TakeLocalInterfaces() { | 
| 64     return std::move(exposed_services_); | 64     return std::move(local_interfaces_); | 
| 65   } | 65   } | 
| 66 | 66 | 
| 67   void set_on_application_end(const base::Closure& value) { | 67   void set_on_application_end(const base::Closure& value) { | 
| 68     on_application_end_ = value; | 68     on_application_end_ = value; | 
| 69   } | 69   } | 
| 70   const base::Closure& on_application_end() const { | 70   const base::Closure& on_application_end() const { | 
| 71     return on_application_end_; | 71     return on_application_end_; | 
| 72   } | 72   } | 
| 73 | 73 | 
| 74   void set_connect_callback( | 74   void set_connect_callback( | 
| 75       const shell::mojom::Shell::ConnectToApplicationCallback& value) { | 75       const shell::mojom::Shell::ConnectToApplicationCallback& value) { | 
| 76     connect_callback_ = value; | 76     connect_callback_ = value; | 
| 77   } | 77   } | 
| 78   const shell::mojom::Shell::ConnectToApplicationCallback& | 78   const shell::mojom::Shell::ConnectToApplicationCallback& | 
| 79       connect_callback() const { | 79       connect_callback() const { | 
| 80     return connect_callback_; | 80     return connect_callback_; | 
| 81   } | 81   } | 
| 82 | 82 | 
| 83  private: | 83  private: | 
| 84   // It may be null (i.e., is_null() returns true) which indicates that there is | 84   // It may be null (i.e., is_null() returns true) which indicates that there is | 
| 85   // no source (e.g., for the first application or in tests). | 85   // no source (e.g., for the first application or in tests). | 
| 86   Identity source_; | 86   Identity source_; | 
| 87   // The identity of the application being connected to. | 87   // The identity of the application being connected to. | 
| 88   Identity target_; | 88   Identity target_; | 
| 89   // The URL request to fetch the application. It may contain more information | 89   // The URL request to fetch the application. It may contain more information | 
| 90   // than |target_| (e.g., headers, request body). When it is taken, |target_| | 90   // than |target_| (e.g., headers, request body). When it is taken, |target_| | 
| 91   // remains unchanged. | 91   // remains unchanged. | 
| 92   URLRequestPtr target_url_request_; | 92   URLRequestPtr target_url_request_; | 
| 93 | 93 | 
| 94   InterfaceRequest<ServiceProvider> services_; | 94   InterfaceRequest<InterfaceProvider> remote_interfaces_; | 
| 95   ServiceProviderPtr exposed_services_; | 95   InterfaceProviderPtr local_interfaces_; | 
| 96   base::Closure on_application_end_; | 96   base::Closure on_application_end_; | 
| 97   shell::mojom::Shell::ConnectToApplicationCallback connect_callback_; | 97   shell::mojom::Shell::ConnectToApplicationCallback connect_callback_; | 
| 98 | 98 | 
| 99   DISALLOW_COPY_AND_ASSIGN(ConnectToApplicationParams); | 99   DISALLOW_COPY_AND_ASSIGN(ConnectToApplicationParams); | 
| 100 }; | 100 }; | 
| 101 | 101 | 
| 102 }  // namespace shell | 102 }  // namespace shell | 
| 103 }  // namespace mojo | 103 }  // namespace mojo | 
| 104 | 104 | 
| 105 #endif  // MOJO_SHELL_CONNECT_TO_APPLICATION_PARAMS_H_ | 105 #endif  // MOJO_SHELL_CONNECT_TO_APPLICATION_PARAMS_H_ | 
| OLD | NEW | 
|---|