| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_EXTENSIONS_API_PAGE_CAPTURE_PAGE_CAPTURE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PAGE_CAPTURE_PAGE_CAPTURE_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_PAGE_CAPTURE_PAGE_CAPTURE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_PAGE_CAPTURE_PAGE_CAPTURE_API_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "chrome/browser/extensions/chrome_extension_function.h" | 13 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 14 #include "chrome/common/extensions/api/page_capture.h" | 14 #include "chrome/common/extensions/api/page_capture.h" |
| 15 #include "storage/browser/blob/shareable_file_reference.h" | 15 #include "storage/browser/blob/shareable_file_reference.h" |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class FilePath; | 18 class FilePath; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 class WebContents; | 22 class WebContents; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace extensions { | 25 namespace extensions { |
| 26 | 26 |
| 27 class PageCapturePermissionHelper; |
| 28 |
| 27 class PageCaptureSaveAsMHTMLFunction : public ChromeAsyncExtensionFunction { | 29 class PageCaptureSaveAsMHTMLFunction : public ChromeAsyncExtensionFunction { |
| 28 public: | 30 public: |
| 29 PageCaptureSaveAsMHTMLFunction(); | 31 PageCaptureSaveAsMHTMLFunction(); |
| 30 | 32 |
| 31 // Test specific delegate used to test that the temporary file gets deleted. | 33 // Test specific delegate used to test that the temporary file gets deleted. |
| 32 class TestDelegate { | 34 class TestDelegate { |
| 33 public: | 35 public: |
| 34 // Called on the UI thread when the temporary file that contains the | 36 // Called on the UI thread when the temporary file that contains the |
| 35 // generated data has been created. | 37 // generated data has been created. |
| 36 virtual void OnTemporaryFileCreated(const base::FilePath& temp_file) = 0; | 38 virtual void OnTemporaryFileCreated(const base::FilePath& temp_file) = 0; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 57 content::WebContents* GetWebContents(); | 59 content::WebContents* GetWebContents(); |
| 58 | 60 |
| 59 std::unique_ptr<extensions::api::page_capture::SaveAsMHTML::Params> params_; | 61 std::unique_ptr<extensions::api::page_capture::SaveAsMHTML::Params> params_; |
| 60 | 62 |
| 61 // The path to the temporary file containing the MHTML data. | 63 // The path to the temporary file containing the MHTML data. |
| 62 base::FilePath mhtml_path_; | 64 base::FilePath mhtml_path_; |
| 63 | 65 |
| 64 // The file containing the MHTML. | 66 // The file containing the MHTML. |
| 65 scoped_refptr<storage::ShareableFileReference> mhtml_file_; | 67 scoped_refptr<storage::ShareableFileReference> mhtml_file_; |
| 66 | 68 |
| 69 #if defined(OS_CHROMEOS) |
| 70 std::unique_ptr<PageCapturePermissionHelper> permission_helper_; |
| 71 #endif |
| 72 |
| 67 DECLARE_EXTENSION_FUNCTION("pageCapture.saveAsMHTML", PAGECAPTURE_SAVEASMHTML) | 73 DECLARE_EXTENSION_FUNCTION("pageCapture.saveAsMHTML", PAGECAPTURE_SAVEASMHTML) |
| 68 }; | 74 }; |
| 69 | 75 |
| 70 } // namespace extensions | 76 } // namespace extensions |
| 71 | 77 |
| 72 #endif // CHROME_BROWSER_EXTENSIONS_API_PAGE_CAPTURE_PAGE_CAPTURE_API_H_ | 78 #endif // CHROME_BROWSER_EXTENSIONS_API_PAGE_CAPTURE_PAGE_CAPTURE_API_H_ |
| OLD | NEW |