| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/web/public/test/response_providers/file_based_response_provider.h" | 5 #import "ios/web/public/test/response_providers/file_based_response_provider.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #import "ios/third_party/gcdwebserver/src/GCDWebServer/Responses/GCDWebServerFil
eResponse.h" | 9 #import "ios/third_party/gcdwebserver/src/GCDWebServer/Responses/GCDWebServerFil
eResponse.h" |
| 10 | 10 |
| 11 namespace web { | 11 namespace web { |
| 12 | 12 |
| 13 FileBasedResponseProvider::FileBasedResponseProvider(const base::FilePath& path) | 13 FileBasedResponseProvider::FileBasedResponseProvider(const base::FilePath& path) |
| 14 : response_provider_impl_(new FileBasedResponseProviderImpl(path)) { | 14 : response_provider_impl_(new FileBasedResponseProviderImpl(path)) { |
| 15 } | 15 } |
| 16 | 16 |
| 17 FileBasedResponseProvider::~FileBasedResponseProvider() { | 17 FileBasedResponseProvider::~FileBasedResponseProvider() { |
| 18 } | 18 } |
| 19 | 19 |
| 20 bool FileBasedResponseProvider::CanHandleRequest(const Request& request) { | 20 bool FileBasedResponseProvider::CanHandleRequest(const Request& request) { |
| 21 return response_provider_impl_->CanHandleRequest(request); | 21 return response_provider_impl_->CanHandleRequest(request); |
| 22 } | 22 } |
| 23 | 23 |
| 24 GCDWebServerResponse* FileBasedResponseProvider::GetGCDWebServerResponse( | 24 GCDWebServerResponse* FileBasedResponseProvider::GetGCDWebServerResponse( |
| 25 const Request& request) { | 25 const Request& request) { |
| 26 const base::FilePath file_path = | 26 const base::FilePath file_path = |
| 27 response_provider_impl_->BuildTargetPath(request.url); | 27 response_provider_impl_->BuildTargetPath(request.url); |
| 28 NSString* path = base::SysUTF8ToNSString(file_path.value()); | 28 NSString* path = base::SysUTF8ToNSString(file_path.value()); |
| 29 return [GCDWebServerFileResponse responseWithFile:path]; | 29 return [GCDWebServerFileResponse responseWithFile:path]; |
| 30 } | 30 } |
| 31 | 31 |
| 32 } // namespace web | 32 } // namespace web |
| OLD | NEW |