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

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

Issue 2499313003: Set user_gesture bit at NavigationHandle creation time. (Closed)
Patch Set: comments 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
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 3370 matching lines...) Expand 10 before | Expand all | Expand 10 after
3381 if (!ds) 3381 if (!ds)
3382 return; 3382 return;
3383 3383
3384 TRACE_EVENT2("navigation,benchmark,rail", 3384 TRACE_EVENT2("navigation,benchmark,rail",
3385 "RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_, 3385 "RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_,
3386 "url", ds->request().url().string().utf8()); 3386 "url", ds->request().url().string().utf8());
3387 DocumentState* document_state = DocumentState::FromDataSource(ds); 3387 DocumentState* document_state = DocumentState::FromDataSource(ds);
3388 NavigationStateImpl* navigation_state = static_cast<NavigationStateImpl*>( 3388 NavigationStateImpl* navigation_state = static_cast<NavigationStateImpl*>(
3389 document_state->navigation_state()); 3389 document_state->navigation_state());
3390 bool is_top_most = !frame->parent(); 3390 bool is_top_most = !frame->parent();
3391 bool has_user_gesture = WebUserGestureIndicator::isProcessingUserGesture();
3391 if (is_top_most) { 3392 if (is_top_most) {
3392 render_view_->set_navigation_gesture( 3393 render_view_->set_navigation_gesture(
3393 WebUserGestureIndicator::isProcessingUserGesture() ? 3394 has_user_gesture ? NavigationGestureUser : NavigationGestureAuto);
3394 NavigationGestureUser : NavigationGestureAuto);
3395 } else if (ds->replacesCurrentHistoryItem()) { 3395 } else if (ds->replacesCurrentHistoryItem()) {
3396 // Subframe navigations that don't add session history items must be 3396 // Subframe navigations that don't add session history items must be
3397 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we 3397 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we
3398 // handle loading of error pages. 3398 // handle loading of error pages.
3399 navigation_state->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME); 3399 navigation_state->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME);
3400 } 3400 }
3401 3401
3402 base::TimeTicks navigation_start = 3402 base::TimeTicks navigation_start =
3403 navigation_state->common_params().navigation_start; 3403 navigation_state->common_params().navigation_start;
3404 DCHECK(!navigation_start.is_null()); 3404 DCHECK(!navigation_start.is_null());
3405 3405
3406 for (auto& observer : render_view_->observers()) 3406 for (auto& observer : render_view_->observers())
3407 observer.DidStartProvisionalLoad(frame); 3407 observer.DidStartProvisionalLoad(frame);
3408 for (auto& observer : observers_) 3408 for (auto& observer : observers_)
3409 observer.DidStartProvisionalLoad(); 3409 observer.DidStartProvisionalLoad();
3410 3410
3411 Send(new FrameHostMsg_DidStartProvisionalLoad( 3411 Send(new FrameHostMsg_DidStartProvisionalLoad(
3412 routing_id_, ds->request().url(), navigation_start)); 3412 routing_id_, ds->request().url(), navigation_start, has_user_gesture));
3413 } 3413 }
3414 3414
3415 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad( 3415 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad(
3416 blink::WebLocalFrame* frame) { 3416 blink::WebLocalFrame* frame) {
3417 DCHECK_EQ(frame_, frame); 3417 DCHECK_EQ(frame_, frame);
3418 3418
3419 // We don't use HistoryController in OOPIF enabled modes. 3419 // We don't use HistoryController in OOPIF enabled modes.
3420 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) 3420 if (SiteIsolationPolicy::UseSubframeNavigationEntries())
3421 return; 3421 return;
3422 3422
(...skipping 3214 matching lines...) Expand 10 before | Expand all | Expand 10 after
6637 // event target. Potentially a Pepper plugin will receive the event. 6637 // event target. Potentially a Pepper plugin will receive the event.
6638 // In order to tell whether a plugin gets the last mouse event and which it 6638 // In order to tell whether a plugin gets the last mouse event and which it
6639 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6639 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6640 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6640 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6641 // |pepper_last_mouse_event_target_|. 6641 // |pepper_last_mouse_event_target_|.
6642 pepper_last_mouse_event_target_ = nullptr; 6642 pepper_last_mouse_event_target_ = nullptr;
6643 #endif 6643 #endif
6644 } 6644 }
6645 6645
6646 } // namespace content 6646 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698