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

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

Issue 2408333004: Move persistent gesture state to Document, add DocumentUserGestureToken (Closed)
Patch Set: Re-add dropped null check Created 4 years, 1 month 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 | « no previous file | extensions/renderer/dispatcher.cc » ('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 1958 matching lines...) Expand 10 before | Expand all | Expand 10 after
1969 const base::string16& jscript, 1969 const base::string16& jscript,
1970 int id, 1970 int id,
1971 bool notify_result, 1971 bool notify_result,
1972 bool has_user_gesture) { 1972 bool has_user_gesture) {
1973 TRACE_EVENT_INSTANT0("test_tracing", "OnJavaScriptExecuteRequestForTests", 1973 TRACE_EVENT_INSTANT0("test_tracing", "OnJavaScriptExecuteRequestForTests",
1974 TRACE_EVENT_SCOPE_THREAD); 1974 TRACE_EVENT_SCOPE_THREAD);
1975 1975
1976 // A bunch of tests expect to run code in the context of a user gesture, which 1976 // A bunch of tests expect to run code in the context of a user gesture, which
1977 // can grant additional privileges (e.g. the ability to create popups). 1977 // can grant additional privileges (e.g. the ability to create popups).
1978 std::unique_ptr<blink::WebScopedUserGesture> gesture( 1978 std::unique_ptr<blink::WebScopedUserGesture> gesture(
1979 has_user_gesture ? new blink::WebScopedUserGesture : nullptr); 1979 has_user_gesture ? new blink::WebScopedUserGesture(frame_) : nullptr);
1980 v8::HandleScope handle_scope(blink::mainThreadIsolate()); 1980 v8::HandleScope handle_scope(blink::mainThreadIsolate());
1981 v8::Local<v8::Value> result = 1981 v8::Local<v8::Value> result =
1982 frame_->executeScriptAndReturnValue(WebScriptSource(jscript)); 1982 frame_->executeScriptAndReturnValue(WebScriptSource(jscript));
1983 1983
1984 HandleJavascriptExecutionResult(jscript, id, notify_result, result); 1984 HandleJavascriptExecutionResult(jscript, id, notify_result, result);
1985 } 1985 }
1986 1986
1987 void RenderFrameImpl::OnJavaScriptExecuteRequestInIsolatedWorld( 1987 void RenderFrameImpl::OnJavaScriptExecuteRequestInIsolatedWorld(
1988 const base::string16& jscript, 1988 const base::string16& jscript,
1989 int id, 1989 int id,
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
2303 const base::string16& message, 2303 const base::string16& message,
2304 const base::string16& default_value, 2304 const base::string16& default_value,
2305 const GURL& frame_url, 2305 const GURL& frame_url,
2306 base::string16* result) { 2306 base::string16* result) {
2307 // Don't allow further dialogs if we are waiting to swap out, since the 2307 // Don't allow further dialogs if we are waiting to swap out, since the
2308 // ScopedPageLoadDeferrer in our stack prevents it. 2308 // ScopedPageLoadDeferrer in our stack prevents it.
2309 if (suppress_further_dialogs_) 2309 if (suppress_further_dialogs_)
2310 return false; 2310 return false;
2311 2311
2312 int32_t message_length = static_cast<int32_t>(message.length()); 2312 int32_t message_length = static_cast<int32_t>(message.length());
2313 if (WebUserGestureIndicator::processedUserGestureSinceLoad()) { 2313 if (WebUserGestureIndicator::processedUserGestureSinceLoad(frame_)) {
2314 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.UserGestureSinceLoad", 2314 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.UserGestureSinceLoad",
2315 message_length); 2315 message_length);
2316 } else { 2316 } else {
2317 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.NoUserGestureSinceLoad", 2317 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.NoUserGestureSinceLoad",
2318 message_length); 2318 message_length);
2319 } 2319 }
2320 2320
2321 bool success = false; 2321 bool success = false;
2322 base::string16 result_temp; 2322 base::string16 result_temp;
2323 if (!result) 2323 if (!result)
(...skipping 2680 matching lines...) Expand 10 before | Expand all | Expand 10 after
5004 std::unique_ptr<StreamOverrideParameters> stream_override( 5004 std::unique_ptr<StreamOverrideParameters> stream_override(
5005 new StreamOverrideParameters()); 5005 new StreamOverrideParameters());
5006 stream_override->stream_url = stream_url; 5006 stream_override->stream_url = stream_url;
5007 stream_override->response = response; 5007 stream_override->response = response;
5008 stream_override->redirects = request_params.redirects; 5008 stream_override->redirects = request_params.redirects;
5009 stream_override->redirect_responses = request_params.redirect_response; 5009 stream_override->redirect_responses = request_params.redirect_response;
5010 5010
5011 // If the request was initiated in the context of a user gesture then make 5011 // If the request was initiated in the context of a user gesture then make
5012 // sure that the navigation also executes in the context of a user gesture. 5012 // sure that the navigation also executes in the context of a user gesture.
5013 std::unique_ptr<blink::WebScopedUserGesture> gesture( 5013 std::unique_ptr<blink::WebScopedUserGesture> gesture(
5014 request_params.has_user_gesture ? new blink::WebScopedUserGesture 5014 request_params.has_user_gesture ? new blink::WebScopedUserGesture(frame_)
5015 : nullptr); 5015 : nullptr);
5016 5016
5017 NavigateInternal(common_params, StartNavigationParams(), request_params, 5017 NavigateInternal(common_params, StartNavigationParams(), request_params,
5018 std::move(stream_override)); 5018 std::move(stream_override));
5019 } 5019 }
5020 5020
5021 // PlzNavigate 5021 // PlzNavigate
5022 void RenderFrameImpl::OnFailedNavigation( 5022 void RenderFrameImpl::OnFailedNavigation(
5023 const CommonNavigationParams& common_params, 5023 const CommonNavigationParams& common_params,
5024 const RequestNavigationParams& request_params, 5024 const RequestNavigationParams& request_params,
5025 bool has_stale_copy_in_cache, 5025 bool has_stale_copy_in_cache,
(...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after
6569 // event target. Potentially a Pepper plugin will receive the event. 6569 // event target. Potentially a Pepper plugin will receive the event.
6570 // In order to tell whether a plugin gets the last mouse event and which it 6570 // In order to tell whether a plugin gets the last mouse event and which it
6571 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6571 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6572 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6572 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6573 // |pepper_last_mouse_event_target_|. 6573 // |pepper_last_mouse_event_target_|.
6574 pepper_last_mouse_event_target_ = nullptr; 6574 pepper_last_mouse_event_target_ = nullptr;
6575 #endif 6575 #endif
6576 } 6576 }
6577 6577
6578 } // namespace content 6578 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | extensions/renderer/dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698