navigation_controller_delegate.h revision 6e8cce623b6e4fe0c9e4af605d675dd9d0338c38
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_NAVIGATION_CONTROLLER_DELEGATE_H_
6#define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_DELEGATE_H_
7
8#include <string>
9#include "content/public/browser/invalidate_type.h"
10#include "content/public/browser/navigation_controller.h"
11#include "content/public/browser/navigation_details.h"
12
13namespace content {
14
15struct LoadCommittedDetails;
16struct LoadNotificationDetails;
17struct NativeWebKeyboardEvent;
18class InterstitialPage;
19class InterstitialPageImpl;
20class RenderFrameHost;
21class RenderViewHost;
22class SiteInstance;
23class WebContents;
24class WebContentsDelegate;
25
26// Interface for objects embedding a NavigationController to provide the
27// functionality NavigationController needs.
28// TODO(nasko): This interface should exist for short amount of time, while
29// we transition navigation code from WebContents to Navigator.
30class NavigationControllerDelegate {
31 public:
32  virtual ~NavigationControllerDelegate() {}
33
34  // Duplicates of WebContents methods.
35  virtual RenderViewHost* GetRenderViewHost() const = 0;
36  virtual InterstitialPage* GetInterstitialPage() const = 0;
37  virtual const std::string& GetContentsMimeType() const = 0;
38  virtual void NotifyNavigationStateChanged(InvalidateTypes changed_flags) = 0;
39  virtual void Stop() = 0;
40  virtual SiteInstance* GetPendingSiteInstance() const = 0;
41  virtual int32 GetMaxPageID() = 0;
42  virtual int32 GetMaxPageIDForSiteInstance(SiteInstance* site_instance) = 0;
43  virtual bool IsLoading() const = 0;
44  virtual bool IsBeingDestroyed() const = 0;
45  virtual bool CanOverscrollContent() const = 0;
46
47  // Methods from WebContentsImpl that NavigationControllerImpl needs to
48  // call.
49  virtual void NotifyBeforeFormRepostWarningShow() = 0;
50  virtual void NotifyNavigationEntryCommitted(
51      const LoadCommittedDetails& load_details) = 0;
52  virtual bool NavigateToPendingEntry(
53      NavigationController::ReloadType reload_type) = 0;
54  virtual void SetHistoryLengthAndPrune(
55      const SiteInstance* site_instance,
56      int merge_history_length,
57      int32 minimum_page_id) = 0;
58  virtual void CopyMaxPageIDsFrom(WebContents* web_contents) = 0;
59  virtual void UpdateMaxPageID(int32 page_id) = 0;
60  virtual void UpdateMaxPageIDForSiteInstance(SiteInstance* site_instance,
61                                              int32 page_id) = 0;
62  virtual void ActivateAndShowRepostFormWarningDialog() = 0;
63  virtual bool HasAccessedInitialDocument() = 0;
64
65  // This method is needed, since we are no longer guaranteed that the
66  // embedder for NavigationController will be a WebContents object.
67  virtual WebContents* GetWebContents() = 0;
68
69  // Methods needed by InterstitialPageImpl.
70  virtual bool IsHidden() = 0;
71  virtual void RenderFrameForInterstitialPageCreated(
72      RenderFrameHost* render_frame_host) = 0;
73  virtual void AttachInterstitialPage(
74      InterstitialPageImpl* interstitial_page) = 0;
75  virtual void DetachInterstitialPage() = 0;
76  virtual void SetIsLoading(RenderViewHost* render_view_host,
77                            bool is_loading,
78                            bool to_different_document,
79                            LoadNotificationDetails* details) = 0;
80};
81
82}  // namespace content
83
84#endif  // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_DELEGATE_H_
85