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/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/debug/alias.h" | 11 #include "base/debug/alias.h" |
12 #include "base/debug/dump_without_crashing.h" | 12 #include "base/debug/dump_without_crashing.h" |
13 #include "base/i18n/char_iterator.h" | 13 #include "base/i18n/char_iterator.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "content/child/appcache/appcache_dispatcher.h" | 16 #include "content/child/appcache/appcache_dispatcher.h" |
17 #include "content/child/plugin_messages.h" | 17 #include "content/child/plugin_messages.h" |
18 #include "content/child/quota_dispatcher.h" | 18 #include "content/child/quota_dispatcher.h" |
19 #include "content/child/request_extra_data.h" | 19 #include "content/child/request_extra_data.h" |
20 #include "content/child/service_worker/web_service_worker_provider_impl.h" | 20 #include "content/child/service_worker/web_service_worker_provider_impl.h" |
21 #include "content/common/frame_messages.h" | 21 #include "content/common/frame_messages.h" |
22 #include "content/common/socket_stream_handle_data.h" | 22 #include "content/common/socket_stream_handle_data.h" |
23 #include "content/common/swapped_out_messages.h" | 23 #include "content/common/swapped_out_messages.h" |
24 #include "content/common/view_messages.h" | 24 #include "content/common/view_messages.h" |
25 #include "content/public/common/bindings_policy.h" | |
25 #include "content/public/common/content_constants.h" | 26 #include "content/public/common/content_constants.h" |
26 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
27 #include "content/public/common/context_menu_params.h" | 28 #include "content/public/common/context_menu_params.h" |
28 #include "content/public/common/url_constants.h" | 29 #include "content/public/common/url_constants.h" |
29 #include "content/public/common/url_utils.h" | 30 #include "content/public/common/url_utils.h" |
30 #include "content/public/renderer/content_renderer_client.h" | 31 #include "content/public/renderer/content_renderer_client.h" |
31 #include "content/public/renderer/context_menu_client.h" | 32 #include "content/public/renderer/context_menu_client.h" |
32 #include "content/public/renderer/document_state.h" | 33 #include "content/public/renderer/document_state.h" |
33 #include "content/public/renderer/navigation_state.h" | 34 #include "content/public/renderer/navigation_state.h" |
34 #include "content/public/renderer/render_frame_observer.h" | 35 #include "content/public/renderer/render_frame_observer.h" |
35 #include "content/renderer/accessibility/renderer_accessibility.h" | 36 #include "content/renderer/accessibility/renderer_accessibility.h" |
36 #include "content/renderer/browser_plugin/browser_plugin.h" | 37 #include "content/renderer/browser_plugin/browser_plugin.h" |
37 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 38 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
38 #include "content/renderer/child_frame_compositing_helper.h" | 39 #include "content/renderer/child_frame_compositing_helper.h" |
39 #include "content/renderer/context_menu_params_builder.h" | 40 #include "content/renderer/context_menu_params_builder.h" |
41 #include "content/renderer/dom_automation_controller.h" | |
40 #include "content/renderer/internal_document_state_data.h" | 42 #include "content/renderer/internal_document_state_data.h" |
41 #include "content/renderer/npapi/plugin_channel_host.h" | 43 #include "content/renderer/npapi/plugin_channel_host.h" |
42 #include "content/renderer/render_thread_impl.h" | 44 #include "content/renderer/render_thread_impl.h" |
43 #include "content/renderer/render_view_impl.h" | 45 #include "content/renderer/render_view_impl.h" |
44 #include "content/renderer/render_widget_fullscreen_pepper.h" | 46 #include "content/renderer/render_widget_fullscreen_pepper.h" |
45 #include "content/renderer/renderer_webapplicationcachehost_impl.h" | 47 #include "content/renderer/renderer_webapplicationcachehost_impl.h" |
46 #include "content/renderer/shared_worker_repository.h" | 48 #include "content/renderer/shared_worker_repository.h" |
47 #include "content/renderer/websharedworker_proxy.h" | 49 #include "content/renderer/websharedworker_proxy.h" |
48 #include "net/base/net_errors.h" | 50 #include "net/base/net_errors.h" |
49 #include "net/http/http_util.h" | 51 #include "net/http/http_util.h" |
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1072 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, | 1074 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, |
1073 DidCommitProvisionalLoad(is_new_navigation)); | 1075 DidCommitProvisionalLoad(is_new_navigation)); |
1074 } | 1076 } |
1075 | 1077 |
1076 void RenderFrameImpl::didClearWindowObject(blink::WebFrame* frame, | 1078 void RenderFrameImpl::didClearWindowObject(blink::WebFrame* frame, |
1077 int world_id) { | 1079 int world_id) { |
1078 // TODO(nasko): Move implementation here. Needed state: | 1080 // TODO(nasko): Move implementation here. Needed state: |
1079 // * enabled_bindings_ | 1081 // * enabled_bindings_ |
1080 // * dom_automation_controller_ | 1082 // * dom_automation_controller_ |
1081 // * stats_collection_controller_ | 1083 // * stats_collection_controller_ |
1084 | |
1085 if (!world_id) { | |
nasko
2014/02/11 17:32:33
nit: Why not keep the pattern from the RV version
| |
1086 // Only install controllers into the main world. | |
1087 if (render_view_->GetEnabledBindings() & BINDINGS_POLICY_DOM_AUTOMATION) { | |
1088 DomAutomationController::Install(this, frame); | |
1089 } | |
1090 } | |
1091 | |
1082 render_view_->didClearWindowObject(frame, world_id); | 1092 render_view_->didClearWindowObject(frame, world_id); |
1083 } | 1093 } |
1084 | 1094 |
1085 void RenderFrameImpl::didCreateDocumentElement(blink::WebFrame* frame) { | 1095 void RenderFrameImpl::didCreateDocumentElement(blink::WebFrame* frame) { |
1086 // Notify the browser about non-blank documents loading in the top frame. | 1096 // Notify the browser about non-blank documents loading in the top frame. |
1087 GURL url = frame->document().url(); | 1097 GURL url = frame->document().url(); |
1088 if (url.is_valid() && url.spec() != kAboutBlankURL) { | 1098 if (url.is_valid() && url.spec() != kAboutBlankURL) { |
1089 // TODO(nasko): Check if webview()->mainFrame() is the same as the | 1099 // TODO(nasko): Check if webview()->mainFrame() is the same as the |
1090 // frame->tree()->top(). | 1100 // frame->tree()->top(). |
1091 if (frame == render_view_->webview()->mainFrame()) { | 1101 if (frame == render_view_->webview()->mainFrame()) { |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1654 void RenderFrameImpl::RemoveObserver(RenderFrameObserver* observer) { | 1664 void RenderFrameImpl::RemoveObserver(RenderFrameObserver* observer) { |
1655 observer->RenderFrameGone(); | 1665 observer->RenderFrameGone(); |
1656 observers_.RemoveObserver(observer); | 1666 observers_.RemoveObserver(observer); |
1657 } | 1667 } |
1658 | 1668 |
1659 void RenderFrameImpl::OnStop() { | 1669 void RenderFrameImpl::OnStop() { |
1660 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, OnStop()); | 1670 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, OnStop()); |
1661 } | 1671 } |
1662 | 1672 |
1663 } // namespace content | 1673 } // namespace content |
OLD | NEW |