Upstream version 6.35.121.0
[platform/framework/web/crosswalk.git] / src / content / browser / frame_host / navigator_impl.h
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_IMPL_H_
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "content/browser/frame_host/navigation_controller_impl.h"
10 #include "content/browser/frame_host/navigator.h"
11 #include "content/common/content_export.h"
12
13 namespace content {
14
15 class NavigationControllerImpl;
16 class NavigatorDelegate;
17 struct LoadCommittedDetails;
18
19 // This class is an implementation of Navigator, responsible for managing
20 // navigations in regular browser tabs.
21 class CONTENT_EXPORT NavigatorImpl : public Navigator {
22  public:
23   NavigatorImpl(NavigationControllerImpl* navigation_controller,
24                 NavigatorDelegate* delegate);
25
26   // Navigator implementation.
27   virtual void DidStartProvisionalLoad(RenderFrameHostImpl* render_frame_host,
28                                        int parent_routing_id,
29                                        const GURL& url) OVERRIDE;
30   virtual void DidFailProvisionalLoadWithError(
31       RenderFrameHostImpl* render_frame_host,
32       const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params)
33       OVERRIDE;
34   virtual void DidFailLoadWithError(
35       RenderFrameHostImpl* render_frame_host,
36       const GURL& url,
37       int error_code,
38       const base::string16& error_description) OVERRIDE;
39   virtual void DidRedirectProvisionalLoad(
40       RenderFrameHostImpl* render_frame_host,
41       int32 page_id,
42       const GURL& source_url,
43       const GURL& target_url) OVERRIDE;
44   virtual void DidNavigate(
45       RenderFrameHostImpl* render_frame_host,
46       const FrameHostMsg_DidCommitProvisionalLoad_Params&
47           input_params) OVERRIDE;
48   virtual bool NavigateToPendingEntry(
49       RenderFrameHostImpl* render_frame_host,
50       NavigationController::ReloadType reload_type) OVERRIDE;
51   virtual base::TimeTicks GetCurrentLoadStart() OVERRIDE;
52   virtual void RequestOpenURL(RenderFrameHostImpl* render_frame_host,
53                               const GURL& url,
54                               const Referrer& referrer,
55                               WindowOpenDisposition disposition,
56                               bool should_replace_current_entry,
57                               bool user_gesture) OVERRIDE;
58   virtual void RequestTransferURL(
59       RenderFrameHostImpl* render_frame_host,
60       const GURL& url,
61       const std::vector<GURL>& redirect_chain,
62       const Referrer& referrer,
63       PageTransition page_transition,
64       WindowOpenDisposition disposition,
65       const GlobalRequestID& transferred_global_request_id,
66       bool should_replace_current_entry,
67       bool user_gesture) OVERRIDE;
68
69  private:
70   virtual ~NavigatorImpl() {}
71
72   // Navigates to the given entry, which must be the pending entry.  Private
73   // because all callers should use NavigateToPendingEntry.
74   bool NavigateToEntry(
75       RenderFrameHostImpl* render_frame_host,
76       const NavigationEntryImpl& entry,
77       NavigationController::ReloadType reload_type);
78
79   bool ShouldAssignSiteForURL(const GURL& url);
80
81   // The NavigationController that will keep track of session history for all
82   // RenderFrameHost objects using this NavigatorImpl.
83   // TODO(nasko): Move ownership of the NavigationController from
84   // WebContentsImpl to this class.
85   NavigationControllerImpl* controller_;
86
87   // Used to notify the object embedding this Navigator about navigation
88   // events. Can be NULL in tests.
89   NavigatorDelegate* delegate_;
90
91   // System time at which the current load was started.
92   base::TimeTicks current_load_start_;
93
94   DISALLOW_COPY_AND_ASSIGN(NavigatorImpl);
95 };
96
97 }  // namespace content
98
99 #endif  // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_