Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(506)

Side by Side Diff: chrome/common/extensions/docs/server2/templates/intros/webNavigation.html

Issue 10832042: Extensions Docs Server: Doc conversion script (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: everything but svn stuff Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <!-- BEGIN AUTHORED CONTENT -->
2 <p id="classSummary"> 1 <p id="classSummary">
3 Use the <code>chrome.webNavigation</code> module to receive 2 Use the <code>chrome.webNavigation</code> module to receive
4 notifications about the status of navigations requests in-flight. 3 notifications about the status of navigations requests in-flight.
5 </p> 4 </p>
5
6 <h2>Manifest</h2> 6 <h2>Manifest</h2>
7 <p> 7 <p>
8 All <code>chrome.webNavigation</code> methods and events require you to declare 8 All <code>chrome.webNavigation</code> methods and events require you to declare
9 the "webNavigation" permission in the <a href="manifest.html">extension 9 the "webNavigation" permission in the <a href="manifest.html">extension
10 manifest</a>. 10 manifest</a>.
11 For example: 11 For example:
12 </p> 12 </p>
13
13 <pre>{ 14 <pre>{
14 "name": "My extension", 15 "name": "My extension",
15 ... 16 ...
16 <b>"permissions": [ 17 <b>"permissions": [
17 "webNavigation" 18 "webNavigation"
18 ]</b>, 19 ]</b>,
19 ... 20 ...
20 }</pre> 21 }</pre>
22
23
21 <h2>Examples</h2> 24 <h2>Examples</h2>
25
22 <p> 26 <p>
23 You can find simple examples of using the tabs module in the 27 You can find simple examples of using the tabs module in the
24 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extension s/docs/examples/api/webNavigation/">examples/api/webNavigation</a> 28 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extension s/docs/examples/api/webNavigation/">examples/api/webNavigation</a>
25 directory. 29 directory.
26 For other examples and for help in viewing the source code, see 30 For other examples and for help in viewing the source code, see
27 <a href="samples.html">Samples</a>. 31 <a href="samples.html">Samples</a>.
28 </p> 32 </p>
33
29 <h2>Event order</h2> 34 <h2>Event order</h2>
30 <p> 35 <p>
31 For a navigation that is successfully completed, events are fired in the 36 For a navigation that is successfully completed, events are fired in the
32 following order: 37 following order:
33 <pre> 38 <pre>
34 onBeforeNavigate -&gt; onCommitted -&gt; onDOMContentLoaded -&gt; onCompleted 39 onBeforeNavigate -&gt; onCommitted -&gt; onDOMContentLoaded -&gt; onCompleted
35 </pre> 40 </pre>
36 </p> 41 </p>
37 <p> 42 <p>
38 Any error that occurs during the process results in an 43 Any error that occurs during the process results in an
39 <code>onErrorOccurred</code> event. For a specific navigation, there are no 44 <code>onErrorOccurred</code> event. For a specific navigation, there are no
40 further events fired after <code>onErrorOccurred</code>. 45 further events fired after <code>onErrorOccurred</code>.
41 </p> 46 </p>
42 <p> 47 <p>
43 If a navigating frame contains subframes, its <code>onCommitted</code> is fired 48 If a navigating frame contains subframes, its <code>onCommitted</code> is fired
44 before any of its children's <code>onBeforeNavigate</code>; while 49 before any of its children's <code>onBeforeNavigate</code>; while
45 <code>onCompleted</code> is fired after all of its children's 50 <code>onCompleted</code> is fired after all of its children's
46 <code>onCompleted</code>. 51 <code>onCompleted</code>.
47 </p> 52 </p>
48 <p> 53 <p>
49 If the reference fragment of a frame is changed, a 54 If the reference fragment of a frame is changed, a
50 <code>onReferenceFragmentUpdated</code> event is fired. This event can fire any 55 <code>onReferenceFragmentUpdated</code> event is fired. This event can fire any
51 time after <code>onDOMContentLoaded</code>, even after 56 time after <code>onDOMContentLoaded</code>, even after
52 <code>onCompleted</code>. 57 <code>onCompleted</code>.
53 </p> 58 </p>
59 <p>
60 If the history API is used to modify the state of a frame (e.g. using
61 <code>history.pushState()</code>, a <code>onHistoryStateUpdated</code> event is
62 fired. This event can fire any time after <code>onDOMContentLoaded</code>.
63 </p>
64 <p>
65 If a navigation was triggered via <a
66 href="https://support.google.com/chrome/bin/answer.py?answer=177873">Chrome
67 Instant</a> or <a
68 href="https://support.google.com/chrome/bin/answer.py?answer=1385029">Instant
69 Pages</a>, a completely loaded page is swapped into the current tab. In that
70 case, an <code>onTabReplaced</code> event is fired.
71 </p>
72
54 <h2>Relation to webRequest events</h2> 73 <h2>Relation to webRequest events</h2>
55 <p> 74 <p>
56 There is no defined ordering between events of the <a 75 There is no defined ordering between events of the <a
57 href="webRequest.html">webRequest API</a> and the events of the 76 href="webRequest.html">webRequest API</a> and the events of the
58 webNavigation API. It is possible that webRequest events are still received for 77 webNavigation API. It is possible that webRequest events are still received for
59 frames that already started a new navigation, or that a navigation only 78 frames that already started a new navigation, or that a navigation only
60 proceeds after the network resources are already fully loaded. 79 proceeds after the network resources are already fully loaded.
61 </p> 80 </p>
62 <p> 81 <p>
63 In general, the webNavigation events are closely related to the navigation 82 In general, the webNavigation events are closely related to the navigation
64 state that is displayed in the UI, while the webRequest events correspond to 83 state that is displayed in the UI, while the webRequest events correspond to
65 the state of the network stack which is generally opaque to the user. 84 the state of the network stack which is generally opaque to the user.
66 </p> 85 </p>
86
87 <h2>A note about tab IDs</h2>
88 <p>
89 Not all navigating tabs correspond to actual tabs in Chrome's UI, e.g., a tab
90 that is being pre-rendered. Such tabs are not accessible via the
91 <a href="tabs.html">tabs API</a> nor can you request information about them via
92 <code>webNavigation.getFrame</code> or <code>webNavigation.getAllFrames</code>.
93 Once such a tab is swapped in, an <code>onTabReplaced</code> event is fired and
94 they become accessible via these APIs.
95 </p>
96
67 <h2>A note about timestamps</h2> 97 <h2>A note about timestamps</h2>
68 <p> 98 <p>
69 It's important to note that some technical oddities in the OS's handling 99 It's important to note that some technical oddities in the OS's handling
70 of distinct Chrome processes can cause the clock to be skewed between the 100 of distinct Chrome processes can cause the clock to be skewed between the
71 browser itself and extension processes. That means that WebNavigation's events' 101 browser itself and extension processes. That means that WebNavigation's events'
72 <code>timeStamp</code> property is only guaranteed to be <i>internally</i> 102 <code>timeStamp</code> property is only guaranteed to be <i>internally</i>
73 consistent. Comparing one event to another event will give you the correct 103 consistent. Comparing one event to another event will give you the correct
74 offset between them, but comparing them to the current time inside the 104 offset between them, but comparing them to the current time inside the
75 extension (via <code>(new Date()).getTime()</code>, for instance) might give 105 extension (via <code>(new Date()).getTime()</code>, for instance) might give
76 unexpected results. 106 unexpected results.
77 </p> 107 </p>
108
109 <h2>A note about frame and process IDs</h2>
110 <p>
111 Due to the multi-process nature of Chrome, a tab might use different processes
112 to render the source and destination of a web page. Therefore, if a navigation
113 takes place in a new process, you might receive events both from the new and
114 the old page until the new navigation is committed (i.e. the
115 <code>onCommitted</code> event is send for the new main frame). Because frame
116 IDs are only unique for a given process, the webNavigation events include a
117 process ID, so you can still determine which frame a navigation came from.
118 </p>
119 <p>
120 Also note that during a provisional load the process might be switched several
121 times. This happens when the load is redirected to a different site. In this
122 case, you will receive repeated <code>onBeforeNavigate</code> and
123 <code>onErrorOccurred</code> events, until you receive the final
124 <code>onCommitted</code> event.
125 </p>
126
78 <h2>Transition types and qualifiers</h2> 127 <h2>Transition types and qualifiers</h2>
79 <p> 128 <p>
80 The webNavigation API's <code>onCommitted</code> event has a 129 The webNavigation API's <code>onCommitted</code> event has a
81 <code>transitionType</code> and a <code>transitionQualifiers</code> property. 130 <code>transitionType</code> and a <code>transitionQualifiers</code> property.
82 The <em>transition type</em> is the same as used in the <a 131 The <em>transition type</em> is the same as used in the <a
83 href="history.html#transition_types">history API</a> describing how the browser 132 href="history.html#transition_types">history API</a> describing how the browser
84 navigated to this particular URL. In addition, several <em>transition 133 navigated to this particular URL. In addition, several <em>transition
85 qualifiers</em> can be returned that further define the navigation. 134 qualifiers</em> can be returned that further define the navigation.
86 </p> 135 </p>
87 <p> 136 <p>
(...skipping 22 matching lines...) Expand all
110 <td> 159 <td>
111 The user used the Forward or Back button to initiate the navigation. 160 The user used the Forward or Back button to initiate the navigation.
112 </td> 161 </td>
113 </tr> 162 </tr>
114 <tr> 163 <tr>
115 <td>"from_address_bar"</td> 164 <td>"from_address_bar"</td>
116 <td> 165 <td>
117 The user initiated the navigation from the address bar (aka Omnibox). 166 The user initiated the navigation from the address bar (aka Omnibox).
118 </td> 167 </td>
119 </tr> 168 </tr>
120 </table> 169 </table>
121 <!-- END AUTHORED CONTENT -->
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698