| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_CPP_VIEW_MANAGER_DELEGATE_H_ | |
| 6 #define MOJO_SERVICES_VIEW_MANAGER_CPP_VIEW_MANAGER_DELEGATE_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "mojo/public/interfaces/application/service_provider.mojom.h" | |
| 11 | |
| 12 namespace mojo { | |
| 13 | |
| 14 class View; | |
| 15 class ViewManager; | |
| 16 | |
| 17 // Interface implemented by an application using the view manager. | |
| 18 class ViewManagerDelegate { | |
| 19 public: | |
| 20 // Called when the application implementing this interface is embedded at | |
| 21 // |root|. Every embed results in a new ViewManager and root View being | |
| 22 // created. |root| and it's corresponding ViewManager are valid until | |
| 23 // OnViewManagerDisconnected() is called with the same object. | |
| 24 // | |
| 25 // |services| exposes the services offered by the embedder to the delegate. | |
| 26 // | |
| 27 // |exposed_services| is an object that the delegate can add services to | |
| 28 // expose to the embedder. | |
| 29 // | |
| 30 // Note that if a different application is subsequently embedded at |root|, | |
| 31 // the pipes connecting |services| and |exposed_services| to the embedder and | |
| 32 // any services obtained from them are not broken and will continue to be | |
| 33 // valid. | |
| 34 virtual void OnEmbed(View* root, | |
| 35 InterfaceRequest<ServiceProvider> services, | |
| 36 ServiceProviderPtr exposed_services) = 0; | |
| 37 | |
| 38 // Called when a connection to the view manager service is closed. | |
| 39 // |view_manager| is not valid after this function returns. | |
| 40 virtual void OnViewManagerDisconnected(ViewManager* view_manager) = 0; | |
| 41 | |
| 42 // Asks the delegate to perform the specified action. | |
| 43 // TODO(sky): nuke! See comments in view_manager.mojom for details. | |
| 44 virtual bool OnPerformAction(View* view, const std::string& action); | |
| 45 | |
| 46 protected: | |
| 47 virtual ~ViewManagerDelegate() {} | |
| 48 }; | |
| 49 | |
| 50 } // namespace mojo | |
| 51 | |
| 52 #endif // MOJO_SERVICES_VIEW_MANAGER_CPP_VIEW_MANAGER_DELEGATE_H_ | |
| OLD | NEW |