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

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

Issue 1312213010: PageLoadMetrics renderer and browser implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Instrumented NavigationHandle for IsSamePage, fixed broken logic and tests 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 #include "content/browser/frame_host/navigation_handle_impl.h" 5 #include "content/browser/frame_host/navigation_handle_impl.h"
6 6
7 #include "content/browser/frame_host/navigator_delegate.h" 7 #include "content/browser/frame_host/navigator_delegate.h"
8 #include "net/url_request/redirect_info.h" 8 #include "net/url_request/redirect_info.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 // static 12 // static
13 scoped_ptr<NavigationHandleImpl> NavigationHandleImpl::Create( 13 scoped_ptr<NavigationHandleImpl> NavigationHandleImpl::Create(
14 const GURL& url, 14 const GURL& url,
15 const bool is_main_frame, 15 const bool is_main_frame,
16 NavigatorDelegate* delegate) { 16 NavigatorDelegate* delegate) {
17 return scoped_ptr<NavigationHandleImpl>( 17 return scoped_ptr<NavigationHandleImpl>(
18 new NavigationHandleImpl(url, is_main_frame, delegate)); 18 new NavigationHandleImpl(url, is_main_frame, delegate));
19 } 19 }
20 20
21 NavigationHandleImpl::NavigationHandleImpl(const GURL& url, 21 NavigationHandleImpl::NavigationHandleImpl(const GURL& url,
22 const bool is_main_frame, 22 const bool is_main_frame,
23 NavigatorDelegate* delegate) 23 NavigatorDelegate* delegate)
24 : url_(url), 24 : url_(url),
25 net_error_code_(net::OK), 25 net_error_code_(net::OK),
26 state_(DID_START), 26 state_(DID_START),
27 is_main_frame_(is_main_frame), 27 is_main_frame_(is_main_frame),
28 is_same_page_(false),
28 is_transferring_(false), 29 is_transferring_(false),
29 delegate_(delegate) { 30 delegate_(delegate) {
30 delegate_->DidStartNavigation(this); 31 delegate_->DidStartNavigation(this);
31 } 32 }
32 33
33 NavigationHandleImpl::~NavigationHandleImpl() { 34 NavigationHandleImpl::~NavigationHandleImpl() {
34 delegate_->DidFinishNavigation(this); 35 delegate_->DidFinishNavigation(this);
35 } 36 }
36 37
37 const GURL& NavigationHandleImpl::GetURL() const { 38 const GURL& NavigationHandleImpl::GetURL() const {
38 return url_; 39 return url_;
39 } 40 }
40 41
41 net::Error NavigationHandleImpl::GetNetErrorCode() const { 42 net::Error NavigationHandleImpl::GetNetErrorCode() const {
42 return net_error_code_; 43 return net_error_code_;
43 } 44 }
44 45
45 bool NavigationHandleImpl::IsInMainFrame() const { 46 bool NavigationHandleImpl::IsInMainFrame() const {
46 return is_main_frame_; 47 return is_main_frame_;
47 } 48 }
48 49
50 bool NavigationHandleImpl::IsSamePage() const {
clamy 2015/09/08 13:25:58 Add: CHECK(state_ == DID_COMMIT || state_ == DID_C
Charlie Harrison 2015/09/08 23:05:15 Done.
51 return is_same_page_;
52 }
53
49 bool NavigationHandleImpl::HasCommittedDocument() const { 54 bool NavigationHandleImpl::HasCommittedDocument() const {
50 return state_ == DID_COMMIT; 55 return state_ == DID_COMMIT;
51 } 56 }
52 57
53 bool NavigationHandleImpl::HasCommittedErrorPage() const { 58 bool NavigationHandleImpl::HasCommittedErrorPage() const {
54 return state_ == DID_COMMIT_ERROR_PAGE; 59 return state_ == DID_COMMIT_ERROR_PAGE;
55 } 60 }
56 61
57 void NavigationHandleImpl::DidRedirectNavigation(const GURL& new_url) { 62 void NavigationHandleImpl::DidRedirectNavigation(const GURL& new_url) {
58 url_ = new_url; 63 url_ = new_url;
59 delegate_->DidRedirectNavigation(this); 64 delegate_->DidRedirectNavigation(this);
60 } 65 }
61 66
62 void NavigationHandleImpl::DidCommitNavigation() { 67 void NavigationHandleImpl::DidCommitNavigation() {
63 state_ = net_error_code_ == net::OK ? DID_COMMIT : DID_COMMIT_ERROR_PAGE; 68 state_ = net_error_code_ == net::OK ? DID_COMMIT : DID_COMMIT_ERROR_PAGE;
64 delegate_->DidCommitNavigation(this); 69 delegate_->DidCommitNavigation(this);
65 } 70 }
66 71
67 } // namespace content 72 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698