Linux: Depend on liberation-fonts package for RPMs.
[chromium-blink-merge.git] / components / mus / public / cpp / view_tree_delegate.h
blob2e2115e553b2da279879e931fd2c1bb25325abc2
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.
5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_VIEW_TREE_DELEGATE_H_
6 #define COMPONENTS_MUS_PUBLIC_CPP_VIEW_TREE_DELEGATE_H_
8 #include <string>
10 #include "components/mus/public/interfaces/view_tree.mojom.h"
11 #include "mojo/application/public/interfaces/service_provider.mojom.h"
12 #include "mojo/services/network/public/interfaces/url_loader.mojom.h"
14 namespace mus {
16 class View;
17 class ViewTreeConnection;
19 // Interface implemented by an application using the view manager.
21 // Each call to OnEmbed() results in a new ViewTreeConnection and new root View.
22 // ViewTreeConnection is deleted by any of the following:
23 // . If the root of the connection is destroyed. This happens if the owner
24 // of the root Embed()s another app in root, or the owner explicitly deletes
25 // root.
26 // . The connection to the view manager is lost.
27 // . Explicitly by way of calling delete.
29 // When the ViewTreeConnection is deleted all views are deleted (and observers
30 // notified). This is followed by notifying the delegate by way of
31 // OnConnectionLost().
32 class ViewTreeDelegate {
33 public:
34 // Called when the application implementing this interface is embedded at
35 // |root|.
37 // |services| exposes the services offered by the embedder to the delegate.
39 // |exposed_services| is an object that the delegate can add services to
40 // expose to the embedder.
42 // Note that if a different application is subsequently embedded at |root|,
43 // the pipes connecting |services| and |exposed_services| to the embedder and
44 // any services obtained from them are not broken and will continue to be
45 // valid.
46 virtual void OnEmbed(View* root) = 0;
48 // Sent when another app is embedded in the same View as this connection.
49 // Subsequently the root View and this object are destroyed (observers are
50 // notified appropriately).
51 virtual void OnUnembed();
53 // Called from the destructor of ViewTreeConnection after all the Views have
54 // been destroyed. |connection| is no longer valid after this call.
55 virtual void OnConnectionLost(ViewTreeConnection* connection) = 0;
57 protected:
58 virtual ~ViewTreeDelegate() {}
61 } // namespace mus
63 #endif // COMPONENTS_MUS_PUBLIC_CPP_VIEW_TREE_DELEGATE_H_