Index: mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.cc |
diff --git a/mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.cc b/mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.cc |
index 860beb57c3b8982f2b90e0151fe028722e731789..9421e180ed388d1ab0f0bcdbd4652c91d80d3d40 100644 |
--- a/mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.cc |
+++ b/mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.cc |
@@ -92,8 +92,16 @@ class RootObserver : public ViewObserver { |
}; |
ViewManagerClientImpl::ViewManagerClientImpl(ViewManagerDelegate* delegate, |
- Shell* shell) |
- : connected_(false), connection_id_(0), next_id_(1), delegate_(delegate) { |
+ Shell* shell, |
+ ScopedMessagePipeHandle handle, |
+ bool delete_on_error) |
+ : connected_(false), |
+ connection_id_(0), |
+ next_id_(1), |
+ delegate_(delegate), |
+ binding_(this, handle.Pass()), |
+ service_(binding_.client()), |
+ delete_on_error_(delete_on_error) { |
} |
ViewManagerClientImpl::~ViewManagerClientImpl() { |
@@ -199,8 +207,9 @@ void ViewManagerClientImpl::Embed( |
Id view_id, |
ServiceProviderPtr service_provider) { |
DCHECK(connected_); |
- service_->Embed(url, view_id, service_provider.Pass(), |
- ActionCompletedCallback()); |
+ service_->Embed(url, view_id, |
+ MakeRequest<ServiceProvider>(service_provider.PassMessagePipe()), |
+ ActionCompletedCallback()); |
} |
void ViewManagerClientImpl::AddView(View* view) { |
@@ -231,13 +240,6 @@ View* ViewManagerClientImpl::GetViewById(Id id) { |
} |
//////////////////////////////////////////////////////////////////////////////// |
-// ViewManagerClientImpl, InterfaceImpl overrides: |
- |
-void ViewManagerClientImpl::OnConnectionEstablished() { |
- service_ = client(); |
-} |
- |
-//////////////////////////////////////////////////////////////////////////////// |
// ViewManagerClientImpl, ViewManagerClient implementation: |
void ViewManagerClientImpl::OnEmbed( |
@@ -395,6 +397,13 @@ void ViewManagerClientImpl::OnActiveWindowChanged(Id old_focused_window, |
Id new_focused_window) {} |
//////////////////////////////////////////////////////////////////////////////// |
+// OnConnectionError, private: |
+void ViewManagerClientImpl::OnConnectionError() { |
+ if (delete_on_error_) |
+ delete this; |
+} |
+ |
+//////////////////////////////////////////////////////////////////////////////// |
// ViewManagerClientImpl, private: |
void ViewManagerClientImpl::RemoveRoot(View* root) { |