OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 WEBKIT_BLOB_VIEW_BLOB_INTERNALS_JOB_H_ | 5 #ifndef WEBKIT_BLOB_VIEW_BLOB_INTERNALS_JOB_H_ |
6 #define WEBKIT_BLOB_VIEW_BLOB_INTERNALS_JOB_H_ | 6 #define WEBKIT_BLOB_VIEW_BLOB_INTERNALS_JOB_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/task.h" | 10 #include "base/task.h" |
11 #include "net/url_request/url_request_simple_job.h" | 11 #include "net/url_request/url_request_simple_job.h" |
| 12 #include "webkit/blob/blob_export.h" |
12 | 13 |
13 namespace net { | 14 namespace net { |
14 class URLRequest; | 15 class URLRequest; |
15 } // namespace net | 16 } // namespace net |
16 | 17 |
17 namespace webkit_blob { | 18 namespace webkit_blob { |
18 | 19 |
19 class BlobData; | 20 class BlobData; |
20 class BlobStorageController; | 21 class BlobStorageController; |
21 | 22 |
22 // A job subclass that implements a protocol to inspect the internal | 23 // A job subclass that implements a protocol to inspect the internal |
23 // state of blob registry. | 24 // state of blob registry. |
24 class ViewBlobInternalsJob : public net::URLRequestSimpleJob { | 25 class BLOB_EXPORT ViewBlobInternalsJob : public net::URLRequestSimpleJob { |
25 public: | 26 public: |
26 ViewBlobInternalsJob(net::URLRequest* request, | 27 ViewBlobInternalsJob(net::URLRequest* request, |
27 BlobStorageController* blob_storage_controller); | 28 BlobStorageController* blob_storage_controller); |
28 | 29 |
29 virtual void Start(); | 30 virtual void Start(); |
30 virtual bool GetData(std::string* mime_type, | 31 virtual bool GetData(std::string* mime_type, |
31 std::string* charset, | 32 std::string* charset, |
32 std::string* data) const; | 33 std::string* data) const; |
33 virtual bool IsRedirectResponse(GURL* location, int* http_status_code); | 34 virtual bool IsRedirectResponse(GURL* location, int* http_status_code); |
34 virtual void Kill(); | 35 virtual void Kill(); |
35 | 36 |
36 private: | 37 private: |
37 virtual ~ViewBlobInternalsJob(); | 38 virtual ~ViewBlobInternalsJob(); |
38 | 39 |
39 void DoWorkAsync(); | 40 void DoWorkAsync(); |
40 void GenerateHTML(std::string* out) const; | 41 void GenerateHTML(std::string* out) const; |
41 static void GenerateHTMLForBlobData(const BlobData& blob_data, | 42 static void GenerateHTMLForBlobData(const BlobData& blob_data, |
42 std::string* out); | 43 std::string* out); |
43 | 44 |
44 BlobStorageController* blob_storage_controller_; | 45 BlobStorageController* blob_storage_controller_; |
45 ScopedRunnableMethodFactory<ViewBlobInternalsJob> method_factory_; | 46 ScopedRunnableMethodFactory<ViewBlobInternalsJob> method_factory_; |
46 | 47 |
47 DISALLOW_COPY_AND_ASSIGN(ViewBlobInternalsJob); | 48 DISALLOW_COPY_AND_ASSIGN(ViewBlobInternalsJob); |
48 }; | 49 }; |
49 | 50 |
50 } // namespace webkit_blob | 51 } // namespace webkit_blob |
51 | 52 |
52 #endif // WEBKIT_BLOB_VIEW_BLOB_INTERNALS_JOB_H_ | 53 #endif // WEBKIT_BLOB_VIEW_BLOB_INTERNALS_JOB_H_ |
OLD | NEW |