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

Side by Side Diff: chrome/browser/automation/url_request_slow_download_job.cc

Issue 6268: Port some more parts of browser/... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years, 2 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/browser/automation/url_request_slow_download_job.h" 5 #include "chrome/browser/automation/url_request_slow_download_job.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "googleurl/src/gurl.h" 9 #include "googleurl/src/gurl.h"
10 #include "net/url_request/url_request.h" 10 #include "net/url_request/url_request.h"
(...skipping 13 matching lines...) Expand all
24 URLRequestSlowDownloadJob::kPendingRequests; 24 URLRequestSlowDownloadJob::kPendingRequests;
25 25
26 void URLRequestSlowDownloadJob::Start() { 26 void URLRequestSlowDownloadJob::Start() {
27 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(this, 27 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(this,
28 &URLRequestSlowDownloadJob::StartAsync)); 28 &URLRequestSlowDownloadJob::StartAsync));
29 } 29 }
30 30
31 /* static */ 31 /* static */
32 void URLRequestSlowDownloadJob::AddUITestUrls() { 32 void URLRequestSlowDownloadJob::AddUITestUrls() {
33 URLRequestFilter* filter = URLRequestFilter::GetInstance(); 33 URLRequestFilter* filter = URLRequestFilter::GetInstance();
34 filter->AddUrlHandler(GURL(kUnknownSizeUrl), 34 filter->AddUrlHandler(GURL(WideToUTF8(kUnknownSizeUrl)),
35 &URLRequestSlowDownloadJob::Factory); 35 &URLRequestSlowDownloadJob::Factory);
36 filter->AddUrlHandler(GURL(kKnownSizeUrl), 36 filter->AddUrlHandler(GURL(WideToUTF8(kKnownSizeUrl)),
37 &URLRequestSlowDownloadJob::Factory); 37 &URLRequestSlowDownloadJob::Factory);
38 filter->AddUrlHandler(GURL(kFinishDownloadUrl), 38 filter->AddUrlHandler(GURL(WideToUTF8(kFinishDownloadUrl)),
39 &URLRequestSlowDownloadJob::Factory); 39 &URLRequestSlowDownloadJob::Factory);
40 } 40 }
41 41
42 /*static */ 42 /*static */
43 URLRequestJob* URLRequestSlowDownloadJob::Factory(URLRequest* request, 43 URLRequestJob* URLRequestSlowDownloadJob::Factory(URLRequest* request,
44 const std::string& scheme) { 44 const std::string& scheme) {
45 URLRequestSlowDownloadJob* job = new URLRequestSlowDownloadJob(request); 45 URLRequestSlowDownloadJob* job = new URLRequestSlowDownloadJob(request);
46 if (request->url().spec() != WideToUTF8(kFinishDownloadUrl)) 46 if (request->url().spec() != WideToUTF8(kFinishDownloadUrl))
47 URLRequestSlowDownloadJob::kPendingRequests.push_back(job); 47 URLRequestSlowDownloadJob::kPendingRequests.push_back(job);
48 return job; 48 return job;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 ReplaceSubstringsAfterOffset(&raw_headers, 0, "\n", std::string("\0", 1)); 154 ReplaceSubstringsAfterOffset(&raw_headers, 0, "\n", std::string("\0", 1));
155 info->headers = new net::HttpResponseHeaders(raw_headers); 155 info->headers = new net::HttpResponseHeaders(raw_headers);
156 } 156 }
157 157
158 bool URLRequestSlowDownloadJob::GetMimeType(std::string* mime_type) { 158 bool URLRequestSlowDownloadJob::GetMimeType(std::string* mime_type) {
159 net::HttpResponseInfo info; 159 net::HttpResponseInfo info;
160 GetResponseInfo(&info); 160 GetResponseInfo(&info);
161 return info.headers && info.headers->GetMimeType(mime_type); 161 return info.headers && info.headers->GetMimeType(mime_type);
162 } 162 }
163 163
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698