| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 EXTENSIONS_BROWSER_EXTENSION_API_FRAME_ID_MAP_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_API_FRAME_ID_MAP_H_ |
| 6 #define EXTENSIONS_BROWSER_EXTENSION_API_FRAME_ID_MAP_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_API_FRAME_ID_MAP_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 // Get the extension API frame ID for |navigation_handle|. | 91 // Get the extension API frame ID for |navigation_handle|. |
| 92 static int GetFrameId(content::NavigationHandle* navigation_handle); | 92 static int GetFrameId(content::NavigationHandle* navigation_handle); |
| 93 | 93 |
| 94 // Get the extension API frame ID for the parent of |rfh|. | 94 // Get the extension API frame ID for the parent of |rfh|. |
| 95 static int GetParentFrameId(content::RenderFrameHost* rfh); | 95 static int GetParentFrameId(content::RenderFrameHost* rfh); |
| 96 | 96 |
| 97 // Get the extension API frame ID for the parent of |navigation_handle|. | 97 // Get the extension API frame ID for the parent of |navigation_handle|. |
| 98 static int GetParentFrameId(content::NavigationHandle* navigation_handle); | 98 static int GetParentFrameId(content::NavigationHandle* navigation_handle); |
| 99 | 99 |
| 100 // Get the tab and window ID for a |rfh|. |
| 101 static void GetTabAndWindowId(content::RenderFrameHost* rfh, |
| 102 int* tab_id_out, |
| 103 int* window_id_out); |
| 104 |
| 100 // Find the current RenderFrameHost for a given WebContents and extension | 105 // Find the current RenderFrameHost for a given WebContents and extension |
| 101 // frame ID. | 106 // frame ID. |
| 102 // Returns nullptr if not found. | 107 // Returns nullptr if not found. |
| 103 static content::RenderFrameHost* GetRenderFrameHostById( | 108 static content::RenderFrameHost* GetRenderFrameHostById( |
| 104 content::WebContents* web_contents, | 109 content::WebContents* web_contents, |
| 105 int frame_id); | 110 int frame_id); |
| 106 | 111 |
| 107 // Runs |callback| with the result that is equivalent to calling GetFrameId() | 112 // Runs |callback| with the result that is equivalent to calling GetFrameId() |
| 108 // on the UI thread. Thread hopping is minimized if possible. Callbacks for | 113 // on the UI thread. Thread hopping is minimized if possible. Callbacks for |
| 109 // the same |render_process_id| and |frame_routing_id| are guaranteed to be | 114 // the same |render_process_id| and |frame_routing_id| are guaranteed to be |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 // This lock protects |frame_id_map_| from being concurrently written on the | 210 // This lock protects |frame_id_map_| from being concurrently written on the |
| 206 // UI thread and read on the IO thread. | 211 // UI thread and read on the IO thread. |
| 207 base::Lock frame_data_map_lock_; | 212 base::Lock frame_data_map_lock_; |
| 208 | 213 |
| 209 DISALLOW_COPY_AND_ASSIGN(ExtensionApiFrameIdMap); | 214 DISALLOW_COPY_AND_ASSIGN(ExtensionApiFrameIdMap); |
| 210 }; | 215 }; |
| 211 | 216 |
| 212 } // namespace extensions | 217 } // namespace extensions |
| 213 | 218 |
| 214 #endif // EXTENSIONS_BROWSER_EXTENSION_API_FRAME_ID_MAP_H_ | 219 #endif // EXTENSIONS_BROWSER_EXTENSION_API_FRAME_ID_MAP_H_ |
| OLD | NEW |