| 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 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1961 const base::string16& jscript, | 1961 const base::string16& jscript, |
| 1962 int id, | 1962 int id, |
| 1963 bool notify_result, | 1963 bool notify_result, |
| 1964 bool has_user_gesture) { | 1964 bool has_user_gesture) { |
| 1965 TRACE_EVENT_INSTANT0("test_tracing", "OnJavaScriptExecuteRequestForTests", | 1965 TRACE_EVENT_INSTANT0("test_tracing", "OnJavaScriptExecuteRequestForTests", |
| 1966 TRACE_EVENT_SCOPE_THREAD); | 1966 TRACE_EVENT_SCOPE_THREAD); |
| 1967 | 1967 |
| 1968 // A bunch of tests expect to run code in the context of a user gesture, which | 1968 // A bunch of tests expect to run code in the context of a user gesture, which |
| 1969 // can grant additional privileges (e.g. the ability to create popups). | 1969 // can grant additional privileges (e.g. the ability to create popups). |
| 1970 std::unique_ptr<blink::WebScopedUserGesture> gesture( | 1970 std::unique_ptr<blink::WebScopedUserGesture> gesture( |
| 1971 has_user_gesture ? new blink::WebScopedUserGesture : nullptr); | 1971 has_user_gesture ? new blink::WebScopedUserGesture(frame_) : nullptr); |
| 1972 v8::HandleScope handle_scope(blink::mainThreadIsolate()); | 1972 v8::HandleScope handle_scope(blink::mainThreadIsolate()); |
| 1973 v8::Local<v8::Value> result = | 1973 v8::Local<v8::Value> result = |
| 1974 frame_->executeScriptAndReturnValue(WebScriptSource(jscript)); | 1974 frame_->executeScriptAndReturnValue(WebScriptSource(jscript)); |
| 1975 | 1975 |
| 1976 HandleJavascriptExecutionResult(jscript, id, notify_result, result); | 1976 HandleJavascriptExecutionResult(jscript, id, notify_result, result); |
| 1977 } | 1977 } |
| 1978 | 1978 |
| 1979 void RenderFrameImpl::OnJavaScriptExecuteRequestInIsolatedWorld( | 1979 void RenderFrameImpl::OnJavaScriptExecuteRequestInIsolatedWorld( |
| 1980 const base::string16& jscript, | 1980 const base::string16& jscript, |
| 1981 int id, | 1981 int id, |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2287 const base::string16& message, | 2287 const base::string16& message, |
| 2288 const base::string16& default_value, | 2288 const base::string16& default_value, |
| 2289 const GURL& frame_url, | 2289 const GURL& frame_url, |
| 2290 base::string16* result) { | 2290 base::string16* result) { |
| 2291 // Don't allow further dialogs if we are waiting to swap out, since the | 2291 // Don't allow further dialogs if we are waiting to swap out, since the |
| 2292 // ScopedPageLoadDeferrer in our stack prevents it. | 2292 // ScopedPageLoadDeferrer in our stack prevents it. |
| 2293 if (suppress_further_dialogs_) | 2293 if (suppress_further_dialogs_) |
| 2294 return false; | 2294 return false; |
| 2295 | 2295 |
| 2296 int32_t message_length = static_cast<int32_t>(message.length()); | 2296 int32_t message_length = static_cast<int32_t>(message.length()); |
| 2297 if (WebUserGestureIndicator::processedUserGestureSinceLoad()) { | 2297 if (WebUserGestureIndicator::processedUserGestureSinceLoad(frame_)) { |
| 2298 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.UserGestureSinceLoad", | 2298 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.UserGestureSinceLoad", |
| 2299 message_length); | 2299 message_length); |
| 2300 } else { | 2300 } else { |
| 2301 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.NoUserGestureSinceLoad", | 2301 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.NoUserGestureSinceLoad", |
| 2302 message_length); | 2302 message_length); |
| 2303 } | 2303 } |
| 2304 | 2304 |
| 2305 bool success = false; | 2305 bool success = false; |
| 2306 base::string16 result_temp; | 2306 base::string16 result_temp; |
| 2307 if (!result) | 2307 if (!result) |
| (...skipping 2660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4968 std::unique_ptr<StreamOverrideParameters> stream_override( | 4968 std::unique_ptr<StreamOverrideParameters> stream_override( |
| 4969 new StreamOverrideParameters()); | 4969 new StreamOverrideParameters()); |
| 4970 stream_override->stream_url = stream_url; | 4970 stream_override->stream_url = stream_url; |
| 4971 stream_override->response = response; | 4971 stream_override->response = response; |
| 4972 stream_override->redirects = request_params.redirects; | 4972 stream_override->redirects = request_params.redirects; |
| 4973 stream_override->redirect_responses = request_params.redirect_response; | 4973 stream_override->redirect_responses = request_params.redirect_response; |
| 4974 | 4974 |
| 4975 // If the request was initiated in the context of a user gesture then make | 4975 // If the request was initiated in the context of a user gesture then make |
| 4976 // sure that the navigation also executes in the context of a user gesture. | 4976 // sure that the navigation also executes in the context of a user gesture. |
| 4977 std::unique_ptr<blink::WebScopedUserGesture> gesture( | 4977 std::unique_ptr<blink::WebScopedUserGesture> gesture( |
| 4978 request_params.has_user_gesture ? new blink::WebScopedUserGesture | 4978 request_params.has_user_gesture ? new blink::WebScopedUserGesture(frame_) |
| 4979 : nullptr); | 4979 : nullptr); |
| 4980 | 4980 |
| 4981 NavigateInternal(common_params, StartNavigationParams(), request_params, | 4981 NavigateInternal(common_params, StartNavigationParams(), request_params, |
| 4982 std::move(stream_override)); | 4982 std::move(stream_override)); |
| 4983 } | 4983 } |
| 4984 | 4984 |
| 4985 // PlzNavigate | 4985 // PlzNavigate |
| 4986 void RenderFrameImpl::OnFailedNavigation( | 4986 void RenderFrameImpl::OnFailedNavigation( |
| 4987 const CommonNavigationParams& common_params, | 4987 const CommonNavigationParams& common_params, |
| 4988 const RequestNavigationParams& request_params, | 4988 const RequestNavigationParams& request_params, |
| 4989 bool has_stale_copy_in_cache, | 4989 bool has_stale_copy_in_cache, |
| (...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6538 // event target. Potentially a Pepper plugin will receive the event. | 6538 // event target. Potentially a Pepper plugin will receive the event. |
| 6539 // In order to tell whether a plugin gets the last mouse event and which it | 6539 // In order to tell whether a plugin gets the last mouse event and which it |
| 6540 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6540 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6541 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6541 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6542 // |pepper_last_mouse_event_target_|. | 6542 // |pepper_last_mouse_event_target_|. |
| 6543 pepper_last_mouse_event_target_ = nullptr; | 6543 pepper_last_mouse_event_target_ = nullptr; |
| 6544 #endif | 6544 #endif |
| 6545 } | 6545 } |
| 6546 | 6546 |
| 6547 } // namespace content | 6547 } // namespace content |
| OLD | NEW |