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