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