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 #include "content/public/browser/browser_thread.h" | 5 #include "content/public/browser/browser_thread.h" |
6 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" | 6 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" |
7 | 7 |
8 using content::BrowserThread; | 8 using content::BrowserThread; |
9 | 9 |
10 namespace extensions { | 10 namespace extensions { |
11 | 11 |
12 WebViewRendererState::WebViewInfo::WebViewInfo() { | |
13 } | |
14 | |
15 WebViewRendererState::WebViewInfo::~WebViewInfo() { | |
16 } | |
17 | |
12 // static | 18 // static |
13 WebViewRendererState* WebViewRendererState::GetInstance() { | 19 WebViewRendererState* WebViewRendererState::GetInstance() { |
14 return Singleton<WebViewRendererState>::get(); | 20 return Singleton<WebViewRendererState>::get(); |
15 } | 21 } |
16 | 22 |
17 WebViewRendererState::WebViewRendererState() { | 23 WebViewRendererState::WebViewRendererState() { |
18 } | 24 } |
19 | 25 |
20 WebViewRendererState::~WebViewRendererState() { | 26 WebViewRendererState::~WebViewRendererState() { |
21 } | 27 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 102 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
97 | 103 |
98 auto iter = web_view_partition_id_map_.find(guest_process_id); | 104 auto iter = web_view_partition_id_map_.find(guest_process_id); |
99 if (iter != web_view_partition_id_map_.end()){ | 105 if (iter != web_view_partition_id_map_.end()){ |
100 *partition_id = iter->second.partition_id; | 106 *partition_id = iter->second.partition_id; |
101 return true; | 107 return true; |
102 } | 108 } |
103 return false; | 109 return false; |
104 } | 110 } |
105 | 111 |
112 void WebViewRendererState::AddContentScriptIDs( | |
113 int embedder_process_id, | |
114 int view_instance_id, | |
115 const std::set<int>& script_ids) { | |
116 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
117 | |
118 for (auto& render_id_info : web_view_info_map_) { | |
119 WebViewInfo& info = render_id_info.second; | |
120 if (info.embedder_process_id == embedder_process_id && | |
121 info.instance_id == view_instance_id) { | |
122 for (int id : script_ids) { | |
Fady Samuel
2015/04/02 21:46:09
nit: braces not necessary.
| |
123 info.content_script_ids.insert(id); | |
124 } | |
125 return; | |
126 } | |
127 } | |
128 } | |
129 | |
130 void WebViewRendererState::RemoveContentScriptIDs( | |
131 int embedder_process_id, | |
132 int view_instance_id, | |
133 const std::set<int>& script_ids) { | |
134 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
135 | |
136 for (auto& render_id_info : web_view_info_map_) { | |
137 WebViewInfo& info = render_id_info.second; | |
138 if (info.embedder_process_id == embedder_process_id && | |
139 info.instance_id == view_instance_id) { | |
Fady Samuel
2015/04/02 21:46:09
nit: braces not necessary.
| |
140 for (int id : script_ids) | |
141 info.content_script_ids.erase(id); | |
142 return; | |
143 } | |
144 } | |
145 } | |
146 | |
106 } // namespace extensions | 147 } // namespace extensions |
OLD | NEW |