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

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: Comment plus a rename Created 4 years, 5 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 5882 matching lines...) Expand 10 before | Expand all | Expand 10 after
5893 DCHECK(SiteIsolationPolicy::UseSubframeNavigationEntries()); 5893 DCHECK(SiteIsolationPolicy::UseSubframeNavigationEntries());
5894 if (current_history_item_.isNull()) 5894 if (current_history_item_.isNull())
5895 return; 5895 return;
5896 5896
5897 Send(new FrameHostMsg_UpdateState( 5897 Send(new FrameHostMsg_UpdateState(
5898 routing_id_, SingleHistoryItemToPageState(current_history_item_))); 5898 routing_id_, SingleHistoryItemToPageState(current_history_item_)));
5899 } 5899 }
5900 5900
5901 void RenderFrameImpl::MaybeEnableMojoBindings() { 5901 void RenderFrameImpl::MaybeEnableMojoBindings() {
5902 int enabled_bindings = RenderProcess::current()->GetEnabledBindings(); 5902 int enabled_bindings = RenderProcess::current()->GetEnabledBindings();
5903 // BINDINGS_POLICY_WEB_UI and BINDINGS_POLICY_MOJO are mutually exclusive. 5903 // BINDINGS_POLICY_WEB_UI, BINDINGS_POLICY_MOJO and BINDINGS_POLICY_HEADLESS
5904 // They both provide access to Mojo bindings, but do so in incompatible ways. 5904 // are mutually exclusive. They provide access to Mojo bindings, but do so in
5905 const int kMojoAndWebUiBindings = 5905 // incompatible ways.
5906 BINDINGS_POLICY_WEB_UI | BINDINGS_POLICY_MOJO; 5906 const int kAllBindingsTypes =
5907 DCHECK_NE(enabled_bindings & kMojoAndWebUiBindings, kMojoAndWebUiBindings); 5907 BINDINGS_POLICY_WEB_UI | BINDINGS_POLICY_MOJO | BINDINGS_POLICY_HEADLESS;
5908
5909 // Make sure that at most one of BINDINGS_POLICY_WEB_UI, BINDINGS_POLICY_MOJO
5910 // and BINDINGS_POLICY_HEADLESS have been set.
5911 // NOTE x & (x - 1) == 0 is true iff x is zero or a power of two.
Charlie Reis 2016/06/27 21:53:33 Thanks for adding the comment-- it was too clever
5912 DCHECK_EQ((enabled_bindings & kAllBindingsTypes) &
5913 ((enabled_bindings & kAllBindingsTypes) - 1),
5914 0);
5908 5915
5909 // If an MojoBindingsController already exists for this RenderFrameImpl, avoid 5916 // If an MojoBindingsController already exists for this RenderFrameImpl, avoid
5910 // creating another one. It is not kept as a member, as it deletes itself when 5917 // creating another one. It is not kept as a member, as it deletes itself when
5911 // the frame is destroyed. 5918 // the frame is destroyed.
5912 if (RenderFrameObserverTracker<MojoBindingsController>::Get(this)) 5919 if (RenderFrameObserverTracker<MojoBindingsController>::Get(this))
5913 return; 5920 return;
5914 5921
5915 if (IsMainFrame() && 5922 if (IsMainFrame() &&
5916 enabled_bindings & BINDINGS_POLICY_WEB_UI) { 5923 enabled_bindings & BINDINGS_POLICY_WEB_UI) {
5917 new MojoBindingsController(this, false /* for_layout_tests */); 5924 new MojoBindingsController(this, MojoBindingsType::FOR_WEB_UI);
5918 } else if (enabled_bindings & BINDINGS_POLICY_MOJO) { 5925 } else if (enabled_bindings & BINDINGS_POLICY_MOJO) {
5919 new MojoBindingsController(this, true /* for_layout_tests */); 5926 new MojoBindingsController(this, MojoBindingsType::FOR_LAYOUT_TESTS);
5927 } else if (enabled_bindings & BINDINGS_POLICY_HEADLESS) {
5928 new MojoBindingsController(this, MojoBindingsType::FOR_HEADLESS);
5920 } 5929 }
5921 } 5930 }
5922 5931
5923 void RenderFrameImpl::SendFailedProvisionalLoad( 5932 void RenderFrameImpl::SendFailedProvisionalLoad(
5924 const blink::WebURLRequest& request, 5933 const blink::WebURLRequest& request,
5925 const blink::WebURLError& error, 5934 const blink::WebURLError& error,
5926 blink::WebLocalFrame* frame) { 5935 blink::WebLocalFrame* frame) {
5927 bool show_repost_interstitial = 5936 bool show_repost_interstitial =
5928 (error.reason == net::ERR_CACHE_MISS && 5937 (error.reason == net::ERR_CACHE_MISS &&
5929 base::EqualsASCII(base::StringPiece16(request.httpMethod()), "POST")); 5938 base::EqualsASCII(base::StringPiece16(request.httpMethod()), "POST"));
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
6306 // event target. Potentially a Pepper plugin will receive the event. 6315 // event target. Potentially a Pepper plugin will receive the event.
6307 // In order to tell whether a plugin gets the last mouse event and which it 6316 // In order to tell whether a plugin gets the last mouse event and which it
6308 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6317 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6309 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6318 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6310 // |pepper_last_mouse_event_target_|. 6319 // |pepper_last_mouse_event_target_|.
6311 pepper_last_mouse_event_target_ = nullptr; 6320 pepper_last_mouse_event_target_ = nullptr;
6312 #endif 6321 #endif
6313 } 6322 }
6314 6323
6315 } // namespace content 6324 } // 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