Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1240)

Side by Side Diff: chrome/browser/extensions/extension_save_page_api.h

Issue 8682013: Moving the MHTML API out of experimental and renaming it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: One more sync Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SAVE_PAGE_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SAVE_PAGE_API_H_
7
8 #include <string>
9
10 #include "base/memory/ref_counted.h"
11 #include "chrome/browser/extensions/extension_function.h"
12 #include "content/browser/tab_contents/tab_contents_observer.h"
13 #include "webkit/blob/deletable_file_reference.h"
14
15 class FilePath;
16
17 class SavePageAsMHTMLFunction : public AsyncExtensionFunction {
18 public:
19 SavePageAsMHTMLFunction();
20
21 // Test specific delegate used to test that the temporary file gets deleted.
22 class TestDelegate {
23 public:
24 // Called on the UI thread when the temporary file that contains the
25 // generated data has been created.
26 virtual void OnTemporaryFileCreated(const FilePath& temp_file) = 0;
27 };
28 static void SetTestDelegate(TestDelegate* delegate);
29
30 private:
31 virtual ~SavePageAsMHTMLFunction();
32 virtual bool RunImpl() OVERRIDE;
33 virtual bool OnMessageReceivedFromRenderView(
34 const IPC::Message& message) OVERRIDE;
35
36 // Called on the file thread.
37 void CreateTemporaryFile();
38
39 // Called on the UI thread.
40 void TemporaryFileCreated(bool success);
41 void ReturnFailure(const std::string& error);
42 void ReturnSuccess(int64 file_size);
43
44 // Callback called once the MHTML generation is done.
45 void MHTMLGenerated(const FilePath& file_path, int64 mhtml_file_size);
46
47 // Returns the TabContents we are associated with, NULL if it's been closed.
48 TabContents* GetTabContents();
49
50 int tab_id_;
51
52 // The path to the temporary file containing the MHTML data.
53 FilePath mhtml_path_;
54
55 // The file containing the MHTML.
56 scoped_refptr<webkit_blob::DeletableFileReference> mhtml_file_;
57
58 DECLARE_EXTENSION_FUNCTION_NAME("experimental.savePage.saveAsMHTML")
59 };
60
61 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SAVE_PAGE_API_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_page_capture_apitest.cc ('k') | chrome/browser/extensions/extension_save_page_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698