blob: 11608617122528bda30a0950bf068f18855aec8f [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_DELEGATE_H_
#define MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_DELEGATE_H_
#include "base/memory/scoped_ptr.h"
#include "mojo/public/interfaces/application/service_provider.mojom.h"
namespace mojo {
class ServiceProviderImpl;
class View;
class ViewManager;
// Interface implemented by an application using the view manager.
class ViewManagerDelegate {
public:
// Called when the application implementing this interface is embedded at
// |root|. Every embed results in a new ViewManager and root View being
// created. |root| and it's corresponding ViewManager are valid until
// OnViewManagerDisconnected() is called with the same object.
//
// |exported_services| is an object that the delegate can add services to
// expose to the embedder. |imported_services| exposes the services offered by
// the embedder to the delegate. Note that if a different application is
// subsequently embedded at |root|, the pipe(s) connecting |imported_services|
// to the embedder and any services obtained from it are not broken and will
// continue to be valid.
virtual void OnEmbed(View* root,
ServiceProviderImpl* exported_services,
scoped_ptr<ServiceProvider> imported_services) = 0;
// Called when a connection to the view manager service is closed.
// |view_manager| is not valid after this function returns.
virtual void OnViewManagerDisconnected(ViewManager* view_manager) = 0;
protected:
virtual ~ViewManagerDelegate() {}
};
} // namespace mojo
#endif // MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_DELEGATE_H_