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