protocol_handler_util.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef IOS_NET_PROTOCOL_HANDLER_UTIL_H_
  5. #define IOS_NET_PROTOCOL_HANDLER_UTIL_H_
  6. #import <Foundation/Foundation.h>
  7. namespace base {
  8. class Time;
  9. } // namespace base
  10. namespace net {
  11. class URLRequest;
  12. } // namespace net
  13. namespace net {
  14. // The error domain for network NSErrors.
  15. extern NSString* const kNSErrorDomain;
  16. // Creates a network NSError. |ns_error_code| is the iOS error code,
  17. // |net_error_code| is the network error from net/base/net_error_list.h.
  18. // |creation_time| is the time when the failing request was started and must be
  19. // valid.
  20. NSError* GetIOSError(NSInteger ns_error_code,
  21. int net_error_code,
  22. NSString* url,
  23. const base::Time& creation_time);
  24. // Builds a NSURLResponse from the response data in |request|.
  25. NSURLResponse* GetNSURLResponseForRequest(URLRequest* request);
  26. // Copy HTTP headers from |in_request| to |out_request|.
  27. void CopyHttpHeaders(NSURLRequest* in_request, URLRequest* out_request);
  28. } // namespace protocol_handler_util
  29. #endif // IOS_NET_PROTOCOL_HANDLER_UTIL_H_