navigator.h revision f2477e01787aa58f445919b809d89e252beef54f
1// Copyright 2013 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.
4
5#ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_H_
6#define CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_H_
7
8#include "base/memory/ref_counted.h"
9#include "content/common/content_export.h"
10
11namespace content {
12
13class NavigationControllerImpl;
14class NavigatorDelegate;
15
16// This class is responsible for performing navigations in a node of the
17// FrameTree. Its lifetime is bound to all FrameTreeNode objects that are
18// using it and will be released once all nodes that use it are freed.
19// The Navigator is bound to a single frame tree and cannot be used by multiple
20// instances of FrameTree.
21// TODO(nasko): Move all navigation methods, such as didStartProvisionalLoad
22// from WebContentsImpl to this class.
23class CONTENT_EXPORT Navigator : public base::RefCounted<Navigator> {
24 public:
25  Navigator(NavigationControllerImpl* nav_controller,
26            NavigatorDelegate* delegate);
27
28  NavigationControllerImpl* controller() {
29    return controller_;
30  }
31
32  NavigatorDelegate* delegate() {
33    return delegate_;
34  }
35
36 private:
37  friend class base::RefCounted<Navigator>;
38  virtual ~Navigator() {}
39
40  // The NavigationController that will keep track of session history for all
41  // RenderFrameHost objects using this Navigator.
42  // TODO(nasko): Move ownership of the NavigationController from
43  // WebContentsImpl to this class.
44  NavigationControllerImpl* controller_;
45
46  // Used to notify the object embedding this Navigator about navigation
47  // events. Can be NULL in tests.
48  NavigatorDelegate* delegate_;
49};
50
51}  // namespace content
52
53#endif  // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_H_
54