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 #include "content/browser/browser_plugin/browser_plugin_guest_manager.h" | 5 #include "content/browser/browser_plugin/browser_plugin_guest_manager.h" |
6 | 6 |
7 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 7 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
8 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" | 8 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" |
9 #include "content/browser/renderer_host/render_view_host_impl.h" | 9 #include "content/browser/renderer_host/render_view_host_impl.h" |
10 #include "content/browser/web_contents/web_contents_impl.h" | 10 #include "content/browser/web_contents/web_contents_impl.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 SiteInstance* embedder_site_instance, | 41 SiteInstance* embedder_site_instance, |
42 int instance_id, | 42 int instance_id, |
43 const BrowserPluginHostMsg_Attach_Params& params, | 43 const BrowserPluginHostMsg_Attach_Params& params, |
44 scoped_ptr<base::DictionaryValue> extra_params) { | 44 scoped_ptr<base::DictionaryValue> extra_params) { |
45 RenderProcessHost* embedder_process_host = | 45 RenderProcessHost* embedder_process_host = |
46 embedder_site_instance->GetProcess(); | 46 embedder_site_instance->GetProcess(); |
47 // Validate that the partition id coming from the renderer is valid UTF-8, | 47 // Validate that the partition id coming from the renderer is valid UTF-8, |
48 // since we depend on this in other parts of the code, such as FilePath | 48 // since we depend on this in other parts of the code, such as FilePath |
49 // creation. If the validation fails, treat it as a bad message and kill the | 49 // creation. If the validation fails, treat it as a bad message and kill the |
50 // renderer process. | 50 // renderer process. |
51 if (!IsStringUTF8(params.storage_partition_id)) { | 51 if (!base::IsStringUTF8(params.storage_partition_id)) { |
52 content::RecordAction( | 52 content::RecordAction( |
53 base::UserMetricsAction("BadMessageTerminate_BPGM")); | 53 base::UserMetricsAction("BadMessageTerminate_BPGM")); |
54 base::KillProcess( | 54 base::KillProcess( |
55 embedder_process_host->GetHandle(), | 55 embedder_process_host->GetHandle(), |
56 content::RESULT_CODE_KILLED_BAD_MESSAGE, false); | 56 content::RESULT_CODE_KILLED_BAD_MESSAGE, false); |
57 return NULL; | 57 return NULL; |
58 } | 58 } |
59 | 59 |
60 // We usually require BrowserPlugins to be hosted by a storage isolated | 60 // We usually require BrowserPlugins to be hosted by a storage isolated |
61 // extension. We treat WebUI pages as a special case if they host the | 61 // extension. We treat WebUI pages as a special case if they host the |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 if (embedder_web_contents != guest->embedder_web_contents()) | 234 if (embedder_web_contents != guest->embedder_web_contents()) |
235 continue; | 235 continue; |
236 | 236 |
237 if (callback.Run(guest)) | 237 if (callback.Run(guest)) |
238 return true; | 238 return true; |
239 } | 239 } |
240 return false; | 240 return false; |
241 } | 241 } |
242 | 242 |
243 } // namespace content | 243 } // namespace content |
OLD | NEW |