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

Side by Side Diff: mojo/service_manager/service_manager.h

Issue 423963004: First cut at "content handling" support in Mojo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more gn Created 6 years, 4 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « mojo/service_manager/service_loader.cc ('k') | mojo/service_manager/service_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_SERVICE_MANAGER_SERVICE_MANAGER_H_ 5 #ifndef MOJO_SERVICE_MANAGER_SERVICE_MANAGER_H_
6 #define MOJO_SERVICE_MANAGER_SERVICE_MANAGER_H_ 6 #define MOJO_SERVICE_MANAGER_SERVICE_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h"
13 #include "mojo/public/interfaces/application/service_provider.mojom.h" 14 #include "mojo/public/interfaces/application/service_provider.mojom.h"
14 #include "mojo/service_manager/service_loader.h" 15 #include "mojo/service_manager/service_loader.h"
15 #include "mojo/service_manager/service_manager_export.h" 16 #include "mojo/service_manager/service_manager_export.h"
16 #include "url/gurl.h" 17 #include "url/gurl.h"
17 18
18 namespace mojo { 19 namespace mojo {
19 20
20 class MOJO_SERVICE_MANAGER_EXPORT ServiceManager { 21 class MOJO_SERVICE_MANAGER_EXPORT ServiceManager {
21 public: 22 public:
22 // API for testing. 23 // API for testing.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 const std::string& scheme); 81 const std::string& scheme);
81 // Allows to interpose a debugger to service connections. 82 // Allows to interpose a debugger to service connections.
82 void SetInterceptor(Interceptor* interceptor); 83 void SetInterceptor(Interceptor* interceptor);
83 84
84 // Destroys all Shell-ends of connections established with Applications. 85 // Destroys all Shell-ends of connections established with Applications.
85 // Applications connected by this ServiceManager will observe pipe errors 86 // Applications connected by this ServiceManager will observe pipe errors
86 // and have a chance to shutdown. 87 // and have a chance to shutdown.
87 void TerminateShellConnections(); 88 void TerminateShellConnections();
88 89
89 private: 90 private:
91 struct ContentHandlerConnection;
92 class LoadCallbacksImpl;
90 class ShellImpl; 93 class ShellImpl;
94
91 typedef std::map<std::string, ServiceLoader*> SchemeToLoaderMap; 95 typedef std::map<std::string, ServiceLoader*> SchemeToLoaderMap;
92 typedef std::map<GURL, ServiceLoader*> URLToLoaderMap; 96 typedef std::map<GURL, ServiceLoader*> URLToLoaderMap;
93 typedef std::map<GURL, ShellImpl*> URLToShellImplMap; 97 typedef std::map<GURL, ShellImpl*> URLToShellImplMap;
98 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap;
99
100 void ConnectToClient(ShellImpl* shell_impl,
101 const GURL& url,
102 const GURL& requestor_url,
103 ServiceProviderPtr service_provider);
104
105 void RegisterLoadedApplication(const GURL& service_url,
106 const GURL& requestor_url,
107 ServiceProviderPtr service_provider,
108 ScopedMessagePipeHandle* shell_handle);
109
110 void LoadWithContentHandler(const GURL& content_url,
111 const GURL& requestor_url,
112 const GURL& content_handler_url,
113 URLResponsePtr content,
114 ServiceProviderPtr service_provider);
94 115
95 // Returns the Loader to use for a url (using default if not overridden.) 116 // Returns the Loader to use for a url (using default if not overridden.)
96 // The preference is to use a loader that's been specified for an url first, 117 // The preference is to use a loader that's been specified for an url first,
97 // then one that's been specified for a scheme, then the default. 118 // then one that's been specified for a scheme, then the default.
98 ServiceLoader* GetLoaderForURL(const GURL& url); 119 ServiceLoader* GetLoaderForURL(const GURL& url);
99 120
100 // Removes a ShellImpl when it encounters an error. 121 // Removes a ShellImpl when it encounters an error.
101 void OnShellImplError(ShellImpl* shell_impl); 122 void OnShellImplError(ShellImpl* shell_impl);
102 123
103 // Loader management. 124 // Loader management.
104 URLToLoaderMap url_to_loader_; 125 URLToLoaderMap url_to_loader_;
105 SchemeToLoaderMap scheme_to_loader_; 126 SchemeToLoaderMap scheme_to_loader_;
106 scoped_ptr<ServiceLoader> default_loader_; 127 scoped_ptr<ServiceLoader> default_loader_;
107 Interceptor* interceptor_; 128 Interceptor* interceptor_;
108 129
109 URLToShellImplMap url_to_shell_impl_; 130 URLToShellImplMap url_to_shell_impl_;
131 URLToContentHandlerMap url_to_content_handler_;
132
133 base::WeakPtrFactory<ServiceManager> weak_ptr_factory_;
110 134
111 DISALLOW_COPY_AND_ASSIGN(ServiceManager); 135 DISALLOW_COPY_AND_ASSIGN(ServiceManager);
112 }; 136 };
113 137
114 } // namespace mojo 138 } // namespace mojo
115 139
116 #endif // MOJO_SERVICE_MANAGER_SERVICE_MANAGER_H_ 140 #endif // MOJO_SERVICE_MANAGER_SERVICE_MANAGER_H_
OLDNEW
« no previous file with comments | « mojo/service_manager/service_loader.cc ('k') | mojo/service_manager/service_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698