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 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 | 1083 |
1084 bool is_tracing = false; | 1084 bool is_tracing = false; |
1085 TRACE_EVENT_CATEGORY_GROUP_ENABLED("navigation", &is_tracing); | 1085 TRACE_EVENT_CATEGORY_GROUP_ENABLED("navigation", &is_tracing); |
1086 if (is_tracing) { | 1086 if (is_tracing) { |
1087 int parent_id = GetRoutingIdForFrameOrProxy(frame_->parent()); | 1087 int parent_id = GetRoutingIdForFrameOrProxy(frame_->parent()); |
1088 TRACE_EVENT2("navigation", "RenderFrameImpl::Initialize", | 1088 TRACE_EVENT2("navigation", "RenderFrameImpl::Initialize", |
1089 "id", routing_id_, | 1089 "id", routing_id_, |
1090 "parent", parent_id); | 1090 "parent", parent_id); |
1091 } | 1091 } |
1092 | 1092 |
1093 if (IsMainFrame() && | 1093 MaybeEnableMojoBindings(); |
1094 RenderProcess::current()->GetEnabledBindings() & BINDINGS_POLICY_WEB_UI) { | |
1095 EnableMojoBindings(false /* for_layout_tests */); | |
1096 } | |
1097 | 1094 |
1098 #if defined(ENABLE_PLUGINS) | 1095 #if defined(ENABLE_PLUGINS) |
1099 new PepperBrowserConnection(this); | 1096 new PepperBrowserConnection(this); |
1100 #endif | 1097 #endif |
1101 new SharedWorkerRepository(this); | 1098 new SharedWorkerRepository(this); |
1102 | 1099 |
1103 if (IsLocalRoot() && !is_swapped_out_) { | 1100 if (IsLocalRoot() && !is_swapped_out_) { |
1104 // DevToolsAgent is a RenderFrameObserver, and will destruct itself | 1101 // DevToolsAgent is a RenderFrameObserver, and will destruct itself |
1105 // when |this| is deleted. | 1102 // when |this| is deleted. |
1106 devtools_agent_ = new DevToolsAgent(this); | 1103 devtools_agent_ = new DevToolsAgent(this); |
(...skipping 4652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5759 | 5756 |
5760 void RenderFrameImpl::SendUpdateState() { | 5757 void RenderFrameImpl::SendUpdateState() { |
5761 DCHECK(SiteIsolationPolicy::UseSubframeNavigationEntries()); | 5758 DCHECK(SiteIsolationPolicy::UseSubframeNavigationEntries()); |
5762 if (current_history_item_.isNull()) | 5759 if (current_history_item_.isNull()) |
5763 return; | 5760 return; |
5764 | 5761 |
5765 Send(new FrameHostMsg_UpdateState( | 5762 Send(new FrameHostMsg_UpdateState( |
5766 routing_id_, SingleHistoryItemToPageState(current_history_item_))); | 5763 routing_id_, SingleHistoryItemToPageState(current_history_item_))); |
5767 } | 5764 } |
5768 | 5765 |
5769 void RenderFrameImpl::EnableMojoBindings(bool for_layout_tests) { | 5766 void RenderFrameImpl::MaybeEnableMojoBindings() { |
| 5767 int enabled_bindings = RenderProcess::current()->GetEnabledBindings(); |
| 5768 // BINDINGS_POLICY_WEB_UI and BINDINGS_POLICY_MOJO are mutually exclusive. |
| 5769 // They both provide access to Mojo bindings, but do so in incompatible ways. |
| 5770 const int kMojoAndWebUiBindings = |
| 5771 BINDINGS_POLICY_WEB_UI | BINDINGS_POLICY_MOJO; |
| 5772 DCHECK_NE(enabled_bindings & kMojoAndWebUiBindings, kMojoAndWebUiBindings); |
| 5773 |
5770 // If an MojoBindingsController already exists for this RenderFrameImpl, avoid | 5774 // If an MojoBindingsController already exists for this RenderFrameImpl, avoid |
5771 // creating another one. It is not kept as a member, as it deletes itself when | 5775 // creating another one. It is not kept as a member, as it deletes itself when |
5772 // the frame is destroyed. | 5776 // the frame is destroyed. |
5773 if (!RenderFrameObserverTracker<MojoBindingsController>::Get(this)) | 5777 if (RenderFrameObserverTracker<MojoBindingsController>::Get(this)) |
5774 new MojoBindingsController(this, for_layout_tests); | 5778 return; |
| 5779 |
| 5780 if (IsMainFrame() && |
| 5781 enabled_bindings & BINDINGS_POLICY_WEB_UI) { |
| 5782 new MojoBindingsController(this, false /* for_layout_tests */); |
| 5783 } else if (enabled_bindings & BINDINGS_POLICY_MOJO) { |
| 5784 new MojoBindingsController(this, true /* for_layout_tests */); |
| 5785 } |
5775 } | 5786 } |
5776 | 5787 |
5777 void RenderFrameImpl::SendFailedProvisionalLoad( | 5788 void RenderFrameImpl::SendFailedProvisionalLoad( |
5778 const blink::WebURLRequest& request, | 5789 const blink::WebURLRequest& request, |
5779 const blink::WebURLError& error, | 5790 const blink::WebURLError& error, |
5780 blink::WebLocalFrame* frame) { | 5791 blink::WebLocalFrame* frame) { |
5781 bool show_repost_interstitial = | 5792 bool show_repost_interstitial = |
5782 (error.reason == net::ERR_CACHE_MISS && | 5793 (error.reason == net::ERR_CACHE_MISS && |
5783 base::EqualsASCII(base::StringPiece16(request.httpMethod()), "POST")); | 5794 base::EqualsASCII(base::StringPiece16(request.httpMethod()), "POST")); |
5784 | 5795 |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6072 int match_count, | 6083 int match_count, |
6073 int ordinal, | 6084 int ordinal, |
6074 const WebRect& selection_rect, | 6085 const WebRect& selection_rect, |
6075 bool final_status_update) { | 6086 bool final_status_update) { |
6076 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, | 6087 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, |
6077 selection_rect, ordinal, | 6088 selection_rect, ordinal, |
6078 final_status_update)); | 6089 final_status_update)); |
6079 } | 6090 } |
6080 | 6091 |
6081 } // namespace content | 6092 } // namespace content |
OLD | NEW |