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