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 6541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6552 | 6552 |
6553 void RenderFrameImpl::SendUpdateState() { | 6553 void RenderFrameImpl::SendUpdateState() { |
6554 if (current_history_item_.IsNull()) | 6554 if (current_history_item_.IsNull()) |
6555 return; | 6555 return; |
6556 | 6556 |
6557 Send(new FrameHostMsg_UpdateState( | 6557 Send(new FrameHostMsg_UpdateState( |
6558 routing_id_, SingleHistoryItemToPageState(current_history_item_))); | 6558 routing_id_, SingleHistoryItemToPageState(current_history_item_))); |
6559 } | 6559 } |
6560 | 6560 |
6561 void RenderFrameImpl::MaybeEnableMojoBindings() { | 6561 void RenderFrameImpl::MaybeEnableMojoBindings() { |
6562 // BINDINGS_POLICY_WEB_UI, BINDINGS_POLICY_MOJO and BINDINGS_POLICY_HEADLESS | 6562 // BINDINGS_POLICY_WEB_UI, BINDINGS_POLICY_MOJO, |
6563 // are mutually exclusive. They provide access to Mojo bindings, but do so in | 6563 // BINDINGS_POLICY_HEADLESS_MAIN_WORLD and |
6564 // incompatible ways. | 6564 // BINDINGS_POLICY_HEADLESS_ISOLATED_WORLD are mutually exclusive. They |
6565 const int kAllBindingsTypes = | 6565 // provide access to Mojo bindings, but do so in incompatible ways. |
6566 BINDINGS_POLICY_WEB_UI | BINDINGS_POLICY_MOJO | BINDINGS_POLICY_HEADLESS; | 6566 const int kAllBindingsTypes = BINDINGS_POLICY_WEB_UI | BINDINGS_POLICY_MOJO | |
| 6567 BINDINGS_POLICY_HEADLESS_MAIN_WORLD | |
| 6568 BINDINGS_POLICY_HEADLESS_ISOLATED_WORLD; |
6567 | 6569 |
6568 // Make sure that at most one of BINDINGS_POLICY_WEB_UI, BINDINGS_POLICY_MOJO | 6570 // Make sure that at most one of BINDINGS_POLICY_WEB_UI, BINDINGS_POLICY_MOJO |
6569 // and BINDINGS_POLICY_HEADLESS have been set. | 6571 // BINDINGS_POLICY_HEADLESS_MAIN_WORLD and |
| 6572 // BINDINGS_POLICY_HEADLESS_ISOLATED_WORLD have been set. |
6570 // NOTE x & (x - 1) == 0 is true iff x is zero or a power of two. | 6573 // NOTE x & (x - 1) == 0 is true iff x is zero or a power of two. |
6571 DCHECK_EQ((enabled_bindings_ & kAllBindingsTypes) & | 6574 DCHECK_EQ((enabled_bindings_ & kAllBindingsTypes) & |
6572 ((enabled_bindings_ & kAllBindingsTypes) - 1), | 6575 ((enabled_bindings_ & kAllBindingsTypes) - 1), |
6573 0); | 6576 0); |
6574 | 6577 |
6575 DCHECK_EQ(RenderProcess::current()->GetEnabledBindings(), enabled_bindings_); | 6578 DCHECK_EQ(RenderProcess::current()->GetEnabledBindings(), enabled_bindings_); |
6576 | 6579 |
6577 // If an MojoBindingsController already exists for this RenderFrameImpl, avoid | 6580 // If an MojoBindingsController already exists for this RenderFrameImpl, avoid |
6578 // creating another one. It is not kept as a member, as it deletes itself when | 6581 // creating another one. It is not kept as a member, as it deletes itself when |
6579 // the frame is destroyed. | 6582 // the frame is destroyed. |
6580 if (RenderFrameObserverTracker<MojoBindingsController>::Get(this)) | 6583 if (RenderFrameObserverTracker<MojoBindingsController>::Get(this)) |
6581 return; | 6584 return; |
6582 | 6585 |
6583 if (IsMainFrame() && enabled_bindings_ & BINDINGS_POLICY_WEB_UI) { | 6586 if (IsMainFrame() && enabled_bindings_ & BINDINGS_POLICY_WEB_UI) { |
6584 new MojoBindingsController(this, MojoBindingsType::FOR_WEB_UI); | 6587 new MojoBindingsController(this, MojoBindingsType::FOR_WEB_UI); |
6585 } else if (enabled_bindings_ & BINDINGS_POLICY_MOJO) { | 6588 } else if (enabled_bindings_ & BINDINGS_POLICY_MOJO) { |
6586 new MojoBindingsController(this, MojoBindingsType::FOR_LAYOUT_TESTS); | 6589 new MojoBindingsController(this, MojoBindingsType::FOR_LAYOUT_TESTS); |
6587 } else if (enabled_bindings_ & BINDINGS_POLICY_HEADLESS) { | |
6588 new MojoBindingsController(this, MojoBindingsType::FOR_HEADLESS); | |
6589 } | 6590 } |
6590 } | 6591 } |
6591 | 6592 |
6592 void RenderFrameImpl::SendFailedProvisionalLoad( | 6593 void RenderFrameImpl::SendFailedProvisionalLoad( |
6593 const blink::WebURLRequest& request, | 6594 const blink::WebURLRequest& request, |
6594 const blink::WebURLError& error, | 6595 const blink::WebURLError& error, |
6595 blink::WebLocalFrame* frame) { | 6596 blink::WebLocalFrame* frame) { |
6596 bool show_repost_interstitial = | 6597 bool show_repost_interstitial = |
6597 (error.reason == net::ERR_CACHE_MISS && | 6598 (error.reason == net::ERR_CACHE_MISS && |
6598 base::EqualsASCII(request.HttpMethod().Utf16(), "POST")); | 6599 base::EqualsASCII(request.HttpMethod().Utf16(), "POST")); |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7063 policy(info.default_policy), | 7064 policy(info.default_policy), |
7064 replaces_current_history_item(info.replaces_current_history_item), | 7065 replaces_current_history_item(info.replaces_current_history_item), |
7065 history_navigation_in_new_child_frame( | 7066 history_navigation_in_new_child_frame( |
7066 info.is_history_navigation_in_new_child_frame), | 7067 info.is_history_navigation_in_new_child_frame), |
7067 client_redirect(info.is_client_redirect), | 7068 client_redirect(info.is_client_redirect), |
7068 cache_disabled(info.is_cache_disabled), | 7069 cache_disabled(info.is_cache_disabled), |
7069 form(info.form), | 7070 form(info.form), |
7070 source_location(info.source_location) {} | 7071 source_location(info.source_location) {} |
7071 | 7072 |
7072 } // namespace content | 7073 } // namespace content |
OLD | NEW |