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

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: Rebase Created 5 years, 2 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;
66 RenderFrameHostImpl* GetRenderFrameHost() override;
65 bool IsSamePage() override; 67 bool IsSamePage() override;
66 bool HasCommittedDocument() const override; 68 bool HasCommitted() override;
67 bool HasCommittedErrorPage() const override; 69 bool IsErrorPage() override;
68 70
69 void set_net_error_code(net::Error net_error_code) { 71 void set_net_error_code(net::Error net_error_code) {
70 net_error_code_ = net_error_code; 72 net_error_code_ = net_error_code;
71 } 73 }
72 74
73 // Returns whether the navigation is currently being transferred from one 75 // Returns whether the navigation is currently being transferred from one
74 // RenderFrameHost to another. In particular, a DidStartProvisionalLoad IPC 76 // RenderFrameHost to another. In particular, a DidStartProvisionalLoad IPC
75 // for the navigation URL, received in the new RenderFrameHost, should not 77 // for the navigation URL, received in the new RenderFrameHost, should not
76 // indicate the start of a new navigation in that case. 78 // indicate the start of a new navigation in that case.
77 bool is_transferring() const { return is_transferring_; } 79 bool is_transferring() const { return is_transferring_; }
78 void set_is_transferring(bool is_transferring) { 80 void set_is_transferring(bool is_transferring) {
79 is_transferring_ = is_transferring; 81 is_transferring_ = is_transferring;
80 } 82 }
81 83
82 // Called when the navigation was redirected. This will update the |url_| and 84 // Called when the navigation was redirected. This will update the |url_| and
83 // inform the delegate. 85 // inform the delegate.
84 void DidRedirectNavigation(const GURL& new_url); 86 void DidRedirectNavigation(const GURL& new_url);
85 87
86 // Called when the navigation was committed. This will update the |state_| 88 // Called when the navigation is ready to be committed in
87 // and inform the delegate, 89 // |render_frame_host|. This will update the |state_| and inform the
88 void DidCommitNavigation(bool same_page); 90 // delegate.
91 void ReadyToCommitNavigation(RenderFrameHostImpl* render_frame_host);
92
93 // Called when the navigation was committed in |render_frame_host|. This will
94 // update the |state_|.
95 void DidCommitNavigation(bool same_page,
96 RenderFrameHostImpl* render_frame_host);
89 97
90 private: 98 private:
91 // Used to track the state the navigation is currently in. 99 // Used to track the state the navigation is currently in.
92 enum State { 100 enum State {
93 DID_START = 0, 101 DID_START = 0,
102 READY_TO_COMMIT,
94 DID_COMMIT, 103 DID_COMMIT,
95 DID_COMMIT_ERROR_PAGE, 104 DID_COMMIT_ERROR_PAGE,
96 }; 105 };
97 106
98 NavigationHandleImpl(const GURL& url, 107 NavigationHandleImpl(const GURL& url,
99 const bool is_main_frame, 108 const bool is_main_frame,
100 NavigatorDelegate* delegate); 109 NavigatorDelegate* delegate);
101 110
102 // See NavigationHandle for a description of those member variables. 111 // See NavigationHandle for a description of those member variables.
103 GURL url_; 112 GURL url_;
104 net::Error net_error_code_; 113 net::Error net_error_code_;
105 State state_; 114 State state_;
106 const bool is_main_frame_; 115 const bool is_main_frame_;
116 RenderFrameHostImpl* render_frame_host_;
107 bool is_same_page_; 117 bool is_same_page_;
108 118
109 // Whether the navigation is in the middle of a transfer. Set to false when 119 // Whether the navigation is in the middle of a transfer. Set to false when
110 // the DidStartProvisionalLoad is received from the new renderer. 120 // the DidStartProvisionalLoad is received from the new renderer.
111 bool is_transferring_; 121 bool is_transferring_;
112 122
113 // The delegate that should be notified about events related to this 123 // The delegate that should be notified about events related to this
114 // navigation. 124 // navigation.
115 NavigatorDelegate* delegate_; 125 NavigatorDelegate* delegate_;
116 126
117 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); 127 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl);
118 }; 128 };
119 129
120 } // namespace content 130 } // namespace content
121 131
122 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 132 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698