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