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