Index: mojo/shell/ui_service_loader_android.cc |
diff --git a/mojo/shell/ui_service_loader_android.cc b/mojo/shell/ui_service_loader_android.cc |
index 3960858c2f73ad165f980c1ebd6799c3e802d4ad..e2f77464bf8d05fb753809263b1740c08d975715 100644 |
--- a/mojo/shell/ui_service_loader_android.cc |
+++ b/mojo/shell/ui_service_loader_android.cc |
@@ -15,10 +15,12 @@ class UIServiceLoader::UILoader { |
explicit UILoader(ServiceLoader* loader) : loader_(loader) {} |
~UILoader() {} |
- void LoadService(ServiceManager* manager, |
- const GURL& url, |
- ScopedMessagePipeHandle shell_handle) { |
- loader_->LoadService(manager, url, shell_handle.Pass()); |
+ void Load(ServiceManager* manager, |
+ const GURL& url, |
+ ScopedMessagePipeHandle shell_handle) { |
+ scoped_refptr<LoadCallbacks> callbacks( |
+ new ServiceLoader::SimpleLoadCallbacks(shell_handle.Pass())); |
+ loader_->Load(manager, url, callbacks); |
} |
void OnServiceError(ServiceManager* manager, const GURL& url) { |
@@ -42,17 +44,20 @@ UIServiceLoader::~UIServiceLoader() { |
base::Bind(&UIServiceLoader::ShutdownOnUIThread, base::Unretained(this))); |
} |
-void UIServiceLoader::LoadService(ServiceManager* manager, |
- const GURL& url, |
- ScopedMessagePipeHandle shell_handle) { |
+void UIServiceLoader::Load(ServiceManager* manager, |
+ const GURL& url, |
+ scoped_refptr<LoadCallbacks> callbacks) { |
+ ScopedMessagePipeHandle shell_handle = callbacks->RegisterApplication(); |
+ if (!shell_handle.is_valid()) |
+ return; |
context_->ui_loop()->PostTask( |
FROM_HERE, |
- base::Bind( |
- &UIServiceLoader::LoadServiceOnUIThread, |
- base::Unretained(this), |
- manager, |
- url, |
- base::Owned(new ScopedMessagePipeHandle(shell_handle.Pass())))); |
+ base::Bind(&UIServiceLoader::LoadOnUIThread, |
+ base::Unretained(this), |
+ manager, |
+ url, |
+ base::Owned( |
+ new ScopedMessagePipeHandle(shell_handle.Pass())))); |
} |
void UIServiceLoader::OnServiceError(ServiceManager* manager, const GURL& url) { |
@@ -64,13 +69,12 @@ void UIServiceLoader::OnServiceError(ServiceManager* manager, const GURL& url) { |
url)); |
} |
-void UIServiceLoader::LoadServiceOnUIThread( |
- ServiceManager* manager, |
- const GURL& url, |
- ScopedMessagePipeHandle* shell_handle) { |
+void UIServiceLoader::LoadOnUIThread(ServiceManager* manager, |
+ const GURL& url, |
+ ScopedMessagePipeHandle* shell_handle) { |
if (!ui_loader_) |
ui_loader_ = new UILoader(loader_.get()); |
- ui_loader_->LoadService(manager, url, shell_handle->Pass()); |
+ ui_loader_->Load(manager, url, shell_handle->Pass()); |
} |
void UIServiceLoader::OnServiceErrorOnUIThread(ServiceManager* manager, |