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

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

Issue 11090068: When starting a provisional load include the parent frame ID in the IPC and pass it down the th WCO… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 // 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 const_iterator end() const { return frame_ids_.end(); } 46 const_iterator end() const { return frame_ids_.end(); }
47 47
48 // True if navigation events for the given frame can be sent. 48 // True if navigation events for the given frame can be sent.
49 bool CanSendEvents(FrameID frame_id) const; 49 bool CanSendEvents(FrameID frame_id) const;
50 50
51 // True if in general webNavigation events may be sent for the given URL. 51 // True if in general webNavigation events may be sent for the given URL.
52 bool IsValidUrl(const GURL& url) const; 52 bool IsValidUrl(const GURL& url) const;
53 53
54 // Starts to track a frame identified by its |frame_id| showing the URL |url|. 54 // Starts to track a frame identified by its |frame_id| showing the URL |url|.
55 void TrackFrame(FrameID frame_id, 55 void TrackFrame(FrameID frame_id,
56 FrameID parent_frame_id,
56 const GURL& url, 57 const GURL& url,
57 bool is_main_frame, 58 bool is_main_frame,
58 bool is_error_page); 59 bool is_error_page);
59 60
60 // Stops tracking all frames but the frame with |id_to_skip| for a given 61 // Stops tracking all frames but the frame with |id_to_skip| for a given
61 // RenderViewHost. 62 // RenderViewHost.
62 void StopTrackingFramesInRVH(content::RenderViewHost* render_view_host, 63 void StopTrackingFramesInRVH(content::RenderViewHost* render_view_host,
63 FrameID id_to_skip); 64 FrameID id_to_skip);
64 65
65 // Update the URL associated with a given frame. 66 // Update the URL associated with a given frame.
66 void UpdateFrame(FrameID frame_id, const GURL& url); 67 void UpdateFrame(FrameID frame_id, const GURL& url);
67 68
68 // Returns true if |frame_id| is a known frame. 69 // Returns true if |frame_id| is a known frame.
69 bool IsValidFrame(FrameID frame_id) const; 70 bool IsValidFrame(FrameID frame_id) const;
70 71
71 // Returns the URL corresponding to a tracked frame given by its |frame_id|. 72 // Returns the URL corresponding to a tracked frame given by its |frame_id|.
72 GURL GetUrl(FrameID frame_id) const; 73 GURL GetUrl(FrameID frame_id) const;
73 74
74 // True if the frame given by its |frame_id| is a main frame of its tab. 75 // True if the frame given by its |frame_id| is a main frame of its tab.
75 // There might be multiple uncomitted main frames. 76 // There might be multiple uncomitted main frames.
76 bool IsMainFrame(FrameID frame_id) const; 77 bool IsMainFrame(FrameID frame_id) const;
77 78
78 // Returns the frame ID of the last comitted main frame, or -1 if the frame 79 // Returns the frame ID of the last comitted main frame, or -1 if the frame
79 // ID is not known. 80 // ID is not known.
80 FrameID GetMainFrameID() const; 81 FrameID GetMainFrameID() const;
81 82
83 // Get the parent frame ID (or an invalid ID, if |frame_id| is a main frame).
84 FrameID GetParentFrameID(FrameID frame_id) const;
85
82 // Marks a frame as in an error state, i.e. the onErrorOccurred event was 86 // Marks a frame as in an error state, i.e. the onErrorOccurred event was
83 // fired for this frame, and no further events should be sent for it. 87 // fired for this frame, and no further events should be sent for it.
84 void SetErrorOccurredInFrame(FrameID frame_id); 88 void SetErrorOccurredInFrame(FrameID frame_id);
85 89
86 // True if the frame is marked as being in an error state. 90 // True if the frame is marked as being in an error state.
87 bool GetErrorOccurredInFrame(FrameID frame_id) const; 91 bool GetErrorOccurredInFrame(FrameID frame_id) const;
88 92
89 // Marks a frame as having finished its last navigation, i.e. the onCompleted 93 // Marks a frame as having finished its last navigation, i.e. the onCompleted
90 // event was fired for this frame. 94 // event was fired for this frame.
91 void SetNavigationCompleted(FrameID frame_id); 95 void SetNavigationCompleted(FrameID frame_id);
(...skipping 20 matching lines...) Expand all
112 } 116 }
113 #endif 117 #endif
114 118
115 private: 119 private:
116 struct FrameState { 120 struct FrameState {
117 bool error_occurred; // True if an error has occurred in this frame. 121 bool error_occurred; // True if an error has occurred in this frame.
118 bool is_main_frame; // True if this is a main frame. 122 bool is_main_frame; // True if this is a main frame.
119 bool is_navigating; // True if there is a navigation going on. 123 bool is_navigating; // True if there is a navigation going on.
120 bool is_committed; // True if the navigation is already committed. 124 bool is_committed; // True if the navigation is already committed.
121 bool is_server_redirected; // True if a server redirect happened. 125 bool is_server_redirected; // True if a server redirect happened.
126 int64 parent_frame_num;
Bernhard Bauer 2012/10/12 08:32:49 It's a bit confusing to have "frame ID" mean both
jochen (gone - plz use gerrit) 2012/10/12 10:44:48 a frame is identified by this in, and the RV it is
122 GURL url; // URL of this frame. 127 GURL url; // URL of this frame.
123 }; 128 };
124 typedef std::map<FrameID, FrameState> FrameIdToStateMap; 129 typedef std::map<FrameID, FrameState> FrameIdToStateMap;
125 130
126 // Tracks the state of known frames. 131 // Tracks the state of known frames.
127 FrameIdToStateMap frame_state_map_; 132 FrameIdToStateMap frame_state_map_;
128 133
129 // Set of all known frames. 134 // Set of all known frames.
130 std::set<FrameID> frame_ids_; 135 std::set<FrameID> frame_ids_;
131 136
132 // The id of the last comitted main frame. 137 // The id of the last comitted main frame.
133 FrameID main_frame_id_; 138 FrameID main_frame_id_;
134 139
135 // If true, also allow events from chrome-extension:// URLs. 140 // If true, also allow events from chrome-extension:// URLs.
136 static bool allow_extension_scheme_; 141 static bool allow_extension_scheme_;
137 142
138 DISALLOW_COPY_AND_ASSIGN(FrameNavigationState); 143 DISALLOW_COPY_AND_ASSIGN(FrameNavigationState);
139 }; 144 };
140 145
141 } // namespace extensions 146 } // namespace extensions
142 147
143 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_FRAME_NAVIGATION_STATE_H _ 148 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_FRAME_NAVIGATION_STATE_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698