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 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 static bool HasCreatedInstance(); | 40 static bool HasCreatedInstance(); |
41 // Returns true if there is a ShellImpl for this URL. | 41 // Returns true if there is a ShellImpl for this URL. |
42 bool HasFactoryForURL(const GURL& url) const; | 42 bool HasFactoryForURL(const GURL& url) const; |
43 | 43 |
44 private: | 44 private: |
45 ApplicationManager* manager_; | 45 ApplicationManager* manager_; |
46 | 46 |
47 DISALLOW_COPY_AND_ASSIGN(TestAPI); | 47 DISALLOW_COPY_AND_ASSIGN(TestAPI); |
48 }; | 48 }; |
49 | 49 |
50 ApplicationManager(Delegate* delegate); | 50 explicit ApplicationManager(Delegate* delegate); |
51 ~ApplicationManager(); | 51 ~ApplicationManager(); |
52 | 52 |
53 // Loads a service if necessary and establishes a new client connection. | 53 // Loads a service if necessary and establishes a new client connection. |
54 void ConnectToApplication(const GURL& application_url, | 54 void ConnectToApplication(const GURL& application_url, |
55 const GURL& requestor_url, | 55 const GURL& requestor_url, |
56 ServiceProviderPtr service_provider); | 56 InterfaceRequest<ServiceProvider> services, |
| 57 ServiceProviderPtr exposed_services); |
57 | 58 |
58 template <typename Interface> | 59 template <typename Interface> |
59 inline void ConnectToService(const GURL& application_url, | 60 inline void ConnectToService(const GURL& application_url, |
60 InterfacePtr<Interface>* ptr) { | 61 InterfacePtr<Interface>* ptr) { |
61 ScopedMessagePipeHandle service_handle = | 62 ScopedMessagePipeHandle service_handle = |
62 ConnectToServiceByName(application_url, Interface::Name_); | 63 ConnectToServiceByName(application_url, Interface::Name_); |
63 ptr->Bind(service_handle.Pass()); | 64 ptr->Bind(service_handle.Pass()); |
64 } | 65 } |
65 | 66 |
66 ScopedMessagePipeHandle ConnectToServiceByName( | 67 ScopedMessagePipeHandle ConnectToServiceByName( |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 101 |
101 typedef std::map<std::string, ApplicationLoader*> SchemeToLoaderMap; | 102 typedef std::map<std::string, ApplicationLoader*> SchemeToLoaderMap; |
102 typedef std::map<GURL, ApplicationLoader*> URLToLoaderMap; | 103 typedef std::map<GURL, ApplicationLoader*> URLToLoaderMap; |
103 typedef std::map<GURL, ShellImpl*> URLToShellImplMap; | 104 typedef std::map<GURL, ShellImpl*> URLToShellImplMap; |
104 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap; | 105 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap; |
105 typedef std::map<GURL, std::vector<std::string> > URLToArgsMap; | 106 typedef std::map<GURL, std::vector<std::string> > URLToArgsMap; |
106 | 107 |
107 void ConnectToApplicationImpl(const GURL& requested_url, | 108 void ConnectToApplicationImpl(const GURL& requested_url, |
108 const GURL& resolved_url, | 109 const GURL& resolved_url, |
109 const GURL& requestor_url, | 110 const GURL& requestor_url, |
110 ServiceProviderPtr service_provider, | 111 InterfaceRequest<ServiceProvider> services, |
| 112 ServiceProviderPtr exposed_services, |
111 ApplicationLoader* loader); | 113 ApplicationLoader* loader); |
112 | 114 |
113 void ConnectToClient(ShellImpl* shell_impl, | 115 void ConnectToClient(ShellImpl* shell_impl, |
114 const GURL& url, | 116 const GURL& url, |
115 const GURL& requestor_url, | 117 const GURL& requestor_url, |
116 ServiceProviderPtr service_provider); | 118 InterfaceRequest<ServiceProvider> services, |
| 119 ServiceProviderPtr exposed_services); |
117 | 120 |
118 void LoadWithContentHandler(const GURL& content_handler_url, | 121 void LoadWithContentHandler(const GURL& content_handler_url, |
119 ScopedMessagePipeHandle shell_handle, | 122 ScopedMessagePipeHandle shell_handle, |
120 URLResponsePtr url_response); | 123 URLResponsePtr url_response); |
121 | 124 |
122 // Return the appropriate loader for |url|. This can return NULL if there is | 125 // Return the appropriate loader for |url|. This can return NULL if there is |
123 // no default loader configured. | 126 // no default loader configured. |
124 ApplicationLoader* GetLoaderForURL(const GURL& url, | 127 ApplicationLoader* GetLoaderForURL(const GURL& url, |
125 IncludeDefaultLoader fallback); | 128 IncludeDefaultLoader fallback); |
126 | 129 |
(...skipping 17 matching lines...) Expand all Loading... |
144 URLToArgsMap url_to_args_; | 147 URLToArgsMap url_to_args_; |
145 | 148 |
146 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; | 149 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; |
147 | 150 |
148 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); | 151 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); |
149 }; | 152 }; |
150 | 153 |
151 } // namespace mojo | 154 } // namespace mojo |
152 | 155 |
153 #endif // MOJO_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ | 156 #endif // MOJO_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ |
OLD | NEW |