Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(955)

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 2049363003: Adds support for headless chrome embedder mojo services (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/mojo_context_state.cc ('k') | headless/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5901 matching lines...) Expand 10 before | Expand all | Expand 10 after
5912 DCHECK(SiteIsolationPolicy::UseSubframeNavigationEntries()); 5912 DCHECK(SiteIsolationPolicy::UseSubframeNavigationEntries());
5913 if (current_history_item_.isNull()) 5913 if (current_history_item_.isNull())
5914 return; 5914 return;
5915 5915
5916 Send(new FrameHostMsg_UpdateState( 5916 Send(new FrameHostMsg_UpdateState(
5917 routing_id_, SingleHistoryItemToPageState(current_history_item_))); 5917 routing_id_, SingleHistoryItemToPageState(current_history_item_)));
5918 } 5918 }
5919 5919
5920 void RenderFrameImpl::MaybeEnableMojoBindings() { 5920 void RenderFrameImpl::MaybeEnableMojoBindings() {
5921 int enabled_bindings = RenderProcess::current()->GetEnabledBindings(); 5921 int enabled_bindings = RenderProcess::current()->GetEnabledBindings();
5922 // BINDINGS_POLICY_WEB_UI and BINDINGS_POLICY_MOJO are mutually exclusive. 5922 // BINDINGS_POLICY_WEB_UI, BINDINGS_POLICY_MOJO and BINDINGS_POLICY_HEADLESS
5923 // They both provide access to Mojo bindings, but do so in incompatible ways. 5923 // are mutually exclusive. They provide access to Mojo bindings, but do so in
5924 const int kMojoAndWebUiBindings = 5924 // incompatible ways.
5925 BINDINGS_POLICY_WEB_UI | BINDINGS_POLICY_MOJO; 5925 const int kAllBindingsTypes =
5926 DCHECK_NE(enabled_bindings & kMojoAndWebUiBindings, kMojoAndWebUiBindings); 5926 BINDINGS_POLICY_WEB_UI | BINDINGS_POLICY_MOJO | BINDINGS_POLICY_HEADLESS;
5927
5928 // Make sure that at most one of BINDINGS_POLICY_WEB_UI, BINDINGS_POLICY_MOJO
5929 // and BINDINGS_POLICY_HEADLESS have been set.
5930 // NOTE x & (x - 1) == 0 is true iff x is zero or a power of two.
5931 DCHECK_EQ((enabled_bindings & kAllBindingsTypes) &
5932 ((enabled_bindings & kAllBindingsTypes) - 1),
5933 0);
5927 5934
5928 // If an MojoBindingsController already exists for this RenderFrameImpl, avoid 5935 // If an MojoBindingsController already exists for this RenderFrameImpl, avoid
5929 // creating another one. It is not kept as a member, as it deletes itself when 5936 // creating another one. It is not kept as a member, as it deletes itself when
5930 // the frame is destroyed. 5937 // the frame is destroyed.
5931 if (RenderFrameObserverTracker<MojoBindingsController>::Get(this)) 5938 if (RenderFrameObserverTracker<MojoBindingsController>::Get(this))
5932 return; 5939 return;
5933 5940
5934 if (IsMainFrame() && 5941 if (IsMainFrame() &&
5935 enabled_bindings & BINDINGS_POLICY_WEB_UI) { 5942 enabled_bindings & BINDINGS_POLICY_WEB_UI) {
5936 new MojoBindingsController(this, false /* for_layout_tests */); 5943 new MojoBindingsController(this, MojoBindingsType::FOR_WEB_UI);
5937 } else if (enabled_bindings & BINDINGS_POLICY_MOJO) { 5944 } else if (enabled_bindings & BINDINGS_POLICY_MOJO) {
5938 new MojoBindingsController(this, true /* for_layout_tests */); 5945 new MojoBindingsController(this, MojoBindingsType::FOR_LAYOUT_TESTS);
5946 } else if (enabled_bindings & BINDINGS_POLICY_HEADLESS) {
5947 new MojoBindingsController(this, MojoBindingsType::FOR_HEADLESS);
5939 } 5948 }
5940 } 5949 }
5941 5950
5942 void RenderFrameImpl::SendFailedProvisionalLoad( 5951 void RenderFrameImpl::SendFailedProvisionalLoad(
5943 const blink::WebURLRequest& request, 5952 const blink::WebURLRequest& request,
5944 const blink::WebURLError& error, 5953 const blink::WebURLError& error,
5945 blink::WebLocalFrame* frame) { 5954 blink::WebLocalFrame* frame) {
5946 bool show_repost_interstitial = 5955 bool show_repost_interstitial =
5947 (error.reason == net::ERR_CACHE_MISS && 5956 (error.reason == net::ERR_CACHE_MISS &&
5948 base::EqualsASCII(base::StringPiece16(request.httpMethod()), "POST")); 5957 base::EqualsASCII(base::StringPiece16(request.httpMethod()), "POST"));
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
6345 // event target. Potentially a Pepper plugin will receive the event. 6354 // event target. Potentially a Pepper plugin will receive the event.
6346 // In order to tell whether a plugin gets the last mouse event and which it 6355 // In order to tell whether a plugin gets the last mouse event and which it
6347 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6356 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6348 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6357 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6349 // |pepper_last_mouse_event_target_|. 6358 // |pepper_last_mouse_event_target_|.
6350 pepper_last_mouse_event_target_ = nullptr; 6359 pepper_last_mouse_event_target_ = nullptr;
6351 #endif 6360 #endif
6352 } 6361 }
6353 6362
6354 } // namespace content 6363 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/mojo_context_state.cc ('k') | headless/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698