| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_GUEST_VIEW_WEB_VIEW_WEB_VIEW_RENDERER_STATE_H_ | 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_RENDERER_STATE_H_ |
| 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_RENDERER_STATE_H_ | 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_RENDERER_STATE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 int rules_registry_id; | 25 int rules_registry_id; |
| 26 std::string partition_id; | 26 std::string partition_id; |
| 27 std::string owner_extension_id; | 27 std::string owner_extension_id; |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 static WebViewRendererState* GetInstance(); | 30 static WebViewRendererState* GetInstance(); |
| 31 | 31 |
| 32 // Looks up the information for the embedder <webview> for a given render | 32 // Looks up the information for the embedder <webview> for a given render |
| 33 // view, if one exists. Called on the IO thread. | 33 // view, if one exists. Called on the IO thread. |
| 34 bool GetInfo(int guest_process_id, int guest_routing_id, | 34 bool GetInfo(int guest_process_id, int guest_routing_id, |
| 35 WebViewInfo* webview_info); | 35 WebViewInfo* web_view_info); |
| 36 | 36 |
| 37 // Looks up the information for the owner for a given guest process in a | 37 // Looks up the information for the owner for a given guest process in a |
| 38 // <webview>. Called on the IO thread. | 38 // <webview>. Called on the IO thread. |
| 39 bool GetOwnerInfo(int guest_process_id, | 39 bool GetOwnerInfo(int guest_process_id, |
| 40 int* owner_process_id, | 40 int* owner_process_id, |
| 41 std::string* owner_extension_id) const; | 41 std::string* owner_extension_id) const; |
| 42 | 42 |
| 43 // Looks up the partition info for the embedder <webview> for a given guest | 43 // Looks up the partition info for the embedder <webview> for a given guest |
| 44 // process. Called on the IO thread. | 44 // process. Called on the IO thread. |
| 45 bool GetPartitionID(int guest_process_id, std::string* partition_id); | 45 bool GetPartitionID(int guest_process_id, std::string* partition_id); |
| 46 | 46 |
| 47 // Returns true if the given renderer is used by webviews. | 47 // Returns true if the given renderer is used by webviews. |
| 48 bool IsGuest(int render_process_id); | 48 bool IsGuest(int render_process_id); |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 friend class WebViewGuest; | 51 friend class WebViewGuest; |
| 52 friend struct DefaultSingletonTraits<WebViewRendererState>; | 52 friend struct DefaultSingletonTraits<WebViewRendererState>; |
| 53 | 53 |
| 54 typedef std::pair<int, int> RenderId; | 54 using RenderId = std::pair<int, int>; |
| 55 typedef std::map<RenderId, WebViewInfo> WebViewInfoMap; | 55 using WebViewInfoMap = std::map<RenderId, WebViewInfo>; |
| 56 | 56 |
| 57 struct WebViewPartitionInfo { | 57 struct WebViewPartitionInfo { |
| 58 int web_view_count; | 58 int web_view_count; |
| 59 std::string partition_id; | 59 std::string partition_id; |
| 60 WebViewPartitionInfo() {} | 60 WebViewPartitionInfo() {} |
| 61 WebViewPartitionInfo(int count, std::string partition): | 61 WebViewPartitionInfo(int count, std::string partition): |
| 62 web_view_count(count), | 62 web_view_count(count), |
| 63 partition_id(partition) {} | 63 partition_id(partition) {} |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 typedef std::map<int, WebViewPartitionInfo> WebViewPartitionIDMap; | 66 using WebViewPartitionIDMap = std::map<int, WebViewPartitionInfo>; |
| 67 | 67 |
| 68 WebViewRendererState(); | 68 WebViewRendererState(); |
| 69 ~WebViewRendererState(); | 69 ~WebViewRendererState(); |
| 70 | 70 |
| 71 // Adds or removes a <webview> guest render process from the set. | 71 // Adds or removes a <webview> guest render process from the set. |
| 72 void AddGuest(int render_process_host_id, int routing_id, | 72 void AddGuest(int render_process_host_id, int routing_id, |
| 73 const WebViewInfo& webview_info); | 73 const WebViewInfo& web_view_info); |
| 74 void RemoveGuest(int render_process_host_id, int routing_id); | 74 void RemoveGuest(int render_process_host_id, int routing_id); |
| 75 | 75 |
| 76 WebViewInfoMap webview_info_map_; | 76 WebViewInfoMap web_view_info_map_; |
| 77 WebViewPartitionIDMap webview_partition_id_map_; | 77 WebViewPartitionIDMap web_view_partition_id_map_; |
| 78 | 78 |
| 79 DISALLOW_COPY_AND_ASSIGN(WebViewRendererState); | 79 DISALLOW_COPY_AND_ASSIGN(WebViewRendererState); |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 } // namespace extensions | 82 } // namespace extensions |
| 83 | 83 |
| 84 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_RENDERER_STATE_H_ | 84 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_RENDERER_STATE_H_ |
| OLD | NEW |