| 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> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // generated data has been created. | 35 // generated data has been created. |
| 36 virtual void OnTemporaryFileCreated(const base::FilePath& temp_file) = 0; | 36 virtual void OnTemporaryFileCreated(const base::FilePath& temp_file) = 0; |
| 37 }; | 37 }; |
| 38 static void SetTestDelegate(TestDelegate* delegate); | 38 static void SetTestDelegate(TestDelegate* delegate); |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 ~PageCaptureSaveAsMHTMLFunction() override; | 41 ~PageCaptureSaveAsMHTMLFunction() override; |
| 42 bool RunAsync() override; | 42 bool RunAsync() override; |
| 43 bool OnMessageReceived(const IPC::Message& message) override; | 43 bool OnMessageReceived(const IPC::Message& message) override; |
| 44 | 44 |
| 45 #if defined(OS_CHROMEOS) | |
| 46 // Resolves the API permission request in Public Sessions. | |
| 47 void ResolvePermissionRequest(const PermissionIDSet& allowed_permissions); | |
| 48 #endif | |
| 49 | |
| 50 // Called on the file thread. | 45 // Called on the file thread. |
| 51 void CreateTemporaryFile(); | 46 void CreateTemporaryFile(); |
| 52 | 47 |
| 53 // Called on the UI thread. | 48 // Called on the UI thread. |
| 54 void TemporaryFileCreated(bool success); | 49 void TemporaryFileCreated(bool success); |
| 55 void ReturnFailure(const std::string& error); | 50 void ReturnFailure(const std::string& error); |
| 56 void ReturnSuccess(int64_t file_size); | 51 void ReturnSuccess(int64_t file_size); |
| 57 | 52 |
| 58 // Callback called once the MHTML generation is done. | 53 // Callback called once the MHTML generation is done. |
| 59 void MHTMLGenerated(int64_t mhtml_file_size); | 54 void MHTMLGenerated(int64_t mhtml_file_size); |
| 60 | 55 |
| 61 // Returns the WebContents we are associated with, NULL if it's been closed. | 56 // Returns the WebContents we are associated with, NULL if it's been closed. |
| 62 content::WebContents* GetWebContents(); | 57 content::WebContents* GetWebContents(); |
| 63 | 58 |
| 64 std::unique_ptr<extensions::api::page_capture::SaveAsMHTML::Params> params_; | 59 std::unique_ptr<extensions::api::page_capture::SaveAsMHTML::Params> params_; |
| 65 | 60 |
| 66 // The path to the temporary file containing the MHTML data. | 61 // The path to the temporary file containing the MHTML data. |
| 67 base::FilePath mhtml_path_; | 62 base::FilePath mhtml_path_; |
| 68 | 63 |
| 69 // The file containing the MHTML. | 64 // The file containing the MHTML. |
| 70 scoped_refptr<storage::ShareableFileReference> mhtml_file_; | 65 scoped_refptr<storage::ShareableFileReference> mhtml_file_; |
| 71 | 66 |
| 72 DECLARE_EXTENSION_FUNCTION("pageCapture.saveAsMHTML", PAGECAPTURE_SAVEASMHTML) | 67 DECLARE_EXTENSION_FUNCTION("pageCapture.saveAsMHTML", PAGECAPTURE_SAVEASMHTML) |
| 73 }; | 68 }; |
| 74 | 69 |
| 75 } // namespace extensions | 70 } // namespace extensions |
| 76 | 71 |
| 77 #endif // CHROME_BROWSER_EXTENSIONS_API_PAGE_CAPTURE_PAGE_CAPTURE_API_H_ | 72 #endif // CHROME_BROWSER_EXTENSIONS_API_PAGE_CAPTURE_PAGE_CAPTURE_API_H_ |
| OLD | NEW |