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 24 matching lines...) Expand all Loading... |
35 const_iterator begin() const { return frame_hosts_.begin(); } | 35 const_iterator begin() const { return frame_hosts_.begin(); } |
36 const_iterator end() const { return frame_hosts_.end(); } | 36 const_iterator end() const { return frame_hosts_.end(); } |
37 | 37 |
38 // True if navigation events for the given frame can be sent. | 38 // True if navigation events for the given frame can be sent. |
39 bool CanSendEvents(content::RenderFrameHost* frame_host) const; | 39 bool CanSendEvents(content::RenderFrameHost* frame_host) const; |
40 | 40 |
41 // Starts to track a document load in |frame_host| to |url|. | 41 // Starts to track a document load in |frame_host| to |url|. |
42 void StartTrackingDocumentLoad(content::RenderFrameHost* frame_host, | 42 void StartTrackingDocumentLoad(content::RenderFrameHost* frame_host, |
43 const GURL& url, | 43 const GURL& url, |
44 bool is_same_page, | 44 bool is_same_page, |
45 bool is_error_page, | 45 bool is_error_page); |
46 bool is_iframe_srcdoc); | |
47 | 46 |
48 // Adds the |frame_host| to the set of RenderFrameHosts associated with the | 47 // Adds the |frame_host| to the set of RenderFrameHosts associated with the |
49 // WebContents this object is tracking. This method and FrameHostDeleted | 48 // WebContents this object is tracking. This method and FrameHostDeleted |
50 // are used to track the set of current RenderFrameHosts, which is used to | 49 // are used to track the set of current RenderFrameHosts, which is used to |
51 // implement the GetFrame and GetAllFrames extension APIs. | 50 // implement the GetFrame and GetAllFrames extension APIs. |
52 void FrameHostCreated(content::RenderFrameHost* frame_host); | 51 void FrameHostCreated(content::RenderFrameHost* frame_host); |
53 | 52 |
54 // Removes the |frame_host| from the set of RenderFrameHosts associated with | 53 // Removes the |frame_host| from the set of RenderFrameHosts associated with |
55 // the WebContents this object is tracking. | 54 // the WebContents this object is tracking. |
56 void FrameHostDeleted(content::RenderFrameHost* frame_host); | 55 void FrameHostDeleted(content::RenderFrameHost* frame_host); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 static void set_allow_extension_scheme(bool allow_extension_scheme) { | 89 static void set_allow_extension_scheme(bool allow_extension_scheme) { |
91 allow_extension_scheme_ = allow_extension_scheme; | 90 allow_extension_scheme_ = allow_extension_scheme; |
92 } | 91 } |
93 #endif | 92 #endif |
94 | 93 |
95 private: | 94 private: |
96 struct FrameState { | 95 struct FrameState { |
97 FrameState(); | 96 FrameState(); |
98 | 97 |
99 bool error_occurred; // True if an error has occurred in this frame. | 98 bool error_occurred; // True if an error has occurred in this frame. |
100 bool is_iframe_srcdoc; // True if the frame is displaying its srcdoc. | |
101 bool is_loading; // True if there is a document load going on. | 99 bool is_loading; // True if there is a document load going on. |
102 bool is_parsing; // True if the frame is still parsing. | 100 bool is_parsing; // True if the frame is still parsing. |
103 GURL url; // URL of this frame. | 101 GURL url; // URL of this frame. |
104 }; | 102 }; |
105 typedef std::map<content::RenderFrameHost*, FrameState> FrameHostToStateMap; | 103 typedef std::map<content::RenderFrameHost*, FrameState> FrameHostToStateMap; |
106 | 104 |
107 // Tracks the state of known frame hosts. | 105 // Tracks the state of known frame hosts. |
108 FrameHostToStateMap frame_host_state_map_; | 106 FrameHostToStateMap frame_host_state_map_; |
109 | 107 |
110 // Set of all known frame hosts. | 108 // Set of all known frame hosts. |
111 std::set<content::RenderFrameHost*> frame_hosts_; | 109 std::set<content::RenderFrameHost*> frame_hosts_; |
112 | 110 |
113 // If true, also allow events from chrome-extension:// URLs. | 111 // If true, also allow events from chrome-extension:// URLs. |
114 static bool allow_extension_scheme_; | 112 static bool allow_extension_scheme_; |
115 | 113 |
116 DISALLOW_COPY_AND_ASSIGN(FrameNavigationState); | 114 DISALLOW_COPY_AND_ASSIGN(FrameNavigationState); |
117 }; | 115 }; |
118 | 116 |
119 } // namespace extensions | 117 } // namespace extensions |
120 | 118 |
121 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_FRAME_NAVIGATION_STATE_H
_ | 119 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_FRAME_NAVIGATION_STATE_H
_ |
OLD | NEW |