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