OLD | NEW |
| (Empty) |
1 // Copyright 2016 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 module navigation.mojom; | |
6 | |
7 import "services/ui/public/interfaces/window_tree.mojom"; | |
8 import "ui/gfx/geometry/mojo/geometry.mojom"; | |
9 import "url/mojo/url.mojom"; | |
10 | |
11 // TODO(beng): A general note about structs & methods in this file. | |
12 // | |
13 // These types are (for the most part) fairly rote copies of enums, structs & | |
14 // interfaces from //content/public/browser & friends. | |
15 // Not a huge amount of thought has been put into which values & methods should | |
16 // be made available, the emphasis has been on getting a working service up and | |
17 // running that is useful. It would be worth taking a pass through this set at | |
18 // some point, condensing it, figuring out how it relates to stuff in | |
19 // content/public/browser, etc. | |
20 // | |
21 // For now, it's duplicated here because this service is still experimental and | |
22 // I didn't want to disrupt content/public/browser based on an experiment. | |
23 | |
24 // Copied from //content/public/browser/navigation_entry.h | |
25 struct NavigationEntry { | |
26 int32 id; | |
27 url.mojom.Url url; | |
28 string title; | |
29 array<url.mojom.Url> redirect_chain; | |
30 }; | |
31 | |
32 // Copied from //content/public/browser/navigation_type.h | |
33 enum NavigationType { | |
34 UNKNOWN, | |
35 NEW_PAGE, | |
36 EXISTING_PAGE, | |
37 SAME_PAGE, | |
38 NEW_SUBFRAME, | |
39 AUTO_SUBFRAME, | |
40 NAV_IGNORE | |
41 }; | |
42 | |
43 // Copied from //ui/base/window_open_disposition.h | |
44 enum WindowOpenDisposition { | |
45 UNKNOWN, | |
46 CURRENT_TAB, | |
47 SINGLETON_TAB, | |
48 NEW_FOREGROUND_TAB, | |
49 NEW_BACKGROUND_TAB, | |
50 NEW_POPUP, | |
51 NEW_WINDOW, | |
52 SAVE_TO_DISK, | |
53 OFF_THE_RECORD, | |
54 IGNORE_ACTION, | |
55 WINDOW_OPEN_DISPOSITION_LAST = IGNORE_ACTION | |
56 }; | |
57 | |
58 // Copied from //content/public/browser/navigation_details.h | |
59 struct NavigationCommittedDetails { | |
60 int32 entry; | |
61 NavigationType type; | |
62 int32 previous_entry_index; | |
63 url.mojom.Url previous_url; | |
64 bool did_replace_entry; | |
65 bool is_in_page; | |
66 bool is_main_frame; | |
67 // SSLStatus ssl_status; | |
68 int32 http_status_code; | |
69 }; | |
70 | |
71 // Copied from //content/public/browser/page_navigator.h | |
72 struct OpenURLParams { | |
73 url.mojom.Url url; | |
74 WindowOpenDisposition disposition; | |
75 }; | |
76 | |
77 interface ViewFactory { | |
78 CreateView(ViewClient client, View& view); | |
79 }; | |
80 | |
81 interface ViewClient { | |
82 OpenURL(OpenURLParams params); | |
83 LoadingStateChanged(bool is_loading); | |
84 NavigationStateChanged(url.mojom.Url url, | |
85 string title, | |
86 bool can_go_back, | |
87 bool can_go_forward); | |
88 LoadProgressChanged(double progress); | |
89 UpdateHoverURL(url.mojom.Url url); | |
90 | |
91 ViewCreated(View view, | |
92 ViewClient& client, | |
93 bool is_popup, | |
94 gfx.mojom.Rect initial_rect, | |
95 bool user_gesture); | |
96 Close(); | |
97 | |
98 // See //content/public/browser/notification_types.h for descriptions of | |
99 // these events. | |
100 NavigationPending(NavigationEntry entry); | |
101 NavigationCommitted(NavigationCommittedDetails details, | |
102 int32 current_index); | |
103 NavigationListPruned(bool from_front, int32 count); | |
104 NavigationEntryChanged(NavigationEntry entry, int32 entry_index); | |
105 }; | |
106 | |
107 interface View { | |
108 // Navigates the view to |url|. | |
109 NavigateTo(url.mojom.Url url); | |
110 | |
111 GoBack(); | |
112 GoForward(); | |
113 NavigateToOffset(int32 offset); | |
114 Reload(bool bypass_cache); | |
115 Stop(); | |
116 | |
117 // Obtains a Mus WindowTreeClient for the View, so it can be embedded in a | |
118 // UI. | |
119 GetWindowTreeClient(ui.mojom.WindowTreeClient& client); | |
120 | |
121 ShowInterstitial(string html); | |
122 HideInterstitial(); | |
123 }; | |
OLD | NEW |