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

Side by Side Diff: chrome/browser/extensions/api/web_navigation/frame_navigation_state.h

Issue 11791018: When an iframe displays its srcdoc, generate navigation events for about:srcdoc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/web_navigation/frame_navigation_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 bool CanSendEvents(FrameID frame_id) const; 47 bool CanSendEvents(FrameID frame_id) const;
48 48
49 // True if in general webNavigation events may be sent for the given URL. 49 // True if in general webNavigation events may be sent for the given URL.
50 bool IsValidUrl(const GURL& url) const; 50 bool IsValidUrl(const GURL& url) const;
51 51
52 // Starts to track a frame identified by its |frame_id| showing the URL |url|. 52 // Starts to track a frame identified by its |frame_id| showing the URL |url|.
53 void TrackFrame(FrameID frame_id, 53 void TrackFrame(FrameID frame_id,
54 FrameID parent_frame_id, 54 FrameID parent_frame_id,
55 const GURL& url, 55 const GURL& url,
56 bool is_main_frame, 56 bool is_main_frame,
57 bool is_error_page); 57 bool is_error_page,
58 bool is_iframe_srcdoc);
58 59
59 // Stops tracking all frames but the frame with |id_to_skip| for a given 60 // Stops tracking all frames but the frame with |id_to_skip| for a given
60 // RenderViewHost. 61 // RenderViewHost.
61 void StopTrackingFramesInRVH(content::RenderViewHost* render_view_host, 62 void StopTrackingFramesInRVH(content::RenderViewHost* render_view_host,
62 FrameID id_to_skip); 63 FrameID id_to_skip);
63 64
64 // Update the URL associated with a given frame. 65 // Update the URL associated with a given frame.
65 void UpdateFrame(FrameID frame_id, const GURL& url); 66 void UpdateFrame(FrameID frame_id, const GURL& url);
66 67
67 // Returns true if |frame_id| is a known frame. 68 // Returns true if |frame_id| is a known frame.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 bool GetIsServerRedirected(FrameID frame_id) const; 110 bool GetIsServerRedirected(FrameID frame_id) const;
110 111
111 #ifdef UNIT_TEST 112 #ifdef UNIT_TEST
112 static void set_allow_extension_scheme(bool allow_extension_scheme) { 113 static void set_allow_extension_scheme(bool allow_extension_scheme) {
113 allow_extension_scheme_ = allow_extension_scheme; 114 allow_extension_scheme_ = allow_extension_scheme;
114 } 115 }
115 #endif 116 #endif
116 117
117 private: 118 private:
118 struct FrameState { 119 struct FrameState {
120 FrameState();
121
119 bool error_occurred; // True if an error has occurred in this frame. 122 bool error_occurred; // True if an error has occurred in this frame.
120 bool is_main_frame; // True if this is a main frame. 123 bool is_main_frame; // True if this is a main frame.
124 bool is_iframe_srcdoc; // True if the frame is displaying its srcdoc.
121 bool is_navigating; // True if there is a navigation going on. 125 bool is_navigating; // True if there is a navigation going on.
122 bool is_committed; // True if the navigation is already committed. 126 bool is_committed; // True if the navigation is already committed.
123 bool is_server_redirected; // True if a server redirect happened. 127 bool is_server_redirected; // True if a server redirect happened.
124 int64 parent_frame_num; 128 int64 parent_frame_num;
125 GURL url; // URL of this frame. 129 GURL url; // URL of this frame.
126 }; 130 };
127 typedef std::map<FrameID, FrameState> FrameIdToStateMap; 131 typedef std::map<FrameID, FrameState> FrameIdToStateMap;
128 132
129 // Tracks the state of known frames. 133 // Tracks the state of known frames.
130 FrameIdToStateMap frame_state_map_; 134 FrameIdToStateMap frame_state_map_;
131 135
132 // Set of all known frames. 136 // Set of all known frames.
133 std::set<FrameID> frame_ids_; 137 std::set<FrameID> frame_ids_;
134 138
135 // The id of the last comitted main frame. 139 // The id of the last comitted main frame.
136 FrameID main_frame_id_; 140 FrameID main_frame_id_;
137 141
138 // If true, also allow events from chrome-extension:// URLs. 142 // If true, also allow events from chrome-extension:// URLs.
139 static bool allow_extension_scheme_; 143 static bool allow_extension_scheme_;
140 144
141 DISALLOW_COPY_AND_ASSIGN(FrameNavigationState); 145 DISALLOW_COPY_AND_ASSIGN(FrameNavigationState);
142 }; 146 };
143 147
144 } // namespace extensions 148 } // namespace extensions
145 149
146 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_FRAME_NAVIGATION_STATE_H _ 150 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_FRAME_NAVIGATION_STATE_H _
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/web_navigation/frame_navigation_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698