| OLD | NEW |
| 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 WEBKIT_BROWSER_BLOB_VIEW_BLOB_INTERNALS_JOB_H_ | 5 #ifndef WEBKIT_BROWSER_BLOB_VIEW_BLOB_INTERNALS_JOB_H_ |
| 6 #define WEBKIT_BROWSER_BLOB_VIEW_BLOB_INTERNALS_JOB_H_ | 6 #define WEBKIT_BROWSER_BLOB_VIEW_BLOB_INTERNALS_JOB_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "net/url_request/url_request_simple_job.h" | 11 #include "net/url_request/url_request_simple_job.h" |
| 12 #include "webkit/browser/webkit_storage_browser_export.h" | 12 #include "storage/common/storage_export.h" |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 class URLRequest; | 15 class URLRequest; |
| 16 } // namespace net | 16 } // namespace net |
| 17 | 17 |
| 18 namespace webkit_blob { | 18 namespace storage { |
| 19 | 19 |
| 20 class BlobData; | 20 class BlobData; |
| 21 class BlobStorageContext; | 21 class BlobStorageContext; |
| 22 | 22 |
| 23 // A job subclass that implements a protocol to inspect the internal | 23 // A job subclass that implements a protocol to inspect the internal |
| 24 // state of blob registry. | 24 // state of blob registry. |
| 25 class WEBKIT_STORAGE_BROWSER_EXPORT ViewBlobInternalsJob | 25 class STORAGE_EXPORT ViewBlobInternalsJob : public net::URLRequestSimpleJob { |
| 26 : public net::URLRequestSimpleJob { | |
| 27 public: | 26 public: |
| 28 ViewBlobInternalsJob(net::URLRequest* request, | 27 ViewBlobInternalsJob(net::URLRequest* request, |
| 29 net::NetworkDelegate* network_delegate, | 28 net::NetworkDelegate* network_delegate, |
| 30 BlobStorageContext* blob_storage_context); | 29 BlobStorageContext* blob_storage_context); |
| 31 | 30 |
| 32 virtual void Start() OVERRIDE; | 31 virtual void Start() OVERRIDE; |
| 33 virtual int GetData(std::string* mime_type, | 32 virtual int GetData(std::string* mime_type, |
| 34 std::string* charset, | 33 std::string* charset, |
| 35 std::string* data, | 34 std::string* data, |
| 36 const net::CompletionCallback& callback) const OVERRIDE; | 35 const net::CompletionCallback& callback) const OVERRIDE; |
| 37 virtual bool IsRedirectResponse(GURL* location, | 36 virtual bool IsRedirectResponse(GURL* location, |
| 38 int* http_status_code) OVERRIDE; | 37 int* http_status_code) OVERRIDE; |
| 39 virtual void Kill() OVERRIDE; | 38 virtual void Kill() OVERRIDE; |
| 40 | 39 |
| 41 private: | 40 private: |
| 42 virtual ~ViewBlobInternalsJob(); | 41 virtual ~ViewBlobInternalsJob(); |
| 43 | 42 |
| 44 void GenerateHTML(std::string* out) const; | 43 void GenerateHTML(std::string* out) const; |
| 45 static void GenerateHTMLForBlobData(const BlobData& blob_data, | 44 static void GenerateHTMLForBlobData(const BlobData& blob_data, |
| 46 int refcount, | 45 int refcount, |
| 47 std::string* out); | 46 std::string* out); |
| 48 | 47 |
| 49 BlobStorageContext* blob_storage_context_; | 48 BlobStorageContext* blob_storage_context_; |
| 50 base::WeakPtrFactory<ViewBlobInternalsJob> weak_factory_; | 49 base::WeakPtrFactory<ViewBlobInternalsJob> weak_factory_; |
| 51 | 50 |
| 52 DISALLOW_COPY_AND_ASSIGN(ViewBlobInternalsJob); | 51 DISALLOW_COPY_AND_ASSIGN(ViewBlobInternalsJob); |
| 53 }; | 52 }; |
| 54 | 53 |
| 55 } // namespace webkit_blob | 54 } // namespace storage |
| 56 | 55 |
| 57 #endif // WEBKIT_BROWSER_BLOB_VIEW_BLOB_INTERNALS_JOB_H_ | 56 #endif // WEBKIT_BROWSER_BLOB_VIEW_BLOB_INTERNALS_JOB_H_ |
| OLD | NEW |