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