OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_OFFLINE_PAGE_UTILS_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_ |
6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_ | 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "components/offline_pages/core/offline_page_model.h" | 11 #include "components/offline_pages/core/offline_page_model.h" |
| 12 #include "components/offline_pages/core/offline_page_types.h" |
12 #include "url/gurl.h" | 13 #include "url/gurl.h" |
13 | 14 |
| 15 namespace base { |
| 16 class Time; |
| 17 } |
| 18 |
14 namespace content { | 19 namespace content { |
15 class BrowserContext; | 20 class BrowserContext; |
16 class WebContents; | 21 class WebContents; |
17 } | 22 } |
18 | 23 |
19 namespace offline_pages { | 24 namespace offline_pages { |
20 struct OfflinePageHeader; | 25 struct OfflinePageHeader; |
21 struct OfflinePageItem; | 26 struct OfflinePageItem; |
22 | 27 |
23 class OfflinePageUtils { | 28 class OfflinePageUtils { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // different from the one rendered in |web_contents|. | 112 // different from the one rendered in |web_contents|. |
108 static void ScheduleDownload(content::WebContents* web_contents, | 113 static void ScheduleDownload(content::WebContents* web_contents, |
109 const std::string& name_space, | 114 const std::string& name_space, |
110 const GURL& url, | 115 const GURL& url, |
111 DownloadUIActionFlags ui_action); | 116 DownloadUIActionFlags ui_action); |
112 | 117 |
113 // Determines if offline page download should be triggered based on MIME type | 118 // Determines if offline page download should be triggered based on MIME type |
114 // of download resource. | 119 // of download resource. |
115 static bool CanDownloadAsOfflinePage(const GURL& url, | 120 static bool CanDownloadAsOfflinePage(const GURL& url, |
116 const std::string& contents_mime_type); | 121 const std::string& contents_mime_type); |
| 122 |
| 123 // Get total size of cache offline pages for a given time range. Returns false |
| 124 // when an OfflinePageModel cannot be acquired using the |browser_context|, or |
| 125 // the time range is invalid (|begin_time| > |end_time|). Also returning false |
| 126 // means no callback should be expected. |
| 127 static bool GetCachedOfflinePageSizeBetween( |
| 128 content::BrowserContext* browser_context, |
| 129 const SizeInBytesCallback& callback, |
| 130 const base::Time& begin_time, |
| 131 const base::Time& end_time); |
117 }; | 132 }; |
118 | 133 |
119 } // namespace offline_pages | 134 } // namespace offline_pages |
120 | 135 |
121 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_ | 136 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_UTILS_H_ |
OLD | NEW |