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

Side by Side Diff: chrome/browser/net/url_request_mock_http_job.cc

Issue 5755004: net: Add namespace net to URLRequestFileJob. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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/net/url_request_mock_http_job.h" 5 #include "chrome/browser/net/url_request_mock_http_job.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/thread_restrictions.h" 10 #include "base/thread_restrictions.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 file_url += request->url().path(); 63 file_url += request->url().path();
64 64
65 // Convert the file:/// URL to a path on disk. 65 // Convert the file:/// URL to a path on disk.
66 FilePath file_path; 66 FilePath file_path;
67 net::FileURLToFilePath(GURL(file_url), &file_path); 67 net::FileURLToFilePath(GURL(file_url), &file_path);
68 return file_path; 68 return file_path;
69 } 69 }
70 70
71 URLRequestMockHTTPJob::URLRequestMockHTTPJob(net::URLRequest* request, 71 URLRequestMockHTTPJob::URLRequestMockHTTPJob(net::URLRequest* request,
72 const FilePath& file_path) 72 const FilePath& file_path)
73 : URLRequestFileJob(request, file_path) { } 73 : net::URLRequestFileJob(request, file_path) { }
74 74
75 // Public virtual version. 75 // Public virtual version.
76 void URLRequestMockHTTPJob::GetResponseInfo(net::HttpResponseInfo* info) { 76 void URLRequestMockHTTPJob::GetResponseInfo(net::HttpResponseInfo* info) {
77 // Forward to private const version. 77 // Forward to private const version.
78 GetResponseInfoConst(info); 78 GetResponseInfoConst(info);
79 } 79 }
80 80
81 bool URLRequestMockHTTPJob::IsRedirectResponse(GURL* location, 81 bool URLRequestMockHTTPJob::IsRedirectResponse(GURL* location,
82 int* http_status_code) { 82 int* http_status_code) {
83 // Override the URLRequestFileJob implementation to invoke the default one 83 // Override the net::URLRequestFileJob implementation to invoke the default
84 // based on HttpResponseInfo. 84 // one based on HttpResponseInfo.
85 return net::URLRequestJob::IsRedirectResponse(location, http_status_code); 85 return net::URLRequestJob::IsRedirectResponse(location, http_status_code);
86 } 86 }
87 87
88 // Private const version. 88 // Private const version.
89 void URLRequestMockHTTPJob::GetResponseInfoConst( 89 void URLRequestMockHTTPJob::GetResponseInfoConst(
90 net::HttpResponseInfo* info) const { 90 net::HttpResponseInfo* info) const {
91 // We have to load our headers from disk, but we only use this class 91 // We have to load our headers from disk, but we only use this class
92 // from tests, so allow these IO operations to happen on any thread. 92 // from tests, so allow these IO operations to happen on any thread.
93 base::ThreadRestrictions::ScopedAllowIO allow_io; 93 base::ThreadRestrictions::ScopedAllowIO allow_io;
94 94
(...skipping 11 matching lines...) Expand all
106 net::HttpResponseInfo info; 106 net::HttpResponseInfo info;
107 GetResponseInfoConst(&info); 107 GetResponseInfoConst(&info);
108 return info.headers && info.headers->GetMimeType(mime_type); 108 return info.headers && info.headers->GetMimeType(mime_type);
109 } 109 }
110 110
111 bool URLRequestMockHTTPJob::GetCharset(std::string* charset) { 111 bool URLRequestMockHTTPJob::GetCharset(std::string* charset) {
112 net::HttpResponseInfo info; 112 net::HttpResponseInfo info;
113 GetResponseInfo(&info); 113 GetResponseInfo(&info);
114 return info.headers && info.headers->GetCharset(charset); 114 return info.headers && info.headers->GetCharset(charset);
115 } 115 }
OLDNEW
« no previous file with comments | « chrome/browser/net/url_request_mock_http_job.h ('k') | chrome/browser/net/url_request_mock_net_error_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698