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 | |
danakj | c492bf8 | 2020-09-09 20:02:44 | [diff] [blame] | 10 | #include "content/public/browser/invalidate_type.h" |
| 11 | #include "content/public/browser/navigation_controller.h" |
| 12 | #include "content/public/browser/navigation_details.h" |
| 13 | #include "third_party/blink/public/common/loader/previews_state.h" |
| 14 | |
| 15 | namespace content { |
| 16 | |
| 17 | struct LoadCommittedDetails; |
danakj | c492bf8 | 2020-09-09 20:02:44 | [diff] [blame] | 18 | class WebContents; |
| 19 | |
| 20 | // Interface for objects embedding a NavigationController to provide the |
| 21 | // functionality NavigationController needs. |
danakj | c492bf8 | 2020-09-09 20:02:44 | [diff] [blame] | 22 | class NavigationControllerDelegate { |
| 23 | public: |
| 24 | virtual ~NavigationControllerDelegate() {} |
| 25 | |
| 26 | // Duplicates of WebContents methods. |
danakj | c492bf8 | 2020-09-09 20:02:44 | [diff] [blame] | 27 | virtual void NotifyNavigationStateChanged(InvalidateTypes changed_flags) = 0; |
danakj | c492bf8 | 2020-09-09 20:02:44 | [diff] [blame] | 28 | virtual bool IsBeingDestroyed() = 0; |
danakj | c492bf8 | 2020-09-09 20:02:44 | [diff] [blame] | 29 | |
| 30 | // Methods from WebContentsImpl that NavigationControllerImpl needs to |
Matt Falkenhagen | 548ed156 | 2021-07-06 01:38:26 | [diff] [blame^] | 31 | // call. NavigationControllerImpl cannot call them directly because |
| 32 | // renderer_host/ cannot depend on WebContents. |
danakj | c492bf8 | 2020-09-09 20:02:44 | [diff] [blame] | 33 | virtual void NotifyBeforeFormRepostWarningShow() = 0; |
| 34 | virtual void NotifyNavigationEntryCommitted( |
| 35 | const LoadCommittedDetails& load_details) = 0; |
| 36 | virtual void NotifyNavigationEntryChanged( |
| 37 | const EntryChangedDetails& change_details) = 0; |
| 38 | virtual void NotifyNavigationListPruned( |
| 39 | const PrunedDetails& pruned_details) = 0; |
| 40 | virtual void NotifyNavigationEntriesDeleted() = 0; |
danakj | c492bf8 | 2020-09-09 20:02:44 | [diff] [blame] | 41 | virtual void ActivateAndShowRepostFormWarningDialog() = 0; |
danakj | c492bf8 | 2020-09-09 20:02:44 | [diff] [blame] | 42 | |
| 43 | // Returns whether URLs for aborted browser-initiated navigations should be |
| 44 | // preserved in the omnibox. Defaults to false. |
| 45 | virtual bool ShouldPreserveAbortedURLs() = 0; |
| 46 | |
Matt Falkenhagen | 548ed156 | 2021-07-06 01:38:26 | [diff] [blame^] | 47 | // TODO(crbug.com/1225205): Remove this. It is a layering violation as |
| 48 | // renderer_host/ cannot depend on WebContents. |
| 49 | virtual WebContents* DeprecatedGetWebContents() = 0; |
danakj | c492bf8 | 2020-09-09 20:02:44 | [diff] [blame] | 50 | |
danakj | c492bf8 | 2020-09-09 20:02:44 | [diff] [blame] | 51 | virtual void UpdateOverridingUserAgent() = 0; |
| 52 | }; |
| 53 | |
| 54 | } // namespace content |
| 55 | |
| 56 | #endif // CONTENT_BROWSER_RENDERER_HOST_NAVIGATION_CONTROLLER_DELEGATE_H_ |