OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_ |
6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 // content::WebContentsObserver | 36 // content::WebContentsObserver |
37 void DidFinishNavigation( | 37 void DidFinishNavigation( |
38 content::NavigationHandle* navigation_handle) override; | 38 content::NavigationHandle* navigation_handle) override; |
39 void DocumentAvailableInMainFrame() override; | 39 void DocumentAvailableInMainFrame() override; |
40 void DocumentOnLoadCompletedInMainFrame() override; | 40 void DocumentOnLoadCompletedInMainFrame() override; |
41 | 41 |
42 // SnapshotController::Client | 42 // SnapshotController::Client |
43 void StartSnapshot() override; | 43 void StartSnapshot() override; |
44 | 44 |
45 // Test support. | |
46 // A factory that supplies the instances of an OfflinePageArchiver. | |
47 // This is used for testing, where we want to use a specific mock. | |
48 class TestArchiveFactory { | |
49 public: | |
50 virtual ~TestArchiveFactory() {} | |
51 virtual std::unique_ptr<OfflinePageArchiver> CreateArchiver( | |
52 content::WebContents* web_contents) = 0; | |
53 }; | |
54 | |
55 | |
56 // Delegate that is used by RecentTabHelper to get external dependencies. | 45 // Delegate that is used by RecentTabHelper to get external dependencies. |
57 // Default implementation lives in .cc file, while tests provide an override. | 46 // Default implementation lives in .cc file, while tests provide an override. |
58 class Delegate { | 47 class Delegate { |
59 public: | 48 public: |
60 virtual ~Delegate() {} | 49 virtual ~Delegate() {} |
61 virtual std::unique_ptr<OfflinePageArchiver> CreatePageArchiver( | 50 virtual std::unique_ptr<OfflinePageArchiver> CreatePageArchiver( |
62 content::WebContents* web_contents) = 0; | 51 content::WebContents* web_contents) = 0; |
63 virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() = 0; | 52 virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() = 0; |
64 // There is no expectations that tab_id is always present. | 53 // There is no expectations that tab_id is always present. |
65 virtual bool GetTabId(content::WebContents* web_contents, int* tab_id) = 0; | 54 virtual bool GetTabId(content::WebContents* web_contents, int* tab_id) = 0; |
(...skipping 29 matching lines...) Expand all Loading... |
95 | 84 |
96 std::unique_ptr<Delegate> delegate_; | 85 std::unique_ptr<Delegate> delegate_; |
97 | 86 |
98 base::WeakPtrFactory<RecentTabHelper> weak_ptr_factory_; | 87 base::WeakPtrFactory<RecentTabHelper> weak_ptr_factory_; |
99 | 88 |
100 DISALLOW_COPY_AND_ASSIGN(RecentTabHelper); | 89 DISALLOW_COPY_AND_ASSIGN(RecentTabHelper); |
101 }; | 90 }; |
102 | 91 |
103 } // namespace offline_pages | 92 } // namespace offline_pages |
104 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_ | 93 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_ |
OLD | NEW |