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 "chrome/renderer/extensions/chrome_extensions_renderer_client.h" | 5 #include "chrome/renderer/extensions/chrome_extensions_renderer_client.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
12 #include "chrome/common/chrome_isolated_world_ids.h" | 12 #include "chrome/common/chrome_isolated_world_ids.h" |
13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
14 #include "chrome/common/extensions/extension_constants.h" | 14 #include "chrome/common/extensions/extension_constants.h" |
15 #include "chrome/common/extensions/extension_metrics.h" | 15 #include "chrome/common/extensions/extension_metrics.h" |
16 #include "chrome/common/extensions/extension_process_policy.h" | 16 #include "chrome/common/extensions/extension_process_policy.h" |
17 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
18 #include "chrome/renderer/chrome_render_thread_observer.h" | 18 #include "chrome/renderer/chrome_render_thread_observer.h" |
19 #include "chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h" | 19 #include "chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h" |
20 #include "chrome/renderer/extensions/renderer_permissions_policy_delegate.h" | 20 #include "chrome/renderer/extensions/renderer_permissions_policy_delegate.h" |
21 #include "chrome/renderer/extensions/resource_request_policy.h" | 21 #include "chrome/renderer/extensions/resource_request_policy.h" |
22 #include "chrome/renderer/media/cast_ipc_dispatcher.h" | 22 #include "chrome/renderer/media/cast_ipc_dispatcher.h" |
23 #include "content/public/common/content_constants.h" | 23 #include "content/public/common/content_constants.h" |
24 #include "content/public/common/content_switches.h" | 24 #include "content/public/common/content_switches.h" |
| 25 #include "content/public/renderer/render_frame.h" |
25 #include "content/public/renderer/render_thread.h" | 26 #include "content/public/renderer/render_thread.h" |
26 #include "extensions/common/constants.h" | 27 #include "extensions/common/constants.h" |
27 #include "extensions/common/extension.h" | 28 #include "extensions/common/extension.h" |
28 #include "extensions/common/extension_set.h" | 29 #include "extensions/common/extension_set.h" |
29 #include "extensions/common/switches.h" | 30 #include "extensions/common/switches.h" |
30 #include "extensions/renderer/dispatcher.h" | 31 #include "extensions/renderer/dispatcher.h" |
31 #include "extensions/renderer/extension_frame_helper.h" | 32 #include "extensions/renderer/extension_frame_helper.h" |
32 #include "extensions/renderer/extension_helper.h" | 33 #include "extensions/renderer/extension_helper.h" |
33 #include "extensions/renderer/extensions_render_frame_observer.h" | 34 #include "extensions/renderer/extensions_render_frame_observer.h" |
34 #include "extensions/renderer/guest_view/extensions_guest_view_container.h" | 35 #include "extensions/renderer/guest_view/extensions_guest_view_container.h" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 ChromeExtensionsRendererClient::CreateBrowserPluginDelegate( | 292 ChromeExtensionsRendererClient::CreateBrowserPluginDelegate( |
292 content::RenderFrame* render_frame, | 293 content::RenderFrame* render_frame, |
293 const std::string& mime_type, | 294 const std::string& mime_type, |
294 const GURL& original_url) { | 295 const GURL& original_url) { |
295 if (mime_type == content::kBrowserPluginMimeType) | 296 if (mime_type == content::kBrowserPluginMimeType) |
296 return new extensions::ExtensionsGuestViewContainer(render_frame); | 297 return new extensions::ExtensionsGuestViewContainer(render_frame); |
297 return new extensions::MimeHandlerViewContainer(render_frame, mime_type, | 298 return new extensions::MimeHandlerViewContainer(render_frame, mime_type, |
298 original_url); | 299 original_url); |
299 } | 300 } |
300 | 301 |
| 302 // static |
| 303 blink::WebFrame* ChromeExtensionsRendererClient::FindFrame( |
| 304 blink::WebLocalFrame* relative_to_frame, |
| 305 const std::string& name) { |
| 306 content::RenderFrame* result = extensions::ExtensionFrameHelper::FindFrame( |
| 307 content::RenderFrame::FromWebFrame(relative_to_frame), name); |
| 308 return result ? result->GetWebFrame() : nullptr; |
| 309 } |
| 310 |
301 void ChromeExtensionsRendererClient::RunScriptsAtDocumentStart( | 311 void ChromeExtensionsRendererClient::RunScriptsAtDocumentStart( |
302 content::RenderFrame* render_frame) { | 312 content::RenderFrame* render_frame) { |
303 extension_dispatcher_->RunScriptsAtDocumentStart(render_frame); | 313 extension_dispatcher_->RunScriptsAtDocumentStart(render_frame); |
304 } | 314 } |
305 | 315 |
306 void ChromeExtensionsRendererClient::RunScriptsAtDocumentEnd( | 316 void ChromeExtensionsRendererClient::RunScriptsAtDocumentEnd( |
307 content::RenderFrame* render_frame) { | 317 content::RenderFrame* render_frame) { |
308 extension_dispatcher_->RunScriptsAtDocumentEnd(render_frame); | 318 extension_dispatcher_->RunScriptsAtDocumentEnd(render_frame); |
309 } | 319 } |
310 | 320 |
311 void ChromeExtensionsRendererClient::RunScriptsAtDocumentIdle( | 321 void ChromeExtensionsRendererClient::RunScriptsAtDocumentIdle( |
312 content::RenderFrame* render_frame) { | 322 content::RenderFrame* render_frame) { |
313 extension_dispatcher_->RunScriptsAtDocumentIdle(render_frame); | 323 extension_dispatcher_->RunScriptsAtDocumentIdle(render_frame); |
314 } | 324 } |
OLD | NEW |