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

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

Issue 1350673003: Remove WebContentsObserver::DidCommitNavigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 5 years, 3 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 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
7 7
8 #include "content/public/browser/navigation_handle.h" 8 #include "content/public/browser/navigation_handle.h"
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "content/browser/frame_host/render_frame_host_impl.h"
12 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
13 #include "url/gurl.h" 14 #include "url/gurl.h"
14 15
15 namespace content { 16 namespace content {
16 17
17 class NavigatorDelegate; 18 class NavigatorDelegate;
18 struct NavigationRequestInfo; 19 struct NavigationRequestInfo;
19 20
20 // This class keeps track of a single navigation. It is created upon receipt of 21 // This class keeps track of a single navigation. It is created upon receipt of
21 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns 22 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 static scoped_ptr<NavigationHandleImpl> Create(const GURL& url, 56 static scoped_ptr<NavigationHandleImpl> Create(const GURL& url,
56 const bool is_main_frame, 57 const bool is_main_frame,
57 NavigatorDelegate* delegate); 58 NavigatorDelegate* delegate);
58 59
59 ~NavigationHandleImpl() override; 60 ~NavigationHandleImpl() override;
60 61
61 // NavigationHandle implementation: 62 // NavigationHandle implementation:
62 const GURL& GetURL() const override; 63 const GURL& GetURL() const override;
63 net::Error GetNetErrorCode() const override; 64 net::Error GetNetErrorCode() const override;
64 bool IsInMainFrame() const override; 65 bool IsInMainFrame() const override;
65 bool HasCommittedDocument() const override; 66 RenderFrameHostImpl* GetRenderFrameHost() override;
66 bool HasCommittedErrorPage() const override; 67 bool HasCommitted() override;
68 bool IsErrorPage() override;
67 69
68 void set_net_error_code(net::Error net_error_code) { 70 void set_net_error_code(net::Error net_error_code) {
69 net_error_code_ = net_error_code; 71 net_error_code_ = net_error_code;
70 } 72 }
71 73
72 // Returns whether the navigation is currently being transferred from one 74 // Returns whether the navigation is currently being transferred from one
73 // RenderFrameHost to another. In particular, a DidStartProvisionalLoad IPC 75 // RenderFrameHost to another. In particular, a DidStartProvisionalLoad IPC
74 // for the navigation URL, received in the new RenderFrameHost, should not 76 // for the navigation URL, received in the new RenderFrameHost, should not
75 // indicate the start of a new navigation in that case. 77 // indicate the start of a new navigation in that case.
76 bool is_transferring() const { return is_transferring_; } 78 bool is_transferring() const { return is_transferring_; }
77 void set_is_transferring(bool is_transferring) { 79 void set_is_transferring(bool is_transferring) {
78 is_transferring_ = is_transferring; 80 is_transferring_ = is_transferring;
79 } 81 }
80 82
81 // Called when the navigation was redirected. This will update the |url_| and 83 // Called when the navigation was redirected. This will update the |url_| and
82 // inform the delegate. 84 // inform the delegate.
83 void DidRedirectNavigation(const GURL& new_url); 85 void DidRedirectNavigation(const GURL& new_url);
84 86
85 // Called when the navigation was committed. This will update the |state_| 87 // Called when the navigation is ready to be committed in
86 // and inform the delegate, 88 // |render_frame_host|. This will update the |state_| and inform the
87 void DidCommitNavigation(); 89 // delegate.
90 void ReadyToCommitNavigation(RenderFrameHostImpl* render_frame_host);
91
92 // Called when the navigation was committed in |render_frame_host|. This will
93 // update the |state_|.
94 void DidCommitNavigation(RenderFrameHostImpl* render_frame_host);
88 95
89 private: 96 private:
90 // Used to track the state the navigation is currently in. 97 // Used to track the state the navigation is currently in.
91 enum State { 98 enum State {
92 DID_START = 0, 99 DID_START = 0,
100 READY_TO_COMMIT,
93 DID_COMMIT, 101 DID_COMMIT,
94 DID_COMMIT_ERROR_PAGE, 102 DID_COMMIT_ERROR_PAGE,
95 }; 103 };
96 104
97 NavigationHandleImpl(const GURL& url, 105 NavigationHandleImpl(const GURL& url,
98 const bool is_main_frame, 106 const bool is_main_frame,
99 NavigatorDelegate* delegate); 107 NavigatorDelegate* delegate);
100 108
101 // See NavigationHandle for a description of those member variables. 109 // See NavigationHandle for a description of those member variables.
102 GURL url_; 110 GURL url_;
103 net::Error net_error_code_; 111 net::Error net_error_code_;
104 State state_; 112 State state_;
105 const bool is_main_frame_; 113 const bool is_main_frame_;
114 RenderFrameHostImpl* render_frame_host_;
106 115
107 // Whether the navigation is in the middle of a transfer. Set to false when 116 // Whether the navigation is in the middle of a transfer. Set to false when
108 // the DidStartProvisionalLoad is received from the new renderer. 117 // the DidStartProvisionalLoad is received from the new renderer.
109 bool is_transferring_; 118 bool is_transferring_;
110 119
111 // The delegate that should be notified about events related to this 120 // The delegate that should be notified about events related to this
112 // navigation. 121 // navigation.
113 NavigatorDelegate* delegate_; 122 NavigatorDelegate* delegate_;
114 123
115 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); 124 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl);
116 }; 125 };
117 126
118 } // namespace content 127 } // namespace content
119 128
120 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 129 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698