1a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 2a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// found in the LICENSE file. 4a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 5a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ 6a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#define CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ 7a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 8a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "base/memory/ref_counted.h" 95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "content/browser/frame_host/navigation_controller_impl.h" 10a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "content/browser/frame_host/navigator.h" 11a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "content/common/content_export.h" 12a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 1303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)struct FrameMsg_Navigate_Params; 1403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 15a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)namespace content { 16a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 17a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)class NavigationControllerImpl; 18a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)class NavigatorDelegate; 195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)struct LoadCommittedDetails; 20a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 21a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// This class is an implementation of Navigator, responsible for managing 22a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// navigations in regular browser tabs. 23a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)class CONTENT_EXPORT NavigatorImpl : public Navigator { 24a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) public: 25a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) NavigatorImpl(NavigationControllerImpl* navigation_controller, 26a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) NavigatorDelegate* delegate); 27a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 2803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) // Fills in |params| based on the content of |entry|. 2903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) static void MakeNavigateParams(const NavigationEntryImpl& entry, 3003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) const NavigationControllerImpl& controller, 3103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) NavigationController::ReloadType reload_type, 3203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) base::TimeTicks navigation_start, 3303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) FrameMsg_Navigate_Params* params); 3403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 35a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) // Navigator implementation. 365c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu virtual NavigationController* GetController() OVERRIDE; 37a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) virtual void DidStartProvisionalLoad(RenderFrameHostImpl* render_frame_host, 385f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) const GURL& url, 395f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) bool is_transition_navigation) OVERRIDE; 405d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual void DidFailProvisionalLoadWithError( 415d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) RenderFrameHostImpl* render_frame_host, 425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) 435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) OVERRIDE; 445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual void DidFailLoadWithError( 455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) RenderFrameHostImpl* render_frame_host, 465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const GURL& url, 475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int error_code, 485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const base::string16& error_description) OVERRIDE; 495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual void DidNavigate( 505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) RenderFrameHostImpl* render_frame_host, 515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const FrameHostMsg_DidCommitProvisionalLoad_Params& 525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) input_params) OVERRIDE; 535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual bool NavigateToPendingEntry( 545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) RenderFrameHostImpl* render_frame_host, 555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) NavigationController::ReloadType reload_type) OVERRIDE; 56a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual void RequestOpenURL(RenderFrameHostImpl* render_frame_host, 57a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) const GURL& url, 58a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) const Referrer& referrer, 59a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) WindowOpenDisposition disposition, 60a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) bool should_replace_current_entry, 61a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) bool user_gesture) OVERRIDE; 62a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual void RequestTransferURL( 63a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) RenderFrameHostImpl* render_frame_host, 64a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) const GURL& url, 65a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) const std::vector<GURL>& redirect_chain, 66a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) const Referrer& referrer, 671320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci ui::PageTransition page_transition, 68a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) WindowOpenDisposition disposition, 69a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) const GlobalRequestID& transferred_global_request_id, 70a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) bool should_replace_current_entry, 71a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) bool user_gesture) OVERRIDE; 7203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) virtual void CommitNavigation( 7303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) RenderFrameHostImpl* render_frame_host, 7403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) const NavigationBeforeCommitInfo& info) OVERRIDE; 75a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 76a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) private: 77a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) virtual ~NavigatorImpl() {} 78a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 79a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // Navigates to the given entry, which must be the pending entry. Private 80a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // because all callers should use NavigateToPendingEntry. 81a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) bool NavigateToEntry( 82a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) RenderFrameHostImpl* render_frame_host, 83a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) const NavigationEntryImpl& entry, 84a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) NavigationController::ReloadType reload_type); 85a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 865d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) bool ShouldAssignSiteForURL(const GURL& url); 875d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 8803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) void CheckWebUIRendererDoesNotDisplayNormalURL( 8903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) RenderFrameHostImpl* render_frame_host, 9003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) const GURL& url); 9103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 92a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) // The NavigationController that will keep track of session history for all 93a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) // RenderFrameHost objects using this NavigatorImpl. 94a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) // TODO(nasko): Move ownership of the NavigationController from 95a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) // WebContentsImpl to this class. 96a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) NavigationControllerImpl* controller_; 97a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 98a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) // Used to notify the object embedding this Navigator about navigation 99a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) // events. Can be NULL in tests. 100a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) NavigatorDelegate* delegate_; 101a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 102a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(NavigatorImpl); 103a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)}; 104a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 105a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)} // namespace content 106a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 107a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ 108