Add long running gmail memory benchmark for background tab.
[chromium-blink-merge.git] / content / browser / frame_host / navigation_handle_impl.cc
blobf24999058b5f36021c507f91087d45f01b5435a8
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
3 // found in the LICENSE file.
5 #include "content/browser/frame_host/navigation_handle_impl.h"
7 #include "content/browser/frame_host/navigator_delegate.h"
8 #include "net/url_request/redirect_info.h"
10 namespace content {
12 // static
13 scoped_ptr<NavigationHandleImpl> NavigationHandleImpl::Create(
14 const GURL& url,
15 const bool is_main_frame,
16 NavigatorDelegate* delegate) {
17 return scoped_ptr<NavigationHandleImpl>(
18 new NavigationHandleImpl(url, is_main_frame, delegate));
21 NavigationHandleImpl::NavigationHandleImpl(const GURL& url,
22 const bool is_main_frame,
23 NavigatorDelegate* delegate)
24 : url_(url),
25 net_error_code_(net::OK),
26 state_(DID_START),
27 is_main_frame_(is_main_frame),
28 is_transferring_(false),
29 delegate_(delegate) {
30 delegate_->DidStartNavigation(this);
33 NavigationHandleImpl::~NavigationHandleImpl() {
34 delegate_->DidFinishNavigation(this);
37 const GURL& NavigationHandleImpl::GetURL() const {
38 return url_;
41 net::Error NavigationHandleImpl::GetNetErrorCode() const {
42 return net_error_code_;
45 bool NavigationHandleImpl::IsInMainFrame() const {
46 return is_main_frame_;
49 bool NavigationHandleImpl::HasCommittedDocument() const {
50 return state_ == DID_COMMIT;
53 bool NavigationHandleImpl::HasCommittedErrorPage() const {
54 return state_ == DID_COMMIT_ERROR_PAGE;
57 void NavigationHandleImpl::DidRedirectNavigation(const GURL& new_url) {
58 url_ = new_url;
59 delegate_->DidRedirectNavigation(this);
62 void NavigationHandleImpl::DidCommitNavigation() {
63 state_ = net_error_code_ == net::OK ? DID_COMMIT : DID_COMMIT_ERROR_PAGE;
64 delegate_->DidCommitNavigation(this);
67 } // namespace content