summaryrefslogtreecommitdiffstats
path: root/content/public/browser/navigation_handle.h
blob: c60babaa9939a4f0861eb1c0f2b7d9d7597c755f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_
#define CONTENT_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_

#include "content/common/content_export.h"
#include "net/base/net_errors.h"

class GURL;

namespace content {

// A NavigationHandle tracks information related to a single navigation.
class CONTENT_EXPORT NavigationHandle {
 public:
  virtual ~NavigationHandle() {}

  // The URL the frame is navigating to. This may change during the navigation
  // when encountering a server redirect.
  virtual const GURL& GetURL() const = 0;

  // The net error code if an error happened prior to commit. Otherwise it will
  // be net::OK.
  virtual net::Error GetNetErrorCode() const = 0;

  // Whether the navigation is taking place in the main frame or in a subframe.
  virtual bool IsInMainFrame() const = 0;

  // Whether the navigation happened in the same page. This is only known
  // after the navigation has committed. It is an error to call this method
  // before the navigation has committed.
  virtual bool IsSamePage() = 0;

  // Whether the navigation has successfully committed a document.
  virtual bool HasCommittedDocument() const = 0;

  // Whether an error page has committed for the navigation.
  virtual bool HasCommittedErrorPage() const = 0;
};

}  // namespace content

#endif  // CONTENT_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_