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

Side by Side Diff: content/browser/frame_host/navigation_handle_impl.cc

Issue 1661423002: Solidify Entry discarding logic (NavigationHandle keeps its ID) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: creis review Created 4 years, 10 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
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/browser/frame_host/navigation_handle_impl.h" 5 #include "content/browser/frame_host/navigation_handle_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "content/browser/frame_host/frame_tree_node.h" 9 #include "content/browser/frame_host/frame_tree_node.h"
10 #include "content/browser/frame_host/navigator.h" 10 #include "content/browser/frame_host/navigator.h"
11 #include "content/browser/frame_host/navigator_delegate.h" 11 #include "content/browser/frame_host/navigator_delegate.h"
12 #include "content/browser/service_worker/service_worker_context_wrapper.h" 12 #include "content/browser/service_worker/service_worker_context_wrapper.h"
13 #include "content/browser/service_worker/service_worker_navigation_handle.h" 13 #include "content/browser/service_worker/service_worker_navigation_handle.h"
14 #include "content/common/frame_messages.h" 14 #include "content/common/frame_messages.h"
15 #include "content/public/browser/content_browser_client.h" 15 #include "content/public/browser/content_browser_client.h"
16 #include "content/public/browser/navigation_entry.h"
16 #include "content/public/common/browser_side_navigation_policy.h" 17 #include "content/public/common/browser_side_navigation_policy.h"
17 #include "content/public/common/content_client.h" 18 #include "content/public/common/content_client.h"
18 #include "net/url_request/redirect_info.h" 19 #include "net/url_request/redirect_info.h"
19 20
20 namespace content { 21 namespace content {
21 22
22 namespace { 23 namespace {
23 24
24 void UpdateThrottleCheckResult( 25 void UpdateThrottleCheckResult(
25 NavigationThrottle::ThrottleCheckResult* to_update, 26 NavigationThrottle::ThrottleCheckResult* to_update,
26 NavigationThrottle::ThrottleCheckResult result) { 27 NavigationThrottle::ThrottleCheckResult result) {
27 *to_update = result; 28 *to_update = result;
28 } 29 }
29 30
30 } // namespace 31 } // namespace
31 32
32 // static 33 // static
33 scoped_ptr<NavigationHandleImpl> NavigationHandleImpl::Create( 34 scoped_ptr<NavigationHandleImpl> NavigationHandleImpl::Create(
34 const GURL& url, 35 const GURL& url,
35 FrameTreeNode* frame_tree_node, 36 FrameTreeNode* frame_tree_node,
36 const base::TimeTicks& navigation_start) { 37 const base::TimeTicks& navigation_start,
37 return scoped_ptr<NavigationHandleImpl>( 38 const NavigationEntry* pending_nav_entry) {
38 new NavigationHandleImpl(url, frame_tree_node, navigation_start)); 39 return scoped_ptr<NavigationHandleImpl>(new NavigationHandleImpl(
40 url, frame_tree_node, navigation_start, pending_nav_entry));
39 } 41 }
40 42
41 NavigationHandleImpl::NavigationHandleImpl( 43 NavigationHandleImpl::NavigationHandleImpl(
42 const GURL& url, 44 const GURL& url,
43 FrameTreeNode* frame_tree_node, 45 FrameTreeNode* frame_tree_node,
44 const base::TimeTicks& navigation_start) 46 const base::TimeTicks& navigation_start,
47 const NavigationEntry* entry)
45 : url_(url), 48 : url_(url),
46 is_post_(false), 49 is_post_(false),
47 has_user_gesture_(false), 50 has_user_gesture_(false),
48 transition_(ui::PAGE_TRANSITION_LINK), 51 transition_(ui::PAGE_TRANSITION_LINK),
49 is_external_protocol_(false), 52 is_external_protocol_(false),
50 net_error_code_(net::OK), 53 net_error_code_(net::OK),
51 render_frame_host_(nullptr), 54 render_frame_host_(nullptr),
52 is_same_page_(false), 55 is_same_page_(false),
53 state_(INITIAL), 56 state_(INITIAL),
54 is_transferring_(false), 57 is_transferring_(false),
55 frame_tree_node_(frame_tree_node), 58 frame_tree_node_(frame_tree_node),
56 next_index_(0), 59 next_index_(0),
57 navigation_start_(navigation_start) { 60 navigation_start_(navigation_start),
61 pending_nav_entry_id_(entry ? entry->GetUniqueID() : 0) {
58 DCHECK(!navigation_start.is_null()); 62 DCHECK(!navigation_start.is_null());
59 GetDelegate()->DidStartNavigation(this); 63 GetDelegate()->DidStartNavigation(this);
60 } 64 }
61 65
62 NavigationHandleImpl::~NavigationHandleImpl() { 66 NavigationHandleImpl::~NavigationHandleImpl() {
63 GetDelegate()->DidFinishNavigation(this); 67 GetDelegate()->DidFinishNavigation(this);
64 68
65 // Cancel the navigation on the IO thread if the NavigationHandle is being 69 // Cancel the navigation on the IO thread if the NavigationHandle is being
66 // destroyed in the middle of the NavigationThrottles checks. 70 // destroyed in the middle of the NavigationThrottles checks.
67 if (!IsBrowserSideNavigationEnabled() && !complete_callback_.is_null()) 71 if (!IsBrowserSideNavigationEnabled() && !complete_callback_.is_null())
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 complete_callback_.Reset(); 449 complete_callback_.Reset();
446 450
447 if (!callback.is_null()) 451 if (!callback.is_null())
448 callback.Run(result); 452 callback.Run(result);
449 453
450 // No code after running the callback, as it might have resulted in our 454 // No code after running the callback, as it might have resulted in our
451 // destruction. 455 // destruction.
452 } 456 }
453 457
454 } // namespace content 458 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698