Index: chrome/browser/extensions/extension_save_page_api.h |
diff --git a/chrome/browser/extensions/extension_save_page_api.h b/chrome/browser/extensions/extension_save_page_api.h |
index 4afdf62f2fcbb8c5c0e1655ed80634d6d134ee41..a104c03777a5d43bc661bd0b3900dd699ed34126 100644 |
--- a/chrome/browser/extensions/extension_save_page_api.h |
+++ b/chrome/browser/extensions/extension_save_page_api.h |
@@ -7,23 +7,35 @@ |
#include <string> |
+#include "base/memory/ref_counted.h" |
#include "chrome/browser/extensions/extension_function.h" |
#include "content/browser/tab_contents/tab_contents_observer.h" |
#include "content/public/browser/notification_observer.h" |
#include "content/public/browser/notification_registrar.h" |
+#include "webkit/blob/deletable_file_reference.h" |
class SavePageAsMHTMLFunction : public AsyncExtensionFunction, |
public content::NotificationObserver { |
public: |
SavePageAsMHTMLFunction(); |
+ // Test specific delegate used to test that the temporary file gets deleted. |
+ class TestDelegate { |
+ public: |
+ // Called on the UI thread when the temporary file that contains the |
+ // generated data has been created. |
+ virtual void OnTemporaryFileCreated(const FilePath& temp_file) = 0; |
+ }; |
+ static void SetTestDelegate(TestDelegate* delegate); |
+ |
private: |
virtual ~SavePageAsMHTMLFunction(); |
- |
virtual bool RunImpl() OVERRIDE; |
virtual void Observe(int type, |
const content::NotificationSource& source, |
const content::NotificationDetails& details) OVERRIDE; |
+ virtual bool OnMessageReceivedFromRenderView( |
+ const IPC::Message& message) OVERRIDE; |
// Called on the file thread. |
void CreateTemporaryFile(); |
@@ -33,12 +45,21 @@ class SavePageAsMHTMLFunction : public AsyncExtensionFunction, |
void ReturnFailure(const std::string& error); |
void ReturnSuccess(int64 file_size); |
+ // Returns the TabContents we are associated with, NULL if it's been closed. |
+ TabContents* GetTabContents(); |
+ |
int tab_id_; |
// The path to the temporary file containing the MHTML data. |
FilePath mhtml_path_; |
+ // The file containing the MHTML. |
+ scoped_refptr<webkit_blob::DeletableFileReference> mhtml_file_; |
+ |
content::NotificationRegistrar registrar_; |
+ |
+ static TestDelegate* test_delegate_; |
Mihai Parparita -not on Chrome
2011/11/19 01:25:21
This can just be a static inside exension_save_pag
Jay Civelli
2011/11/21 02:12:48
Done.
|
+ |
DECLARE_EXTENSION_FUNCTION_NAME("experimental.savePage.saveAsMHTML") |
}; |