Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 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 IOS_WEB_NAVIGATION_WK_BASED_NAVIGATION_MANAGER_IMPL_H_ | |
| 6 #define IOS_WEB_NAVIGATION_WK_BASED_NAVIGATION_MANAGER_IMPL_H_ | |
| 7 | |
| 8 #include <stddef.h> | |
| 9 | |
| 10 #include <memory> | |
| 11 #include <vector> | |
| 12 | |
| 13 #import "base/mac/scoped_nsobject.h" | |
| 14 #include "base/macros.h" | |
| 15 #import "ios/web/navigation/navigation_item_impl.h" | |
| 16 #import "ios/web/navigation/navigation_manager_impl.h" | |
| 17 #include "ios/web/public/reload_type.h" | |
| 18 #include "ui/base/page_transition_types.h" | |
| 19 #include "url/gurl.h" | |
| 20 | |
| 21 namespace web { | |
| 22 class BrowserState; | |
| 23 class NavigationItem; | |
| 24 struct Referrer; | |
| 25 class NavigationManagerDelegate; | |
| 26 class SessionStorageBuilder; | |
| 27 | |
| 28 // WKBackForwardList based implementation of NavigationManagerImpl. | |
|
Eugene But (OOO till 7-30)
2017/06/29 01:48:19
Do you want to provide more details in the comment
danyao
2017/06/29 16:05:25
Done.
| |
| 29 class WKBasedNavigationManagerImpl : public NavigationManagerImpl { | |
| 30 public: | |
| 31 WKBasedNavigationManagerImpl(); | |
| 32 ~WKBasedNavigationManagerImpl() override; | |
| 33 | |
| 34 // NavigationManagerImpl: | |
| 35 void SetDelegate(NavigationManagerDelegate* delegate) override; | |
| 36 void SetBrowserState(BrowserState* browser_state) override; | |
| 37 void SetSessionController(CRWSessionController* session_controller) override; | |
| 38 void InitializeSession() override; | |
| 39 void ReplaceSessionHistory(std::vector<std::unique_ptr<NavigationItem>> items, | |
| 40 int current_index) override; | |
| 41 void OnNavigationItemsPruned(size_t pruned_item_count) override; | |
| 42 void OnNavigationItemChanged() override; | |
| 43 void OnNavigationItemCommitted() override; | |
| 44 CRWSessionController* GetSessionController() const override; | |
| 45 void AddTransientItem(const GURL& url) override; | |
| 46 void AddPendingItem( | |
| 47 const GURL& url, | |
| 48 const web::Referrer& referrer, | |
| 49 ui::PageTransition navigation_type, | |
| 50 NavigationInitiationType initiation_type, | |
| 51 UserAgentOverrideOption user_agent_override_option) override; | |
| 52 void CommitPendingItem() override; | |
| 53 std::unique_ptr<std::vector<BrowserURLRewriter::URLRewriter>> | |
| 54 GetTransientURLRewriters() override; | |
| 55 void RemoveTransientURLRewriters() override; | |
| 56 int GetIndexForOffset(int offset) const override; | |
| 57 int GetPreviousItemIndex() const override; | |
| 58 | |
| 59 // NavigationManager: | |
| 60 BrowserState* GetBrowserState() const override; | |
| 61 WebState* GetWebState() const override; | |
| 62 NavigationItem* GetVisibleItem() const override; | |
| 63 NavigationItem* GetLastCommittedItem() const override; | |
| 64 NavigationItem* GetPendingItem() const override; | |
| 65 NavigationItem* GetTransientItem() const override; | |
| 66 void DiscardNonCommittedItems() override; | |
| 67 void LoadURLWithParams(const NavigationManager::WebLoadParams&) override; | |
| 68 void AddTransientURLRewriter( | |
| 69 BrowserURLRewriter::URLRewriter rewriter) override; | |
| 70 int GetItemCount() const override; | |
| 71 NavigationItem* GetItemAtIndex(size_t index) const override; | |
| 72 int GetIndexOfItem(const NavigationItem* item) const override; | |
| 73 int GetPendingItemIndex() const override; | |
| 74 int GetLastCommittedItemIndex() const override; | |
| 75 bool RemoveItemAtIndex(int index) override; | |
| 76 bool CanGoBack() const override; | |
| 77 bool CanGoForward() const override; | |
| 78 bool CanGoToOffset(int offset) const override; | |
| 79 void GoBack() override; | |
| 80 void GoForward() override; | |
| 81 void GoToIndex(int index) override; | |
| 82 void Reload(ReloadType reload_type, bool check_for_reposts) override; | |
| 83 NavigationItemList GetBackwardItems() const override; | |
| 84 NavigationItemList GetForwardItems() const override; | |
| 85 void CopyStateFromAndPrune(const NavigationManager* source) override; | |
| 86 bool CanPruneAllButLastCommittedItem() const override; | |
| 87 | |
| 88 private: | |
| 89 // The SessionStorageBuilder functions require access to private variables of | |
| 90 // NavigationManagerImpl. | |
| 91 friend SessionStorageBuilder; | |
| 92 | |
| 93 // NavigationManagerImpl methods used by SessionStorageBuilder. | |
| 94 NavigationItemImpl* GetNavigationItemImplAtIndex(size_t index) const override; | |
| 95 | |
| 96 // The primary delegate for this manager. | |
| 97 NavigationManagerDelegate* delegate_; | |
| 98 | |
| 99 // The BrowserState that is associated with this instance. | |
| 100 BrowserState* browser_state_; | |
| 101 | |
| 102 // List of transient url rewriters added by |AddTransientURLRewriter()|. | |
| 103 std::unique_ptr<std::vector<BrowserURLRewriter::URLRewriter>> | |
| 104 transient_url_rewriters_; | |
| 105 | |
| 106 DISALLOW_COPY_AND_ASSIGN(WKBasedNavigationManagerImpl); | |
| 107 }; | |
| 108 | |
| 109 } // namespace web | |
| 110 | |
| 111 #endif // IOS_WEB_NAVIGATION_WK_BASED_NAVIGATION_MANAGER_IMPL_H_ | |
| OLD | NEW |