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 <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
14 | 14 |
15 namespace extensions { | 15 namespace extensions { |
16 | 16 |
17 class WebViewGuest; | 17 class WebViewGuest; |
18 | 18 |
19 // This class keeps track of <webview> renderer state for use on the IO thread. | 19 // This class keeps track of <webview> renderer state for use on the IO thread. |
20 // All methods should be called on the IO thread. | 20 // All methods should be called on the IO thread. |
21 class WebViewRendererState { | 21 class WebViewRendererState { |
22 public: | 22 public: |
23 struct WebViewInfo { | 23 struct WebViewInfo { |
24 int embedder_process_id; | 24 int embedder_process_id; |
25 int instance_id; | 25 int instance_id; |
26 int rules_registry_id; | 26 int rules_registry_id; |
27 std::string partition_id; | 27 std::string partition_id; |
28 std::string owner_extension_id; | 28 std::string owner_host; |
29 std::set<int> content_script_ids; | 29 std::set<int> content_script_ids; |
30 | 30 |
31 WebViewInfo(); | 31 WebViewInfo(); |
32 ~WebViewInfo(); | 32 ~WebViewInfo(); |
33 }; | 33 }; |
34 | 34 |
35 static WebViewRendererState* GetInstance(); | 35 static WebViewRendererState* GetInstance(); |
36 | 36 |
37 // Looks up the information for the embedder <webview> for a given render | 37 // Looks up the information for the embedder <webview> for a given render |
38 // view, if one exists. Called on the IO thread. | 38 // view, if one exists. Called on the IO thread. |
39 bool GetInfo(int guest_process_id, int guest_routing_id, | 39 bool GetInfo(int guest_process_id, int guest_routing_id, |
40 WebViewInfo* web_view_info); | 40 WebViewInfo* web_view_info); |
41 | 41 |
42 // Looks up the information for the owner for a given guest process in a | 42 // Looks up the information for the owner for a given guest process in a |
43 // <webview>. Called on the IO thread. | 43 // <webview>. Called on the IO thread. |
44 bool GetOwnerInfo(int guest_process_id, | 44 bool GetOwnerInfo(int guest_process_id, |
45 int* owner_process_id, | 45 int* owner_process_id, |
46 std::string* owner_extension_id) const; | 46 std::string* owner_host) const; |
47 | 47 |
48 // Looks up the partition info for the embedder <webview> for a given guest | 48 // Looks up the partition info for the embedder <webview> for a given guest |
49 // process. Called on the IO thread. | 49 // process. Called on the IO thread. |
50 bool GetPartitionID(int guest_process_id, std::string* partition_id); | 50 bool GetPartitionID(int guest_process_id, std::string* partition_id); |
51 | 51 |
52 // Returns true if the given renderer is used by webviews. | 52 // Returns true if the given renderer is used by webviews. |
53 bool IsGuest(int render_process_id); | 53 bool IsGuest(int render_process_id); |
54 | 54 |
55 void AddContentScriptIDs(int embedder_process_id, | 55 void AddContentScriptIDs(int embedder_process_id, |
56 int view_instance_id, | 56 int view_instance_id, |
(...skipping 30 matching lines...) Expand all Loading... |
87 | 87 |
88 WebViewInfoMap web_view_info_map_; | 88 WebViewInfoMap web_view_info_map_; |
89 WebViewPartitionIDMap web_view_partition_id_map_; | 89 WebViewPartitionIDMap web_view_partition_id_map_; |
90 | 90 |
91 DISALLOW_COPY_AND_ASSIGN(WebViewRendererState); | 91 DISALLOW_COPY_AND_ASSIGN(WebViewRendererState); |
92 }; | 92 }; |
93 | 93 |
94 } // namespace extensions | 94 } // namespace extensions |
95 | 95 |
96 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_RENDERER_STATE_H_ | 96 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_RENDERER_STATE_H_ |
OLD | NEW |