Index: mojo/service_manager/service_manager.cc |
diff --git a/mojo/service_manager/service_manager.cc b/mojo/service_manager/service_manager.cc |
index ab72bdffd65549cbe4f221a2508502ceae53d53d..f12249ea66bc24cf59f8472ff4f1ca1abf5dcbc5 100644 |
--- a/mojo/service_manager/service_manager.cc |
+++ b/mojo/service_manager/service_manager.cc |
@@ -70,7 +70,9 @@ bool ServiceManager::TestAPI::HasFactoryForURL(const GURL& url) const { |
manager_->url_to_service_factory_.end(); |
} |
-ServiceManager::ServiceManager() : default_loader_(NULL) { |
+ServiceManager::ServiceManager() |
+ : default_loader_(NULL), |
+ interceptor_(NULL) { |
} |
ServiceManager::~ServiceManager() { |
@@ -100,7 +102,12 @@ void ServiceManager::Connect(const GURL& url, |
service_factory = new ServiceFactory(this, url); |
url_to_service_factory_[url] = service_factory; |
} |
- service_factory->ConnectToClient(client_handle.Pass()); |
+ if (interceptor_) { |
+ service_factory->ConnectToClient( |
+ interceptor_->OnConnectToClient(url, client_handle.Pass())); |
+ } else { |
+ service_factory->ConnectToClient(client_handle.Pass()); |
+ } |
} |
void ServiceManager::SetLoaderForURL(ServiceLoader* loader, const GURL& url) { |
@@ -114,6 +121,10 @@ void ServiceManager::SetLoaderForScheme(ServiceLoader* loader, |
scheme_to_loader_[scheme] = loader; |
} |
+void ServiceManager::SetInterceptor(Interceptor* interceptor) { |
+ interceptor_ = interceptor; |
+} |
+ |
ServiceLoader* ServiceManager::GetLoaderForURL(const GURL& url) { |
URLToLoaderMap::const_iterator url_it = url_to_loader_.find(url); |
if (url_it != url_to_loader_.end()) |