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