summaryrefslogtreecommitdiffstats
path: root/mojo/services/public/interfaces/navigation/navigation.mojom
blob: d01230806c6ec781c807a183959df29c5cfcc90b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// 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.

import "mojo/services/public/interfaces/network/url_loader.mojom"

module mojo {

// Expresses a preference for where a navigation will be performed.
enum Target {
  // No preference
  DEFAULT,

  // In the same ViewManager node that the navigation was initiated
  SOURCE_NODE,

  // In a new ViewManager node
  NEW_NODE
};

struct NavigationDetails {
  string url;
  // TODO(aa): method, data, etc.
};

struct ResponseDetails {
  // TODO(beng): consider providing access to URLRequest too. Currently it is
  //             not possible to obtain from the URLLoader.

  mojo.URLResponse response;

  // The URLLoader instance that generated the response. This must be kept
  // alive until the response body has been completely consumed.
  mojo.URLLoader loader;
};

// Embedders that support navigation of implement this interface.
interface NavigatorHost {
  RequestNavigate(uint32 source_node_id, Target target,
                  NavigationDetails details);

  // Applications call this to inform hosts of navigations they performed
  // locally. For example, pushState() navigations in an HTML application.
  DidNavigateLocally(uint32 source_node_id, string url);
};

// Applications implement this interface to support navigation of their views
// by embedders.
// |response_details| can be NULL when a navigation was not the result of a
// network load.
interface Navigator {
  Navigate(uint32 node_id,
           NavigationDetails navigation_details,
           ResponseDetails response_details);
};

}