| 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 COMPONENTS_OFFLINE_PAGES_CORE_OFFLINE_PAGE_ARCHIVER_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_OFFLINE_PAGE_ARCHIVER_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_CORE_OFFLINE_PAGE_ARCHIVER_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_CORE_OFFLINE_PAGE_ARCHIVER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // If archiver gets two consecutive requests to archive the same page (may be | 32 // If archiver gets two consecutive requests to archive the same page (may be |
| 33 // run in parallel) it can generate 2 different names for files and save the | 33 // run in parallel) it can generate 2 different names for files and save the |
| 34 // same page separately, as if these were 2 completely unrelated pages. It is up | 34 // same page separately, as if these were 2 completely unrelated pages. It is up |
| 35 // to the caller (e.g. OfflinePageModel) to make sure that situation like that | 35 // to the caller (e.g. OfflinePageModel) to make sure that situation like that |
| 36 // does not happen. | 36 // does not happen. |
| 37 // | 37 // |
| 38 // If the page is not completely loaded, it is up to the implementation of the | 38 // If the page is not completely loaded, it is up to the implementation of the |
| 39 // archiver whether to respond with ERROR_CONTENT_UNAVAILBLE, wait longer to | 39 // archiver whether to respond with ERROR_CONTENT_UNAVAILBLE, wait longer to |
| 40 // actually snapshot a complete page, or snapshot whatever is available at that | 40 // actually snapshot a complete page, or snapshot whatever is available at that |
| 41 // point in time (what the user sees). | 41 // point in time (what the user sees). |
| 42 // | |
| 43 // TODO(fgorski): Add ability to delete archive. | |
| 44 // TODO(fgorski): Add ability to check that archive exists. | |
| 45 // TODO(fgorski): Add ability to refresh an existing archive in one step. | |
| 46 // TODO(fgorski): Add ability to identify all of the archives in the directory, | |
| 47 // to enable to model to reconcile the archives. | |
| 48 class OfflinePageArchiver { | 42 class OfflinePageArchiver { |
| 49 public: | 43 public: |
| 50 // Results of the archive creation. | 44 // Results of the archive creation. |
| 51 enum class ArchiverResult { | 45 enum class ArchiverResult { |
| 52 SUCCESSFULLY_CREATED, // Archive created successfully. | 46 SUCCESSFULLY_CREATED, // Archive created successfully. |
| 53 ERROR_DEVICE_FULL, // Cannot save the archive - device is full. | 47 ERROR_DEVICE_FULL, // Cannot save the archive - device is full. |
| 54 ERROR_CANCELED, // Caller canceled the request. | 48 ERROR_CANCELED, // Caller canceled the request. |
| 55 ERROR_CONTENT_UNAVAILABLE, // Content to archive is not available. | 49 ERROR_CONTENT_UNAVAILABLE, // Content to archive is not available. |
| 56 ERROR_ARCHIVE_CREATION_FAILED, // Creation of archive failed. | 50 ERROR_ARCHIVE_CREATION_FAILED, // Creation of archive failed. |
| 57 ERROR_SECURITY_CERTIFICATE, // Page was loaded on secure connection, but | 51 ERROR_SECURITY_CERTIFICATE, // Page was loaded on secure connection, but |
| (...skipping 22 matching lines...) Expand all Loading... |
| 80 // |create_archive_params|. Once archive is created |callback| will be called | 74 // |create_archive_params|. Once archive is created |callback| will be called |
| 81 // with the result and additional information. | 75 // with the result and additional information. |
| 82 virtual void CreateArchive(const base::FilePath& archives_dir, | 76 virtual void CreateArchive(const base::FilePath& archives_dir, |
| 83 const CreateArchiveParams& create_archive_params, | 77 const CreateArchiveParams& create_archive_params, |
| 84 const CreateArchiveCallback& callback) = 0; | 78 const CreateArchiveCallback& callback) = 0; |
| 85 }; | 79 }; |
| 86 | 80 |
| 87 } // namespace offline_pages | 81 } // namespace offline_pages |
| 88 | 82 |
| 89 #endif // COMPONENTS_OFFLINE_PAGES_CORE_OFFLINE_PAGE_ARCHIVER_H_ | 83 #endif // COMPONENTS_OFFLINE_PAGES_CORE_OFFLINE_PAGE_ARCHIVER_H_ |
| OLD | NEW |