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