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 NET_URL_REQUEST_VIEW_CACHE_HELPER_H_ | 5 #ifndef NET_URL_REQUEST_VIEW_CACHE_HELPER_H_ |
6 #define NET_URL_REQUEST_VIEW_CACHE_HELPER_H_ | 6 #define NET_URL_REQUEST_VIEW_CACHE_HELPER_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" |
(...skipping 30 matching lines...) Expand all Loading... |
41 // or the object is destroyed. |url_prefix| will be prepended to each entry | 41 // or the object is destroyed. |url_prefix| will be prepended to each entry |
42 // key as a link to the entry. | 42 // key as a link to the entry. |
43 int GetContentsHTML(const URLRequestContext* context, | 43 int GetContentsHTML(const URLRequestContext* context, |
44 const std::string& url_prefix, | 44 const std::string& url_prefix, |
45 std::string* out, | 45 std::string* out, |
46 const CompletionCallback& callback); | 46 const CompletionCallback& callback); |
47 | 47 |
48 // Lower-level helper to produce a textual representation of binary data. | 48 // Lower-level helper to produce a textual representation of binary data. |
49 // The results are appended to |result| and can be used in HTML pages | 49 // The results are appended to |result| and can be used in HTML pages |
50 // provided the dump is contained within <pre></pre> tags. | 50 // provided the dump is contained within <pre></pre> tags. |
51 static void HexDump(const char *buf, size_t buf_len, std::string* result); | 51 static void HexDump(const char* buf, size_t buf_len, std::string* result); |
52 | 52 |
53 private: | 53 private: |
54 enum State { | 54 enum State { |
55 STATE_NONE, | 55 STATE_NONE, |
56 STATE_GET_BACKEND, | 56 STATE_GET_BACKEND, |
57 STATE_GET_BACKEND_COMPLETE, | 57 STATE_GET_BACKEND_COMPLETE, |
58 STATE_OPEN_NEXT_ENTRY, | 58 STATE_OPEN_NEXT_ENTRY, |
59 STATE_OPEN_NEXT_ENTRY_COMPLETE, | 59 STATE_OPEN_NEXT_ENTRY_COMPLETE, |
60 STATE_OPEN_ENTRY, | 60 STATE_OPEN_ENTRY, |
61 STATE_OPEN_ENTRY_COMPLETE, | 61 STATE_OPEN_ENTRY_COMPLETE, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 State next_state_; | 115 State next_state_; |
116 | 116 |
117 base::WeakPtrFactory<ViewCacheHelper> weak_factory_; | 117 base::WeakPtrFactory<ViewCacheHelper> weak_factory_; |
118 | 118 |
119 DISALLOW_COPY_AND_ASSIGN(ViewCacheHelper); | 119 DISALLOW_COPY_AND_ASSIGN(ViewCacheHelper); |
120 }; | 120 }; |
121 | 121 |
122 } // namespace net. | 122 } // namespace net. |
123 | 123 |
124 #endif // NET_URL_REQUEST_VIEW_CACHE_HELPER_H_ | 124 #endif // NET_URL_REQUEST_VIEW_CACHE_HELPER_H_ |
OLD | NEW |