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_BACKGROUND_LOADER_OFFLINER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ |
6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ | 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/android/application_status_listener.h" | 10 #include "base/android/application_status_listener.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // Called to reset internal loader and observer state. | 51 // Called to reset internal loader and observer state. |
52 virtual void ResetState(); | 52 virtual void ResetState(); |
53 | 53 |
54 private: | 54 private: |
55 friend class TestBackgroundLoaderOffliner; | 55 friend class TestBackgroundLoaderOffliner; |
56 | 56 |
57 enum SaveState { NONE, SAVING, DELETE_AFTER_SAVE }; | 57 enum SaveState { NONE, SAVING, DELETE_AFTER_SAVE }; |
58 enum PageLoadState { SUCCESS, RETRIABLE, NONRETRIABLE }; | 58 enum PageLoadState { SUCCESS, RETRIABLE, NONRETRIABLE }; |
59 | 59 |
60 // Called when the page has been saved. | 60 // Called when the page has been saved. |
61 void OnPageSaved(SavePageResult save_result, int64_t offline_id); | 61 void OnPageSaved(SavePageResult save_result, |
| 62 int64_t offline_id, |
| 63 const base::FilePath& saved_filepath); |
62 | 64 |
63 // Called when application state has changed. | 65 // Called when application state has changed. |
64 void OnApplicationStateChange( | 66 void OnApplicationStateChange( |
65 base::android::ApplicationState application_state); | 67 base::android::ApplicationState application_state); |
66 | 68 |
67 std::unique_ptr<background_loader::BackgroundLoaderContents> loader_; | 69 std::unique_ptr<background_loader::BackgroundLoaderContents> loader_; |
68 // Not owned. | 70 // Not owned. |
69 content::BrowserContext* browser_context_; | 71 content::BrowserContext* browser_context_; |
70 // Not owned. | 72 // Not owned. |
71 OfflinePageModel* offline_page_model_; | 73 OfflinePageModel* offline_page_model_; |
72 // Tracks pending request, if any. | 74 // Tracks pending request, if any. |
73 std::unique_ptr<SavePageRequest> pending_request_; | 75 std::unique_ptr<SavePageRequest> pending_request_; |
74 // Callback when pending request completes. | 76 // Callback when pending request completes. |
75 CompletionCallback completion_callback_; | 77 CompletionCallback completion_callback_; |
76 // ApplicationStatusListener to monitor if Chrome moves to the foreground. | 78 // ApplicationStatusListener to monitor if Chrome moves to the foreground. |
77 std::unique_ptr<base::android::ApplicationStatusListener> app_listener_; | 79 std::unique_ptr<base::android::ApplicationStatusListener> app_listener_; |
78 // Whether we are on a low-end device. | 80 // Whether we are on a low-end device. |
79 bool is_low_end_device_; | 81 bool is_low_end_device_; |
80 // Save state. | 82 // Save state. |
81 SaveState save_state_; | 83 SaveState save_state_; |
82 // Page load state. | 84 // Page load state. |
83 PageLoadState page_load_state_; | 85 PageLoadState page_load_state_; |
84 | 86 |
85 base::WeakPtrFactory<BackgroundLoaderOffliner> weak_ptr_factory_; | 87 base::WeakPtrFactory<BackgroundLoaderOffliner> weak_ptr_factory_; |
86 DISALLOW_COPY_AND_ASSIGN(BackgroundLoaderOffliner); | 88 DISALLOW_COPY_AND_ASSIGN(BackgroundLoaderOffliner); |
87 }; | 89 }; |
88 | 90 |
89 } // namespace offline_pages | 91 } // namespace offline_pages |
90 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ | 92 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ |
OLD | NEW |