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

Side by Side Diff: content/public/browser/navigation_handle.cc

Issue 2557233002: Revert of Set user_gesture bit at NavigationHandle creation time. (Closed)
Patch Set: rebase Created 4 years 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/public/browser/navigation_handle.h ('k') | content/public/test/render_view_test.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/public/browser/navigation_handle.h" 5 #include "content/public/browser/navigation_handle.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "content/browser/frame_host/navigation_handle_impl.h" 9 #include "content/browser/frame_host/navigation_handle_impl.h"
10 #include "content/browser/frame_host/navigator.h" 10 #include "content/browser/frame_host/navigator.h"
11 #include "content/browser/frame_host/render_frame_host_impl.h" 11 #include "content/browser/frame_host/render_frame_host_impl.h"
12 #include "content/browser/web_contents/web_contents_impl.h" 12 #include "content/browser/web_contents/web_contents_impl.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 WebContents* NavigationHandle::GetWebContents() { 16 WebContents* NavigationHandle::GetWebContents() {
17 // The NavigationHandleImpl cannot access the WebContentsImpl as it would be 17 // The NavigationHandleImpl cannot access the WebContentsImpl as it would be
18 // a layering violation, hence the cast here. 18 // a layering violation, hence the cast here.
19 return static_cast<WebContentsImpl*>( 19 return static_cast<WebContentsImpl*>(
20 static_cast<NavigationHandleImpl*>(this)->GetDelegate()); 20 static_cast<NavigationHandleImpl*>(this)->GetDelegate());
21 } 21 }
22 22
23 // static 23 // static
24 std::unique_ptr<NavigationHandle> 24 std::unique_ptr<NavigationHandle>
25 NavigationHandle::CreateNavigationHandleForTesting( 25 NavigationHandle::CreateNavigationHandleForTesting(
26 const GURL& url, 26 const GURL& url,
27 RenderFrameHost* render_frame_host, 27 RenderFrameHost* render_frame_host,
28 bool committed, 28 bool committed,
29 net::Error error, 29 net::Error error) {
30 bool has_user_gesture) {
31 std::unique_ptr<NavigationHandleImpl> handle_impl = 30 std::unique_ptr<NavigationHandleImpl> handle_impl =
32 NavigationHandleImpl::Create( 31 NavigationHandleImpl::Create(
33 url, static_cast<RenderFrameHostImpl*>(render_frame_host) 32 url, static_cast<RenderFrameHostImpl*>(render_frame_host)
34 ->frame_tree_node(), 33 ->frame_tree_node(),
35 true, // is_renderer_initiated 34 true, // is_renderer_initiated
36 false, // is_same_page 35 false, // is_same_page
37 base::TimeTicks::Now(), 0, 36 base::TimeTicks::Now(), 0,
38 has_user_gesture ? NavigationGestureUser : NavigationGestureAuto,
39 false); // started_from_context_menu 37 false); // started_from_context_menu
40 handle_impl->set_render_frame_host( 38 handle_impl->set_render_frame_host(
41 static_cast<RenderFrameHostImpl*>(render_frame_host)); 39 static_cast<RenderFrameHostImpl*>(render_frame_host));
42 if (error != net::OK) 40 if (error != net::OK)
43 handle_impl->set_net_error_code(error); 41 handle_impl->set_net_error_code(error);
44 if (committed) 42 if (committed)
45 handle_impl->CallDidCommitNavigationForTesting(url); 43 handle_impl->CallDidCommitNavigationForTesting(url);
46 return std::unique_ptr<NavigationHandle>(std::move(handle_impl)); 44 return std::unique_ptr<NavigationHandle>(std::move(handle_impl));
47 } 45 }
48 46
49 } // namespace content 47 } // namespace content
OLDNEW
« no previous file with comments | « content/public/browser/navigation_handle.h ('k') | content/public/test/render_view_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698