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_MHTML_ARCHIVER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_MHTML_ARCHIVER_H_ |
6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_MHTML_ARCHIVER_H_ | 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_MHTML_ARCHIVER_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <map> | 10 #include <map> |
9 #include <string> | 11 #include <string> |
10 | 12 |
11 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
14 #include "components/offline_pages/offline_page_archiver.h" | 17 #include "components/offline_pages/offline_page_archiver.h" |
15 | 18 |
16 namespace base { | 19 namespace base { |
17 class FilePath; | 20 class FilePath; |
18 class SingleThreadTaskRunner; | 21 class SingleThreadTaskRunner; |
19 } // namespace base | 22 } // namespace base |
20 | 23 |
21 namespace content { | 24 namespace content { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // Allows to overload the archiver for testing. | 61 // Allows to overload the archiver for testing. |
59 OfflinePageMHTMLArchiver(); | 62 OfflinePageMHTMLArchiver(); |
60 | 63 |
61 // Try to generate MHTML. | 64 // Try to generate MHTML. |
62 // Might be overridden for testing purpose. | 65 // Might be overridden for testing purpose. |
63 virtual void GenerateMHTML(const base::FilePath& archives_dir); | 66 virtual void GenerateMHTML(const base::FilePath& archives_dir); |
64 | 67 |
65 // Callback for Generating MHTML. | 68 // Callback for Generating MHTML. |
66 void OnGenerateMHTMLDone(const GURL& url, | 69 void OnGenerateMHTMLDone(const GURL& url, |
67 const base::FilePath& file_path, | 70 const base::FilePath& file_path, |
68 int64 file_size); | 71 int64_t file_size); |
69 | 72 |
70 // Sends the result of archiving a page to the client that requested archive | 73 // Sends the result of archiving a page to the client that requested archive |
71 // creation. | 74 // creation. |
72 void ReportResult(ArchiverResult result, | 75 void ReportResult(ArchiverResult result, |
73 const GURL& url, | 76 const GURL& url, |
74 const base::FilePath& file_path, | 77 const base::FilePath& file_path, |
75 int64 file_size); | 78 int64_t file_size); |
76 void ReportFailure(ArchiverResult result); | 79 void ReportFailure(ArchiverResult result); |
77 | 80 |
78 private: | 81 private: |
79 // Contents of the web page to be serialized. Not owned. | 82 // Contents of the web page to be serialized. Not owned. |
80 content::WebContents* web_contents_; | 83 content::WebContents* web_contents_; |
81 | 84 |
82 CreateArchiveCallback callback_; | 85 CreateArchiveCallback callback_; |
83 | 86 |
84 base::WeakPtrFactory<OfflinePageMHTMLArchiver> weak_ptr_factory_; | 87 base::WeakPtrFactory<OfflinePageMHTMLArchiver> weak_ptr_factory_; |
85 | 88 |
86 DISALLOW_COPY_AND_ASSIGN(OfflinePageMHTMLArchiver); | 89 DISALLOW_COPY_AND_ASSIGN(OfflinePageMHTMLArchiver); |
87 }; | 90 }; |
88 | 91 |
89 } // namespace offline_pages | 92 } // namespace offline_pages |
90 | 93 |
91 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_MHTML_ARCHIVER_H_ | 94 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_MHTML_ARCHIVER_H_ |
OLD | NEW |