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

Side by Side Diff: chrome/browser/extensions/api/page_capture/page_capture_api.h

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months 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
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 <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "chrome/browser/extensions/extension_function.h" 11 #include "chrome/browser/extensions/extension_function.h"
12 #include "chrome/common/extensions/api/page_capture.h" 12 #include "chrome/common/extensions/api/page_capture.h"
13 #include "webkit/blob/shareable_file_reference.h" 13 #include "webkit/blob/shareable_file_reference.h"
14 14
15 namespace base {
15 class FilePath; 16 class FilePath;
17 }
16 18
17 namespace content { 19 namespace content {
18 class WebContents; 20 class WebContents;
19 } 21 }
20 22
21 namespace extensions { 23 namespace extensions {
22 24
23 class PageCaptureSaveAsMHTMLFunction : public AsyncExtensionFunction { 25 class PageCaptureSaveAsMHTMLFunction : public AsyncExtensionFunction {
24 public: 26 public:
25 PageCaptureSaveAsMHTMLFunction(); 27 PageCaptureSaveAsMHTMLFunction();
26 28
27 // Test specific delegate used to test that the temporary file gets deleted. 29 // Test specific delegate used to test that the temporary file gets deleted.
28 class TestDelegate { 30 class TestDelegate {
29 public: 31 public:
30 // Called on the UI thread when the temporary file that contains the 32 // Called on the UI thread when the temporary file that contains the
31 // generated data has been created. 33 // generated data has been created.
32 virtual void OnTemporaryFileCreated(const FilePath& temp_file) = 0; 34 virtual void OnTemporaryFileCreated(const base::FilePath& temp_file) = 0;
33 }; 35 };
34 static void SetTestDelegate(TestDelegate* delegate); 36 static void SetTestDelegate(TestDelegate* delegate);
35 37
36 private: 38 private:
37 virtual ~PageCaptureSaveAsMHTMLFunction(); 39 virtual ~PageCaptureSaveAsMHTMLFunction();
38 virtual bool RunImpl() OVERRIDE; 40 virtual bool RunImpl() OVERRIDE;
39 virtual bool OnMessageReceivedFromRenderView( 41 virtual bool OnMessageReceivedFromRenderView(
40 const IPC::Message& message) OVERRIDE; 42 const IPC::Message& message) OVERRIDE;
41 43
42 // Called on the file thread. 44 // Called on the file thread.
43 void CreateTemporaryFile(); 45 void CreateTemporaryFile();
44 46
45 // Called on the UI thread. 47 // Called on the UI thread.
46 void TemporaryFileCreated(bool success); 48 void TemporaryFileCreated(bool success);
47 void ReturnFailure(const std::string& error); 49 void ReturnFailure(const std::string& error);
48 void ReturnSuccess(int64 file_size); 50 void ReturnSuccess(int64 file_size);
49 51
50 // Callback called once the MHTML generation is done. 52 // Callback called once the MHTML generation is done.
51 void MHTMLGenerated(const FilePath& file_path, int64 mhtml_file_size); 53 void MHTMLGenerated(const base::FilePath& file_path, int64 mhtml_file_size);
52 54
53 // Returns the WebContents we are associated with, NULL if it's been closed. 55 // Returns the WebContents we are associated with, NULL if it's been closed.
54 content::WebContents* GetWebContents(); 56 content::WebContents* GetWebContents();
55 57
56 scoped_ptr<extensions::api::page_capture::SaveAsMHTML::Params> params_; 58 scoped_ptr<extensions::api::page_capture::SaveAsMHTML::Params> params_;
57 59
58 // The path to the temporary file containing the MHTML data. 60 // The path to the temporary file containing the MHTML data.
59 FilePath mhtml_path_; 61 base::FilePath mhtml_path_;
60 62
61 // The file containing the MHTML. 63 // The file containing the MHTML.
62 scoped_refptr<webkit_blob::ShareableFileReference> mhtml_file_; 64 scoped_refptr<webkit_blob::ShareableFileReference> mhtml_file_;
63 65
64 DECLARE_EXTENSION_FUNCTION("pageCapture.saveAsMHTML", PAGECAPTURE_SAVEASMHTML) 66 DECLARE_EXTENSION_FUNCTION("pageCapture.saveAsMHTML", PAGECAPTURE_SAVEASMHTML)
65 }; 67 };
66 68
67 } // namespace extensions 69 } // namespace extensions
68 70
69 #endif // CHROME_BROWSER_EXTENSIONS_API_PAGE_CAPTURE_PAGE_CAPTURE_API_H_ 71 #endif // CHROME_BROWSER_EXTENSIONS_API_PAGE_CAPTURE_PAGE_CAPTURE_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698