danakj | c492bf8 | 2020-09-09 20:02:44 | [diff] [blame^] | 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_RENDERER_HOST_NAVIGATION_CONTROLLER_DELEGATE_H_ |
| 6 | #define CONTENT_BROWSER_RENDERER_HOST_NAVIGATION_CONTROLLER_DELEGATE_H_ |
| 7 | |
| 8 | #include <stdint.h> |
| 9 | |
| 10 | #include <string> |
| 11 | #include "content/public/browser/invalidate_type.h" |
| 12 | #include "content/public/browser/navigation_controller.h" |
| 13 | #include "content/public/browser/navigation_details.h" |
| 14 | #include "third_party/blink/public/common/loader/previews_state.h" |
| 15 | |
| 16 | namespace content { |
| 17 | |
| 18 | struct LoadCommittedDetails; |
| 19 | class FrameTree; |
| 20 | class RenderViewHost; |
| 21 | class WebContents; |
| 22 | |
| 23 | // Interface for objects embedding a NavigationController to provide the |
| 24 | // functionality NavigationController needs. |
| 25 | // TODO(nasko): This interface should exist for short amount of time, while |
| 26 | // we transition navigation code from WebContents to Navigator. |
| 27 | class NavigationControllerDelegate { |
| 28 | public: |
| 29 | virtual ~NavigationControllerDelegate() {} |
| 30 | |
| 31 | // Duplicates of WebContents methods. |
| 32 | virtual RenderViewHost* GetRenderViewHost() = 0; |
| 33 | virtual const std::string& GetContentsMimeType() = 0; |
| 34 | virtual void NotifyNavigationStateChanged(InvalidateTypes changed_flags) = 0; |
| 35 | virtual void Stop() = 0; |
| 36 | virtual bool IsBeingDestroyed() = 0; |
| 37 | virtual bool CanOverscrollContent() const = 0; |
| 38 | |
| 39 | // Methods from WebContentsImpl that NavigationControllerImpl needs to |
| 40 | // call. |
| 41 | virtual FrameTree* GetFrameTree() = 0; |
| 42 | virtual void NotifyBeforeFormRepostWarningShow() = 0; |
| 43 | virtual void NotifyNavigationEntryCommitted( |
| 44 | const LoadCommittedDetails& load_details) = 0; |
| 45 | virtual void NotifyNavigationEntryChanged( |
| 46 | const EntryChangedDetails& change_details) = 0; |
| 47 | virtual void NotifyNavigationListPruned( |
| 48 | const PrunedDetails& pruned_details) = 0; |
| 49 | virtual void NotifyNavigationEntriesDeleted() = 0; |
| 50 | virtual void SetHistoryOffsetAndLength(int history_offset, |
| 51 | int history_length) = 0; |
| 52 | virtual void ActivateAndShowRepostFormWarningDialog() = 0; |
| 53 | virtual bool HasAccessedInitialDocument() = 0; |
| 54 | |
| 55 | // Returns whether URLs for aborted browser-initiated navigations should be |
| 56 | // preserved in the omnibox. Defaults to false. |
| 57 | virtual bool ShouldPreserveAbortedURLs() = 0; |
| 58 | |
| 59 | // This method is needed, since we are no longer guaranteed that the |
| 60 | // embedder for NavigationController will be a WebContents object. |
| 61 | virtual WebContents* GetWebContents() = 0; |
| 62 | |
| 63 | virtual bool IsHidden() = 0; |
| 64 | |
| 65 | virtual void UpdateOverridingUserAgent() = 0; |
| 66 | }; |
| 67 | |
| 68 | } // namespace content |
| 69 | |
| 70 | #endif // CONTENT_BROWSER_RENDERER_HOST_NAVIGATION_CONTROLLER_DELEGATE_H_ |