| 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_TEST_ARCHIVER_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_OFFLINE_PAGE_TEST_ARCHIVER_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_CORE_OFFLINE_PAGE_TEST_ARCHIVER_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_CORE_OFFLINE_PAGE_TEST_ARCHIVER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 #include "components/offline_pages/core/offline_page_archiver.h" | 15 #include "components/offline_pages/core/offline_page_archiver.h" |
| 16 | 16 |
| 17 class GURL; | 17 class GURL; |
| 18 | 18 |
| 19 namespace base { | 19 namespace base { |
| 20 class FilePath; | 20 class FilePath; |
| 21 } // namespace | 21 } // namespace |
| 22 | 22 |
| 23 namespace offline_pages { | 23 namespace offline_pages { |
| 24 | 24 |
| 25 // A test archiver class, which allows for testing offline pages without a need | 25 // A test archiver class, which allows for testing offline pages without a need |
| 26 // for an actual web contents. | 26 // for an actual web contents. |
| 27 class OfflinePageTestArchiver : public OfflinePageArchiver { | 27 class OfflinePageTestArchiver : public OfflinePageArchiver { |
| 28 public: | 28 public: |
| 29 // TODO(fgorski): Try refactoring the observer out and replace it with a | |
| 30 // callback, or completely remove the call to |SetLastPathCreatedByArchiver|. | |
| 31 class Observer { | 29 class Observer { |
| 32 public: | 30 public: |
| 33 virtual ~Observer() {} | 31 virtual ~Observer() {} |
| 34 virtual void SetLastPathCreatedByArchiver( | 32 virtual void SetLastPathCreatedByArchiver( |
| 35 const base::FilePath& file_path) = 0; | 33 const base::FilePath& file_path) = 0; |
| 36 }; | 34 }; |
| 37 | 35 |
| 38 OfflinePageTestArchiver( | 36 OfflinePageTestArchiver( |
| 39 Observer* observer, | 37 Observer* observer, |
| 40 const GURL& url, | 38 const GURL& url, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 base::string16 result_title_; | 80 base::string16 result_title_; |
| 83 CreateArchiveCallback callback_; | 81 CreateArchiveCallback callback_; |
| 84 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 82 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 85 | 83 |
| 86 DISALLOW_COPY_AND_ASSIGN(OfflinePageTestArchiver); | 84 DISALLOW_COPY_AND_ASSIGN(OfflinePageTestArchiver); |
| 87 }; | 85 }; |
| 88 | 86 |
| 89 } // namespace offline_pages | 87 } // namespace offline_pages |
| 90 | 88 |
| 91 #endif // COMPONENTS_OFFLINE_PAGES_CORE_OFFLINE_PAGE_TEST_ARCHIVER_H_ | 89 #endif // COMPONENTS_OFFLINE_PAGES_CORE_OFFLINE_PAGE_TEST_ARCHIVER_H_ |
| OLD | NEW |