| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 virtual bool LoadPage(const GURL& url, const LoadPageCallback& callback); | 46 virtual bool LoadPage(const GURL& url, const LoadPageCallback& callback); |
| 47 | 47 |
| 48 // Stops (completes or cancels) the load request. Must be called when | 48 // Stops (completes or cancels) the load request. Must be called when |
| 49 // LoadPageCallback is done with consuming the contents. May be called | 49 // LoadPageCallback is done with consuming the contents. May be called |
| 50 // prior to LoadPageCallback in order to cancel the current request (in | 50 // prior to LoadPageCallback in order to cancel the current request (in |
| 51 // which case the callback will not be run). | 51 // which case the callback will not be run). |
| 52 // This loader should also be responsible for stopping offline | 52 // This loader should also be responsible for stopping offline |
| 53 // prerenders when Chrome is transitioned to foreground. | 53 // prerenders when Chrome is transitioned to foreground. |
| 54 virtual void StopLoading(); | 54 virtual void StopLoading(); |
| 55 | 55 |
| 56 // Returns whether prerendering is possible for this device's configuration | |
| 57 // and the browser context. | |
| 58 virtual bool CanPrerender(); | |
| 59 | |
| 60 // Returns whether the loader is idle and able to accept new LoadPage | 56 // Returns whether the loader is idle and able to accept new LoadPage |
| 61 // request. | 57 // request. |
| 62 virtual bool IsIdle(); | 58 virtual bool IsIdle(); |
| 63 | 59 |
| 64 // Returns whether the loader has successfully loaded web contents. | 60 // Returns whether the loader has successfully loaded web contents. |
| 65 // Note that |StopLoading()| should be used to clear this state once | 61 // Note that |StopLoading()| should be used to clear this state once |
| 66 // the loaded web contents are no longer needed. | 62 // the loaded web contents are no longer needed. |
| 67 virtual bool IsLoaded(); | 63 virtual bool IsLoaded(); |
| 68 | 64 |
| 69 // Overrides the prerender stack adapter for unit testing. | 65 // Overrides the prerender stack adapter for unit testing. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // Callback to call when the active load request completes, fails, or is | 115 // Callback to call when the active load request completes, fails, or is |
| 120 // canceled. | 116 // canceled. |
| 121 LoadPageCallback callback_; | 117 LoadPageCallback callback_; |
| 122 | 118 |
| 123 DISALLOW_COPY_AND_ASSIGN(PrerenderingLoader); | 119 DISALLOW_COPY_AND_ASSIGN(PrerenderingLoader); |
| 124 }; | 120 }; |
| 125 | 121 |
| 126 } // namespace offline_pages | 122 } // namespace offline_pages |
| 127 | 123 |
| 128 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_ | 124 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_ |
| OLD | NEW |