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