| 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 "mojo/shell/test_package_manager.h" | 5 #include "mojo/shell/test_package_manager.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | |
| 8 #include "mojo/shell/fetcher.h" | |
| 9 #include "url/gurl.h" | |
| 10 | |
| 11 namespace mojo { | 7 namespace mojo { |
| 12 namespace shell { | 8 namespace shell { |
| 9 namespace test { |
| 13 | 10 |
| 14 TestPackageManager::TestPackageManager() {} | 11 TestPackageManager::TestPackageManager() {} |
| 15 TestPackageManager::~TestPackageManager() {} | 12 TestPackageManager::~TestPackageManager() {} |
| 16 | 13 |
| 17 void TestPackageManager::RegisterContentHandler( | 14 void TestPackageManager::SetApplicationManager(ApplicationManager* manager) {} |
| 18 const std::string& mime_type, | |
| 19 const GURL& content_handler_url) { | |
| 20 DCHECK(content_handler_url.is_valid()) | |
| 21 << "Content handler URL is invalid for mime type " << mime_type; | |
| 22 mime_type_to_url_[mime_type] = content_handler_url; | |
| 23 } | |
| 24 | |
| 25 void TestPackageManager::SetApplicationManager(ApplicationManager* manager) { | |
| 26 } | |
| 27 | |
| 28 void TestPackageManager::FetchRequest( | 15 void TestPackageManager::FetchRequest( |
| 29 URLRequestPtr request, | 16 URLRequestPtr request, |
| 30 const Fetcher::FetchCallback& loader_callback) {} | 17 const Fetcher::FetchCallback& loader_callback) {} |
| 31 | 18 uint32_t TestPackageManager::HandleWithContentHandler( |
| 32 bool TestPackageManager::HandleWithContentHandler( | |
| 33 Fetcher* fetcher, | 19 Fetcher* fetcher, |
| 34 const GURL& url, | 20 const Identity& source, |
| 35 base::TaskRunner* task_runner, | 21 const GURL& target_url, |
| 36 URLResponsePtr* new_response, | 22 const CapabilityFilter& target_filter, |
| 37 GURL* content_handler_url, | 23 InterfaceRequest<Application>* application_request) { |
| 38 std::string* qualifier) { | 24 return 0; |
| 39 MimeTypeToURLMap::iterator iter = mime_type_to_url_.find(fetcher->MimeType()); | |
| 40 if (iter != mime_type_to_url_.end()) { | |
| 41 *new_response = fetcher->AsURLResponse(task_runner, 0); | |
| 42 *content_handler_url = iter->second; | |
| 43 *qualifier = (*new_response)->site.To<std::string>(); | |
| 44 return true; | |
| 45 } | |
| 46 return false; | |
| 47 } | 25 } |
| 48 | 26 |
| 27 } // namespace test |
| 49 } // namespace shell | 28 } // namespace shell |
| 50 } // namespace mojo | 29 } // namespace mojo |
| OLD | NEW |