Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / mojo / services / public / interfaces / navigation / navigation.mojom
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 import "mojo/services/public/interfaces/network/url_loader.mojom"
6
7 module mojo {
8
9 // Expresses a preference for where a navigation will be performed.
10 enum Target {
11   // No preference
12   DEFAULT,
13
14   // In the same ViewManager node that the navigation was initiated
15   SOURCE_NODE,
16
17   // In a new ViewManager node
18   NEW_NODE
19 };
20
21 struct NavigationDetails {
22   // TODO(mpcomplete): will we ever need more than the URLRequest? Can
23   // we pass that around directly?
24   URLRequest request = default;
25 };
26
27 struct ResponseDetails {
28   // TODO(beng): consider providing access to URLRequest too. Currently it is
29   //             not possible to obtain from the URLLoader.
30
31   URLResponse response;
32
33   // The URLLoader instance that generated the response. This must be kept
34   // alive until the response body has been completely consumed.
35   URLLoader loader;
36 };
37
38 // Embedders that support navigation of implement this interface.
39 interface NavigatorHost {
40   RequestNavigate(uint32 source_node_id, Target target,
41                   NavigationDetails details);
42
43   // Applications call this to inform hosts of navigations they performed
44   // locally. For example, pushState() navigations in an HTML application.
45   DidNavigateLocally(uint32 source_node_id, string url);
46 };
47
48 // Applications implement this interface to support navigation of their views
49 // by embedders.
50 // |response_details| can be NULL when a navigation was not the result of a
51 // network load.
52 interface Navigator {
53   Navigate(uint32 node_id,
54            NavigationDetails navigation_details,
55            ResponseDetails response_details);
56 };
57
58 }