| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_SYNC_GLUE_HTTP_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_HTTP_BRIDGE_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_HTTP_BRIDGE_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_HTTP_BRIDGE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // WARNING: these response content methods are used to extract plain old data | 113 // WARNING: these response content methods are used to extract plain old data |
| 114 // and not null terminated strings, so you should make sure you have read | 114 // and not null terminated strings, so you should make sure you have read |
| 115 // GetResponseContentLength() characters when using GetResponseContent. e.g | 115 // GetResponseContentLength() characters when using GetResponseContent. e.g |
| 116 // string r(b->GetResponseContent(), b->GetResponseContentLength()). | 116 // string r(b->GetResponseContent(), b->GetResponseContentLength()). |
| 117 virtual int GetResponseContentLength() const; | 117 virtual int GetResponseContentLength() const; |
| 118 virtual const char* GetResponseContent() const; | 118 virtual const char* GetResponseContent() const; |
| 119 virtual const std::string GetResponseHeaderValue( | 119 virtual const std::string GetResponseHeaderValue( |
| 120 const std::string& name) const; | 120 const std::string& name) const; |
| 121 | 121 |
| 122 // content::URLFetcherDelegate implementation. | 122 // content::URLFetcherDelegate implementation. |
| 123 virtual void OnURLFetchComplete(const URLFetcher* source); | 123 virtual void OnURLFetchComplete(const content::URLFetcher* source); |
| 124 | 124 |
| 125 #if defined(UNIT_TEST) | 125 #if defined(UNIT_TEST) |
| 126 net::URLRequestContextGetter* GetRequestContextGetter() const { | 126 net::URLRequestContextGetter* GetRequestContextGetter() const { |
| 127 return context_getter_for_request_; | 127 return context_getter_for_request_; |
| 128 } | 128 } |
| 129 #endif | 129 #endif |
| 130 | 130 |
| 131 protected: | 131 protected: |
| 132 friend class base::RefCountedThreadSafe<HttpBridge>; | 132 friend class base::RefCountedThreadSafe<HttpBridge>; |
| 133 | 133 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 base::WaitableEvent http_post_completed_; | 169 base::WaitableEvent http_post_completed_; |
| 170 | 170 |
| 171 struct URLFetchState { | 171 struct URLFetchState { |
| 172 URLFetchState(); | 172 URLFetchState(); |
| 173 ~URLFetchState(); | 173 ~URLFetchState(); |
| 174 // Our hook into the network layer is a URLFetcher. USED ONLY ON THE IO | 174 // Our hook into the network layer is a URLFetcher. USED ONLY ON THE IO |
| 175 // LOOP, so we can block created_on_loop_ while the fetch is in progress. | 175 // LOOP, so we can block created_on_loop_ while the fetch is in progress. |
| 176 // NOTE: This is not a scoped_ptr for a reason. It must be deleted on the | 176 // NOTE: This is not a scoped_ptr for a reason. It must be deleted on the |
| 177 // same thread that created it, which isn't the same thread |this| gets | 177 // same thread that created it, which isn't the same thread |this| gets |
| 178 // deleted on. We must manually delete url_poster_ on the IO loop. | 178 // deleted on. We must manually delete url_poster_ on the IO loop. |
| 179 URLFetcher* url_poster; | 179 content::URLFetcher* url_poster; |
| 180 | 180 |
| 181 // Used to support 'Abort' functionality. | 181 // Used to support 'Abort' functionality. |
| 182 bool aborted; | 182 bool aborted; |
| 183 | 183 |
| 184 // Cached response data. | 184 // Cached response data. |
| 185 bool request_completed; | 185 bool request_completed; |
| 186 bool request_succeeded; | 186 bool request_succeeded; |
| 187 int http_response_code; | 187 int http_response_code; |
| 188 int error_code; | 188 int error_code; |
| 189 std::string response_content; | 189 std::string response_content; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 216 HttpBridge::RequestContextGetter* GetRequestContextGetter(); | 216 HttpBridge::RequestContextGetter* GetRequestContextGetter(); |
| 217 | 217 |
| 218 scoped_refptr<HttpBridge::RequestContextGetter> request_context_getter_; | 218 scoped_refptr<HttpBridge::RequestContextGetter> request_context_getter_; |
| 219 | 219 |
| 220 DISALLOW_COPY_AND_ASSIGN(HttpBridgeFactory); | 220 DISALLOW_COPY_AND_ASSIGN(HttpBridgeFactory); |
| 221 }; | 221 }; |
| 222 | 222 |
| 223 } // namespace browser_sync | 223 } // namespace browser_sync |
| 224 | 224 |
| 225 #endif // CHROME_BROWSER_SYNC_GLUE_HTTP_BRIDGE_H_ | 225 #endif // CHROME_BROWSER_SYNC_GLUE_HTTP_BRIDGE_H_ |
| OLD | NEW |