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

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

Issue 6037013: net: Add namespace net to URLRequestFilter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 12 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) 2009 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 "chrome/browser/net/url_request_slow_http_job.h" 5 #include "chrome/browser/net/url_request_slow_http_job.h"
6 6
7 #include "base/platform_thread.h" 7 #include "base/platform_thread.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "net/url_request/url_request_filter.h" 10 #include "net/url_request/url_request_filter.h"
11 11
(...skipping 10 matching lines...) Expand all
22 net::URLRequestJob* URLRequestSlowHTTPJob::Factory(net::URLRequest* request, 22 net::URLRequestJob* URLRequestSlowHTTPJob::Factory(net::URLRequest* request,
23 const std::string& scheme) { 23 const std::string& scheme) {
24 return new URLRequestSlowHTTPJob(request, 24 return new URLRequestSlowHTTPJob(request,
25 GetOnDiskPath(base_path_, request, scheme)); 25 GetOnDiskPath(base_path_, request, scheme));
26 } 26 }
27 27
28 /* static */ 28 /* static */
29 void URLRequestSlowHTTPJob::AddUrlHandler(const FilePath& base_path) { 29 void URLRequestSlowHTTPJob::AddUrlHandler(const FilePath& base_path) {
30 base_path_ = base_path; 30 base_path_ = base_path;
31 31
32 // Add kMockHostname to URLRequestFilter. 32 // Add kMockHostname to net::URLRequestFilter.
33 URLRequestFilter* filter = URLRequestFilter::GetInstance(); 33 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
34 filter->AddHostnameHandler("http", kMockHostname, 34 filter->AddHostnameHandler("http", kMockHostname,
35 URLRequestSlowHTTPJob::Factory); 35 URLRequestSlowHTTPJob::Factory);
36 } 36 }
37 37
38 /* static */ 38 /* static */
39 GURL URLRequestSlowHTTPJob::GetMockUrl(const FilePath& path) { 39 GURL URLRequestSlowHTTPJob::GetMockUrl(const FilePath& path) {
40 std::string url = "http://"; 40 std::string url = "http://";
41 url.append(kMockHostname); 41 url.append(kMockHostname);
42 url.append("/"); 42 url.append("/");
43 url.append(WideToUTF8(path.ToWStringHack())); 43 url.append(WideToUTF8(path.ToWStringHack()));
44 return GURL(url); 44 return GURL(url);
45 } 45 }
46 46
47 URLRequestSlowHTTPJob::URLRequestSlowHTTPJob(net::URLRequest* request, 47 URLRequestSlowHTTPJob::URLRequestSlowHTTPJob(net::URLRequest* request,
48 const FilePath& file_path) 48 const FilePath& file_path)
49 : URLRequestMockHTTPJob(request, file_path) { } 49 : URLRequestMockHTTPJob(request, file_path) { }
50 50
51 void URLRequestSlowHTTPJob::Start() { 51 void URLRequestSlowHTTPJob::Start() {
52 delay_timer_.Start(TimeDelta::FromMilliseconds(kDelayMs), this, 52 delay_timer_.Start(TimeDelta::FromMilliseconds(kDelayMs), this,
53 &URLRequestSlowHTTPJob::RealStart); 53 &URLRequestSlowHTTPJob::RealStart);
54 } 54 }
55 55
56 URLRequestSlowHTTPJob::~URLRequestSlowHTTPJob() { 56 URLRequestSlowHTTPJob::~URLRequestSlowHTTPJob() {
57 } 57 }
58 58
59 void URLRequestSlowHTTPJob::RealStart() { 59 void URLRequestSlowHTTPJob::RealStart() {
60 URLRequestMockHTTPJob::Start(); 60 URLRequestMockHTTPJob::Start();
61 } 61 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698