Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_EXTENSION_RENDERER_STATE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_RENDERER_STATE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_RENDERER_STATE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_RENDERER_STATE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 35 // These are called on the UI thread to start and stop listening to tab | 35 // These are called on the UI thread to start and stop listening to tab |
| 36 // notifications. | 36 // notifications. |
| 37 void Init(); | 37 void Init(); |
| 38 void Shutdown(); | 38 void Shutdown(); |
| 39 | 39 |
| 40 // Looks up the information for the embedder <webview> for a given render | 40 // Looks up the information for the embedder <webview> for a given render |
| 41 // view, if one exists. Called on the IO thread. | 41 // view, if one exists. Called on the IO thread. |
| 42 bool GetWebViewInfo(int guest_process_id, int guest_routing_id, | 42 bool GetWebViewInfo(int guest_process_id, int guest_routing_id, |
| 43 WebViewInfo* webview_info); | 43 WebViewInfo* webview_info); |
| 44 | 44 |
| 45 // Looks up the partition info for the embedder <webview> for a given guest | |
| 46 // process. | |
|
Fady Samuel
2014/06/16 21:01:56
Please mention that this should only be called on
Xi Han
2014/06/16 21:53:55
Done.
| |
| 47 bool GetWebViewPartitionID(int guest_process_id, std::string* partition_id); | |
| 48 | |
| 45 // Looks up the tab and window ID for a given request. Returns true if we have | 49 // Looks up the tab and window ID for a given request. Returns true if we have |
| 46 // the IDs in our map. Called on the IO thread. | 50 // the IDs in our map. Called on the IO thread. |
| 47 bool GetTabAndWindowId( | 51 bool GetTabAndWindowId( |
| 48 const content::ResourceRequestInfo* info, int* tab_id, int* window_id); | 52 const content::ResourceRequestInfo* info, int* tab_id, int* window_id); |
| 49 | 53 |
| 50 // Returns true if the given renderer is used by webviews. | 54 // Returns true if the given renderer is used by webviews. |
| 51 bool IsWebViewRenderer(int render_process_id); | 55 bool IsWebViewRenderer(int render_process_id); |
| 52 | 56 |
| 53 private: | 57 private: |
| 54 class RenderViewHostObserver; | 58 class RenderViewHostObserver; |
| 55 class TabObserver; | 59 class TabObserver; |
| 56 friend class TabObserver; | 60 friend class TabObserver; |
| 57 friend class WebViewGuest; | 61 friend class WebViewGuest; |
| 58 friend struct DefaultSingletonTraits<ExtensionRendererState>; | 62 friend struct DefaultSingletonTraits<ExtensionRendererState>; |
| 59 | 63 |
| 60 typedef std::pair<int, int> RenderId; | 64 typedef std::pair<int, int> RenderId; |
| 61 typedef std::pair<int, int> TabAndWindowId; | 65 typedef std::pair<int, int> TabAndWindowId; |
| 62 typedef std::map<RenderId, TabAndWindowId> TabAndWindowIdMap; | 66 typedef std::map<RenderId, TabAndWindowId> TabAndWindowIdMap; |
| 63 typedef std::map<RenderId, WebViewInfo> WebViewInfoMap; | 67 typedef std::map<RenderId, WebViewInfo> WebViewInfoMap; |
| 68 typedef std::map<int, std::string> WebViewPartitionIDMap; | |
| 64 | 69 |
| 65 ExtensionRendererState(); | 70 ExtensionRendererState(); |
| 66 ~ExtensionRendererState(); | 71 ~ExtensionRendererState(); |
| 67 | 72 |
| 68 // Adds or removes a render view from our map. | 73 // Adds or removes a render view from our map. |
| 69 void SetTabAndWindowId( | 74 void SetTabAndWindowId( |
| 70 int render_process_host_id, int routing_id, int tab_id, int window_id); | 75 int render_process_host_id, int routing_id, int tab_id, int window_id); |
| 71 void ClearTabAndWindowId( | 76 void ClearTabAndWindowId( |
| 72 int render_process_host_id, int routing_id); | 77 int render_process_host_id, int routing_id); |
| 73 | 78 |
| 74 // Adds or removes a <webview> guest render process from the set. | 79 // Adds or removes a <webview> guest render process from the set. |
| 75 void AddWebView(int render_process_host_id, int routing_id, | 80 void AddWebView(int render_process_host_id, int routing_id, |
| 76 const WebViewInfo& webview_info); | 81 const WebViewInfo& webview_info); |
| 77 void RemoveWebView(int render_process_host_id, int routing_id); | 82 void RemoveWebView(int render_process_host_id, int routing_id); |
| 83 void AddWebViewPartitionID(int render_process_host_id, | |
| 84 const std::string& partition_id); | |
| 85 void RemoveWebViewPartitionID(int render_process_host_id); | |
| 78 | 86 |
| 79 TabObserver* observer_; | 87 TabObserver* observer_; |
| 80 TabAndWindowIdMap map_; | 88 TabAndWindowIdMap map_; |
| 81 WebViewInfoMap webview_info_map_; | 89 WebViewInfoMap webview_info_map_; |
| 90 WebViewPartitionIDMap webview_partition_id_map; | |
|
Fady Samuel
2014/06/16 21:01:56
webview_partition_id_map_
Xi Han
2014/06/16 21:53:55
Done.
| |
| 82 | 91 |
| 83 DISALLOW_COPY_AND_ASSIGN(ExtensionRendererState); | 92 DISALLOW_COPY_AND_ASSIGN(ExtensionRendererState); |
| 84 }; | 93 }; |
| 85 | 94 |
| 86 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_RENDERER_STATE_H_ | 95 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_RENDERER_STATE_H_ |
| OLD | NEW |