| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/webui/shared_resources_data_source_ios.h" | 5 #include "ios/web/webui/shared_resources_data_source_ios.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "ios/web/public/web_client.h" | 12 #include "ios/web/public/web_client.h" |
| 13 #include "net/base/mime_util.h" | 13 #include "net/base/mime_util.h" |
| 14 #include "ui/base/webui/web_ui_util.h" | 14 #include "ui/base/webui/web_ui_util.h" |
| 15 #include "ui/resources/grit/webui_resources.h" | 15 #include "ui/resources/grit/webui_resources.h" |
| 16 #include "ui/resources/grit/webui_resources_map.h" | 16 #include "ui/resources/grit/webui_resources_map.h" |
| 17 | 17 |
| 18 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 19 #error "This file requires ARC support." |
| 20 #endif |
| 21 |
| 18 namespace web { | 22 namespace web { |
| 19 | 23 |
| 20 namespace { | 24 namespace { |
| 21 | 25 |
| 22 // Value duplicated from content/public/common/url_constants.h | 26 // Value duplicated from content/public/common/url_constants.h |
| 23 // TODO(stuartmorgan): Revisit how to share this in a more maintainable way. | 27 // TODO(stuartmorgan): Revisit how to share this in a more maintainable way. |
| 24 const char kWebUIResourcesHost[] = "resources"; | 28 const char kWebUIResourcesHost[] = "resources"; |
| 25 | 29 |
| 26 int PathToIDR(const std::string& path) { | 30 int PathToIDR(const std::string& path) { |
| 27 int idr = -1; | 31 int idr = -1; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 69 } |
| 66 | 70 |
| 67 std::string SharedResourcesDataSourceIOS::GetMimeType( | 71 std::string SharedResourcesDataSourceIOS::GetMimeType( |
| 68 const std::string& path) const { | 72 const std::string& path) const { |
| 69 std::string mime_type; | 73 std::string mime_type; |
| 70 net::GetMimeTypeFromFile(base::FilePath().AppendASCII(path), &mime_type); | 74 net::GetMimeTypeFromFile(base::FilePath().AppendASCII(path), &mime_type); |
| 71 return mime_type; | 75 return mime_type; |
| 72 } | 76 } |
| 73 | 77 |
| 74 } // namespace web | 78 } // namespace web |
| OLD | NEW |