OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_FRAME_NAVIGATION_STATE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_FRAME_NAVIGATION_STATE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_FRAME_NAVIGATION_STATE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_FRAME_NAVIGATION_STATE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // True if the frame is marked as being in an error state. | 92 // True if the frame is marked as being in an error state. |
93 bool GetErrorOccurredInFrame(FrameID frame_id) const; | 93 bool GetErrorOccurredInFrame(FrameID frame_id) const; |
94 | 94 |
95 // Marks a frame as having finished its last navigation, i.e. the onCompleted | 95 // Marks a frame as having finished its last navigation, i.e. the onCompleted |
96 // event was fired for this frame. | 96 // event was fired for this frame. |
97 void SetNavigationCompleted(FrameID frame_id); | 97 void SetNavigationCompleted(FrameID frame_id); |
98 | 98 |
99 // True if the frame is currently not navigating. | 99 // True if the frame is currently not navigating. |
100 bool GetNavigationCompleted(FrameID frame_id) const; | 100 bool GetNavigationCompleted(FrameID frame_id) const; |
101 | 101 |
| 102 // Marks a frame as having finished parsing. |
| 103 void SetParsingFinished(FrameID frame_id); |
| 104 |
| 105 // True if the frame has finished parsing. |
| 106 bool GetParsingFinished(FrameID frame_id) const; |
| 107 |
102 // Marks a frame as having committed its navigation, i.e. the onCommitted | 108 // Marks a frame as having committed its navigation, i.e. the onCommitted |
103 // event was fired for this frame. | 109 // event was fired for this frame. |
104 void SetNavigationCommitted(FrameID frame_id); | 110 void SetNavigationCommitted(FrameID frame_id); |
105 | 111 |
106 // True if the frame has committed its navigation. | 112 // True if the frame has committed its navigation. |
107 bool GetNavigationCommitted(FrameID frame_id) const; | 113 bool GetNavigationCommitted(FrameID frame_id) const; |
108 | 114 |
109 // Marks a frame as redirected by the server. | 115 // Marks a frame as redirected by the server. |
110 void SetIsServerRedirected(FrameID frame_id); | 116 void SetIsServerRedirected(FrameID frame_id); |
111 | 117 |
112 // True if the frame was redirected by the server. | 118 // True if the frame was redirected by the server. |
113 bool GetIsServerRedirected(FrameID frame_id) const; | 119 bool GetIsServerRedirected(FrameID frame_id) const; |
114 | 120 |
115 #ifdef UNIT_TEST | 121 #ifdef UNIT_TEST |
116 static void set_allow_extension_scheme(bool allow_extension_scheme) { | 122 static void set_allow_extension_scheme(bool allow_extension_scheme) { |
117 allow_extension_scheme_ = allow_extension_scheme; | 123 allow_extension_scheme_ = allow_extension_scheme; |
118 } | 124 } |
119 #endif | 125 #endif |
120 | 126 |
121 private: | 127 private: |
122 struct FrameState { | 128 struct FrameState { |
123 FrameState(); | 129 FrameState(); |
124 | 130 |
125 bool error_occurred; // True if an error has occurred in this frame. | 131 bool error_occurred; // True if an error has occurred in this frame. |
126 bool is_main_frame; // True if this is a main frame. | 132 bool is_main_frame; // True if this is a main frame. |
127 bool is_iframe_srcdoc; // True if the frame is displaying its srcdoc. | 133 bool is_iframe_srcdoc; // True if the frame is displaying its srcdoc. |
128 bool is_navigating; // True if there is a navigation going on. | 134 bool is_navigating; // True if there is a navigation going on. |
129 bool is_committed; // True if the navigation is already committed. | 135 bool is_committed; // True if the navigation is already committed. |
130 bool is_server_redirected; // True if a server redirect happened. | 136 bool is_server_redirected; // True if a server redirect happened. |
| 137 bool is_parsing; // True if the frame is still parsing. |
131 int64 parent_frame_num; | 138 int64 parent_frame_num; |
132 GURL url; // URL of this frame. | 139 GURL url; // URL of this frame. |
133 }; | 140 }; |
134 typedef std::map<FrameID, FrameState> FrameIdToStateMap; | 141 typedef std::map<FrameID, FrameState> FrameIdToStateMap; |
135 | 142 |
136 // Tracks the state of known frames. | 143 // Tracks the state of known frames. |
137 FrameIdToStateMap frame_state_map_; | 144 FrameIdToStateMap frame_state_map_; |
138 | 145 |
139 // Set of all known frames. | 146 // Set of all known frames. |
140 std::set<FrameID> frame_ids_; | 147 std::set<FrameID> frame_ids_; |
141 | 148 |
142 // The id of the last comitted main frame. | 149 // The id of the last comitted main frame. |
143 FrameID main_frame_id_; | 150 FrameID main_frame_id_; |
144 | 151 |
145 // If true, also allow events from chrome-extension:// URLs. | 152 // If true, also allow events from chrome-extension:// URLs. |
146 static bool allow_extension_scheme_; | 153 static bool allow_extension_scheme_; |
147 | 154 |
148 DISALLOW_COPY_AND_ASSIGN(FrameNavigationState); | 155 DISALLOW_COPY_AND_ASSIGN(FrameNavigationState); |
149 }; | 156 }; |
150 | 157 |
151 } // namespace extensions | 158 } // namespace extensions |
152 | 159 |
153 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_FRAME_NAVIGATION_STATE_H
_ | 160 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_FRAME_NAVIGATION_STATE_H
_ |
OLD | NEW |