Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: net/http/partial_data.cc

Issue 3056029: Move the number conversions from string_util to a new file.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_network_transaction.cc ('k') | net/proxy/proxy_config.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "net/http/partial_data.h" 5 #include "net/http/partial_data.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_number_conversions.h"
9 #include "base/string_util.h" 10 #include "base/string_util.h"
10 #include "net/base/net_errors.h" 11 #include "net/base/net_errors.h"
11 #include "net/disk_cache/disk_cache.h" 12 #include "net/disk_cache/disk_cache.h"
12 #include "net/http/http_response_headers.h" 13 #include "net/http/http_response_headers.h"
13 #include "net/http/http_util.h" 14 #include "net/http/http_util.h"
14 15
15 namespace net { 16 namespace net {
16 17
17 namespace { 18 namespace {
18 19
19 // The headers that we have to process. 20 // The headers that we have to process.
20 const char kLengthHeader[] = "Content-Length"; 21 const char kLengthHeader[] = "Content-Length";
21 const char kRangeHeader[] = "Content-Range"; 22 const char kRangeHeader[] = "Content-Range";
22 const int kDataStream = 1; 23 const int kDataStream = 1;
23 24
24 void AddRangeHeader(int64 start, int64 end, HttpRequestHeaders* headers) { 25 void AddRangeHeader(int64 start, int64 end, HttpRequestHeaders* headers) {
25 DCHECK(start >= 0 || end >= 0); 26 DCHECK(start >= 0 || end >= 0);
26 std::string my_start, my_end; 27 std::string my_start, my_end;
27 if (start >= 0) 28 if (start >= 0)
28 my_start = Int64ToString(start); 29 my_start = base::Int64ToString(start);
29 if (end >= 0) 30 if (end >= 0)
30 my_end = Int64ToString(end); 31 my_end = base::Int64ToString(end);
31 32
32 headers->SetHeader( 33 headers->SetHeader(
33 HttpRequestHeaders::kRange, 34 HttpRequestHeaders::kRange,
34 StringPrintf("bytes=%s-%s", my_start.c_str(), my_end.c_str())); 35 StringPrintf("bytes=%s-%s", my_start.c_str(), my_end.c_str()));
35 } 36 }
36 37
37 } // namespace 38 } // namespace
38 39
39 // A core object that can be detached from the Partialdata object at destruction 40 // A core object that can be detached from the Partialdata object at destruction
40 // so that asynchronous operations cleanup can be performed. 41 // so that asynchronous operations cleanup can be performed.
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 cached_min_len_ = result; 437 cached_min_len_ = result;
437 if (result >= 0) 438 if (result >= 0)
438 result = 1; // Return success, go ahead and validate the entry. 439 result = 1; // Return success, go ahead and validate the entry.
439 440
440 CompletionCallback* cb = callback_; 441 CompletionCallback* cb = callback_;
441 callback_ = NULL; 442 callback_ = NULL;
442 cb->Run(result); 443 cb->Run(result);
443 } 444 }
444 445
445 } // namespace net 446 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_transaction.cc ('k') | net/proxy/proxy_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698