| 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_PRERENDERING_LOADER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_ |
| 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_ | 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 // PrerenderAdapter::Observer implementation: | 73 // PrerenderAdapter::Observer implementation: |
| 74 void OnPrerenderStopLoading() override; | 74 void OnPrerenderStopLoading() override; |
| 75 void OnPrerenderDomContentLoaded() override; | 75 void OnPrerenderDomContentLoaded() override; |
| 76 void OnPrerenderStop() override; | 76 void OnPrerenderStop() override; |
| 77 void OnPrerenderNetworkBytesChanged(int64_t bytes) override; | 77 void OnPrerenderNetworkBytesChanged(int64_t bytes) override; |
| 78 | 78 |
| 79 // SnapshotController::Client implementation: | 79 // SnapshotController::Client implementation: |
| 80 void StartSnapshot() override; | 80 void StartSnapshot() override; |
| 81 | 81 |
| 82 // Returns true if the lowbar of snapshotting a page is met. |
| 83 virtual bool IsLowbarMet(); |
| 84 |
| 82 private: | 85 private: |
| 83 // State of the loader (only one request may be active at a time). | 86 // State of the loader (only one request may be active at a time). |
| 84 enum class State { | 87 enum class State { |
| 85 IDLE, // No active load request. | 88 IDLE, // No active load request. |
| 86 PENDING, // Load request is pending the start of prerendering. | 89 PENDING, // Load request is pending the start of prerendering. |
| 87 LOADING, // Loading in progress. | 90 LOADING, // Loading in progress. |
| 88 LOADED, // Loaded and now waiting for requestor to StopLoading(). | 91 LOADED, // Loaded and now waiting for requestor to StopLoading(). |
| 89 }; | 92 }; |
| 90 | 93 |
| 91 // Handles some event/signal that the load request has succeeded or failed. | 94 // Handles some event/signal that the load request has succeeded or failed. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 117 // storage namespace for rendering. This will NOT have the loaded page. | 120 // storage namespace for rendering. This will NOT have the loaded page. |
| 118 std::unique_ptr<content::WebContents> session_contents_; | 121 std::unique_ptr<content::WebContents> session_contents_; |
| 119 | 122 |
| 120 // Callback to call when the active load request completes, fails, or is | 123 // Callback to call when the active load request completes, fails, or is |
| 121 // canceled. | 124 // canceled. |
| 122 LoadPageCallback load_done_callback_; | 125 LoadPageCallback load_done_callback_; |
| 123 | 126 |
| 124 // Callback to call when we know more bytes have loaded from the network. | 127 // Callback to call when we know more bytes have loaded from the network. |
| 125 ProgressCallback progress_callback_; | 128 ProgressCallback progress_callback_; |
| 126 | 129 |
| 130 // True if the lowbar of snapshotting a page is met. |
| 131 bool is_lowbar_met_; |
| 132 |
| 127 DISALLOW_COPY_AND_ASSIGN(PrerenderingLoader); | 133 DISALLOW_COPY_AND_ASSIGN(PrerenderingLoader); |
| 128 }; | 134 }; |
| 129 | 135 |
| 130 } // namespace offline_pages | 136 } // namespace offline_pages |
| 131 | 137 |
| 132 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_ | 138 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_ |
| OLD | NEW |