Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: chrome/browser/android/offline_pages/background_loader_offliner.h

Issue 2822023002: [Offline pages]: Move logic for whether to consider the DocumentAvailableInMainFrame signal to the … (Closed)
Patch Set: test fix: replace snapshot controller at the right place Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/background_loader_offliner.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
51 void DocumentAvailableInMainFrame() override; 51 void DocumentAvailableInMainFrame() override;
52 void DocumentOnLoadCompletedInMainFrame() override; 52 void DocumentOnLoadCompletedInMainFrame() override;
53 void RenderProcessGone(base::TerminationStatus status) override; 53 void RenderProcessGone(base::TerminationStatus status) override;
54 void WebContentsDestroyed() override; 54 void WebContentsDestroyed() override;
55 void DidFinishNavigation( 55 void DidFinishNavigation(
56 content::NavigationHandle* navigation_handle) override; 56 content::NavigationHandle* navigation_handle) override;
57 57
58 // SnapshotController::Client implementation. 58 // SnapshotController::Client implementation.
59 void StartSnapshot() override; 59 void StartSnapshot() override;
60 60
61 void SetPageDelayForTest(long delay_ms); 61 void SetSnapshotControllerForTest(
62 std::unique_ptr<SnapshotController> controller);
62 void OnNetworkBytesChanged(int64_t bytes); 63 void OnNetworkBytesChanged(int64_t bytes);
63 64
64 protected: 65 protected:
65 // Called to reset internal loader and observer state. 66 // Called to reset internal loader and observer state.
66 virtual void ResetState(); 67 virtual void ResetState();
67 68
68 private: 69 private:
69 friend class TestBackgroundLoaderOffliner; 70 friend class TestBackgroundLoaderOffliner;
70 71
71 enum SaveState { NONE, SAVING, DELETE_AFTER_SAVE }; 72 enum SaveState { NONE, SAVING, DELETE_AFTER_SAVE };
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 ProgressCallback progress_callback_; 105 ProgressCallback progress_callback_;
105 // ApplicationStatusListener to monitor if Chrome moves to the foreground. 106 // ApplicationStatusListener to monitor if Chrome moves to the foreground.
106 std::unique_ptr<base::android::ApplicationStatusListener> app_listener_; 107 std::unique_ptr<base::android::ApplicationStatusListener> app_listener_;
107 // Whether we are on a low-end device. 108 // Whether we are on a low-end device.
108 bool is_low_end_device_; 109 bool is_low_end_device_;
109 110
110 // Save state. 111 // Save state.
111 SaveState save_state_; 112 SaveState save_state_;
112 // Page load state. 113 // Page load state.
113 PageLoadState page_load_state_; 114 PageLoadState page_load_state_;
114 // Seconds to delay before taking snapshot.
115 long page_delay_ms_;
116 // Network bytes loaded. 115 // Network bytes loaded.
117 int64_t network_bytes_; 116 int64_t network_bytes_;
118 // Whether the low bar of snapshot quality has been met. 117 // Whether the low bar of snapshot quality has been met.
119 bool is_low_bar_met_; 118 bool is_low_bar_met_;
120 // Whether the snapshot is on the last retry. 119 // Whether the snapshot is on the last retry.
121 bool did_snapshot_on_last_retry_; 120 bool did_snapshot_on_last_retry_;
122 121
123 // Time in ticks of when we start loading the page. 122 // Time in ticks of when we start loading the page.
124 base::TimeTicks load_start_time_; 123 base::TimeTicks load_start_time_;
125 124
126 // Saves loading signals. 125 // Saves loading signals.
127 // TODO(petewil): We will be replacing this with the new snapshot controller. 126 // TODO(petewil): We will be replacing this with the new snapshot controller.
128 base::DictionaryValue signal_data_; 127 base::DictionaryValue signal_data_;
129 128
130 // Callback for cancel. 129 // Callback for cancel.
131 CancelCallback cancel_callback_; 130 CancelCallback cancel_callback_;
132 131
133 base::WeakPtrFactory<BackgroundLoaderOffliner> weak_ptr_factory_; 132 base::WeakPtrFactory<BackgroundLoaderOffliner> weak_ptr_factory_;
134 DISALLOW_COPY_AND_ASSIGN(BackgroundLoaderOffliner); 133 DISALLOW_COPY_AND_ASSIGN(BackgroundLoaderOffliner);
135 }; 134 };
136 135
137 } // namespace offline_pages 136 } // namespace offline_pages
138 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ 137 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/background_loader_offliner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698