OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 #include "content/public/common/page_state.h" | 45 #include "content/public/common/page_state.h" |
46 #include "content/public/common/resource_response.h" | 46 #include "content/public/common/resource_response.h" |
47 #include "content/public/common/url_constants.h" | 47 #include "content/public/common/url_constants.h" |
48 #include "content/public/common/url_utils.h" | 48 #include "content/public/common/url_utils.h" |
49 #include "content/public/renderer/browser_plugin_delegate.h" | 49 #include "content/public/renderer/browser_plugin_delegate.h" |
50 #include "content/public/renderer/content_renderer_client.h" | 50 #include "content/public/renderer/content_renderer_client.h" |
51 #include "content/public/renderer/context_menu_client.h" | 51 #include "content/public/renderer/context_menu_client.h" |
52 #include "content/public/renderer/document_state.h" | 52 #include "content/public/renderer/document_state.h" |
53 #include "content/public/renderer/navigation_state.h" | 53 #include "content/public/renderer/navigation_state.h" |
54 #include "content/public/renderer/render_frame_observer.h" | 54 #include "content/public/renderer/render_frame_observer.h" |
55 #include "content/public/renderer/renderer_ppapi_host.h" | |
55 #include "content/renderer/accessibility/renderer_accessibility_complete.h" | 56 #include "content/renderer/accessibility/renderer_accessibility_complete.h" |
56 #include "content/renderer/browser_plugin/browser_plugin.h" | 57 #include "content/renderer/browser_plugin/browser_plugin.h" |
57 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 58 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
58 #include "content/renderer/child_frame_compositing_helper.h" | 59 #include "content/renderer/child_frame_compositing_helper.h" |
59 #include "content/renderer/context_menu_params_builder.h" | 60 #include "content/renderer/context_menu_params_builder.h" |
60 #include "content/renderer/devtools/devtools_agent.h" | 61 #include "content/renderer/devtools/devtools_agent.h" |
61 #include "content/renderer/dom_automation_controller.h" | 62 #include "content/renderer/dom_automation_controller.h" |
62 #include "content/renderer/dom_utils.h" | 63 #include "content/renderer/dom_utils.h" |
63 #include "content/renderer/external_popup_menu.h" | 64 #include "content/renderer/external_popup_menu.h" |
64 #include "content/renderer/geolocation_dispatcher.h" | 65 #include "content/renderer/geolocation_dispatcher.h" |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
632 } | 633 } |
633 | 634 |
634 RenderWidget* RenderFrameImpl::GetRenderWidget() { | 635 RenderWidget* RenderFrameImpl::GetRenderWidget() { |
635 return render_view_.get(); | 636 return render_view_.get(); |
636 } | 637 } |
637 | 638 |
638 #if defined(ENABLE_PLUGINS) | 639 #if defined(ENABLE_PLUGINS) |
639 void RenderFrameImpl::PepperPluginCreated(RendererPpapiHost* host) { | 640 void RenderFrameImpl::PepperPluginCreated(RendererPpapiHost* host) { |
640 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, | 641 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, |
641 DidCreatePepperPlugin(host)); | 642 DidCreatePepperPlugin(host)); |
643 if (host->GetPluginName() == kFlashPluginName) | |
644 RecordAction(base::UserMetricsAction("PageLoadWithFlash")); | |
Charlie Reis
2014/10/30 18:46:26
Can this be called more than once per page load?
Lei Zhang
2014/10/30 22:14:40
The plugin is only created once here, and each Fla
Charlie Reis
2014/10/30 22:25:39
Cool. Seems like it could happen in multiple Rend
dmichael (off chromium)
2014/10/30 22:54:10
Right, it looks like it's 1 per-RenderFrame-per-pl
| |
642 } | 645 } |
643 | 646 |
644 void RenderFrameImpl::PepperDidChangeCursor( | 647 void RenderFrameImpl::PepperDidChangeCursor( |
645 PepperPluginInstanceImpl* instance, | 648 PepperPluginInstanceImpl* instance, |
646 const blink::WebCursorInfo& cursor) { | 649 const blink::WebCursorInfo& cursor) { |
647 // Update the cursor appearance immediately if the requesting plugin is the | 650 // Update the cursor appearance immediately if the requesting plugin is the |
648 // one which receives the last mouse event. Otherwise, the new cursor won't be | 651 // one which receives the last mouse event. Otherwise, the new cursor won't be |
649 // picked up until the plugin gets the next input event. That is bad if, e.g., | 652 // picked up until the plugin gets the next input event. That is bad if, e.g., |
650 // the plugin would like to set an invisible cursor when there isn't any user | 653 // the plugin would like to set an invisible cursor when there isn't any user |
651 // input for a while. | 654 // input for a while. |
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1627 #if defined(ENABLE_PLUGINS) | 1630 #if defined(ENABLE_PLUGINS) |
1628 WebPluginInfo info; | 1631 WebPluginInfo info; |
1629 std::string mime_type; | 1632 std::string mime_type; |
1630 bool found = false; | 1633 bool found = false; |
1631 Send(new FrameHostMsg_GetPluginInfo( | 1634 Send(new FrameHostMsg_GetPluginInfo( |
1632 routing_id_, params.url, frame->top()->document().url(), | 1635 routing_id_, params.url, frame->top()->document().url(), |
1633 params.mimeType.utf8(), &found, &info, &mime_type)); | 1636 params.mimeType.utf8(), &found, &info, &mime_type)); |
1634 if (!found) | 1637 if (!found) |
1635 return NULL; | 1638 return NULL; |
1636 | 1639 |
1637 if (info.type == content::WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN) { | 1640 if (info.type == WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN) { |
1638 scoped_ptr<BrowserPluginDelegate> browser_plugin_delegate( | 1641 scoped_ptr<BrowserPluginDelegate> browser_plugin_delegate( |
1639 GetContentClient()->renderer()->CreateBrowserPluginDelegate( | 1642 GetContentClient()->renderer()->CreateBrowserPluginDelegate( |
1640 this, base::UTF16ToUTF8(params.mimeType))); | 1643 this, base::UTF16ToUTF8(params.mimeType))); |
1641 return render_view_->GetBrowserPluginManager()->CreateBrowserPlugin( | 1644 return render_view_->GetBrowserPluginManager()->CreateBrowserPlugin( |
1642 render_view_.get(), frame, browser_plugin_delegate.Pass()); | 1645 render_view_.get(), frame, browser_plugin_delegate.Pass()); |
1643 } | 1646 } |
1644 | 1647 |
1645 | 1648 |
1646 WebPluginParams params_to_use = params; | 1649 WebPluginParams params_to_use = params; |
1647 params_to_use.mimeType = WebString::fromUTF8(mime_type); | 1650 params_to_use.mimeType = WebString::fromUTF8(mime_type); |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2575 RenderWidget::FROM_NON_IME); | 2578 RenderWidget::FROM_NON_IME); |
2576 #endif | 2579 #endif |
2577 } | 2580 } |
2578 | 2581 |
2579 blink::WebColorChooser* RenderFrameImpl::createColorChooser( | 2582 blink::WebColorChooser* RenderFrameImpl::createColorChooser( |
2580 blink::WebColorChooserClient* client, | 2583 blink::WebColorChooserClient* client, |
2581 const blink::WebColor& initial_color, | 2584 const blink::WebColor& initial_color, |
2582 const blink::WebVector<blink::WebColorSuggestion>& suggestions) { | 2585 const blink::WebVector<blink::WebColorSuggestion>& suggestions) { |
2583 RendererWebColorChooserImpl* color_chooser = | 2586 RendererWebColorChooserImpl* color_chooser = |
2584 new RendererWebColorChooserImpl(this, client); | 2587 new RendererWebColorChooserImpl(this, client); |
2585 std::vector<content::ColorSuggestion> color_suggestions; | 2588 std::vector<ColorSuggestion> color_suggestions; |
2586 for (size_t i = 0; i < suggestions.size(); i++) { | 2589 for (size_t i = 0; i < suggestions.size(); i++) { |
2587 color_suggestions.push_back(content::ColorSuggestion(suggestions[i])); | 2590 color_suggestions.push_back(ColorSuggestion(suggestions[i])); |
2588 } | 2591 } |
2589 color_chooser->Open(static_cast<SkColor>(initial_color), color_suggestions); | 2592 color_chooser->Open(static_cast<SkColor>(initial_color), color_suggestions); |
2590 return color_chooser; | 2593 return color_chooser; |
2591 } | 2594 } |
2592 | 2595 |
2593 void RenderFrameImpl::runModalAlertDialog(const blink::WebString& message) { | 2596 void RenderFrameImpl::runModalAlertDialog(const blink::WebString& message) { |
2594 RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_ALERT, | 2597 RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_ALERT, |
2595 message, | 2598 message, |
2596 base::string16(), | 2599 base::string16(), |
2597 frame_->document().url(), | 2600 frame_->document().url(), |
(...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4115 | 4118 |
4116 #if defined(ENABLE_BROWSER_CDMS) | 4119 #if defined(ENABLE_BROWSER_CDMS) |
4117 RendererCdmManager* RenderFrameImpl::GetCdmManager() { | 4120 RendererCdmManager* RenderFrameImpl::GetCdmManager() { |
4118 if (!cdm_manager_) | 4121 if (!cdm_manager_) |
4119 cdm_manager_ = new RendererCdmManager(this); | 4122 cdm_manager_ = new RendererCdmManager(this); |
4120 return cdm_manager_; | 4123 return cdm_manager_; |
4121 } | 4124 } |
4122 #endif // defined(ENABLE_BROWSER_CDMS) | 4125 #endif // defined(ENABLE_BROWSER_CDMS) |
4123 | 4126 |
4124 } // namespace content | 4127 } // namespace content |
OLD | NEW |