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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "grit/webui_resources_map.h" | 10 #include "grit/webui_resources_map.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 if (idr == IDR_WEBUI_CSS_TEXT_DEFAULTS) { | 57 if (idr == IDR_WEBUI_CSS_TEXT_DEFAULTS) { |
58 std::vector<std::string> placeholders; | 58 std::vector<std::string> placeholders; |
59 placeholders.push_back(webui::GetTextDirection()); // $1 | 59 placeholders.push_back(webui::GetTextDirection()); // $1 |
60 placeholders.push_back(webui::GetFontFamily()); // $2 | 60 placeholders.push_back(webui::GetFontFamily()); // $2 |
61 placeholders.push_back(webui::GetFontSize()); // $3 | 61 placeholders.push_back(webui::GetFontSize()); // $3 |
62 | 62 |
63 const std::string& chrome_shared = | 63 const std::string& chrome_shared = |
64 web_client->GetDataResource(idr, ui::SCALE_FACTOR_NONE).as_string(); | 64 web_client->GetDataResource(idr, ui::SCALE_FACTOR_NONE).as_string(); |
65 std::string replaced = | 65 std::string replaced = |
66 ReplaceStringPlaceholders(chrome_shared, placeholders, nullptr); | 66 base::ReplaceStringPlaceholders(chrome_shared, placeholders, nullptr); |
67 bytes = base::RefCountedString::TakeString(&replaced); | 67 bytes = base::RefCountedString::TakeString(&replaced); |
68 } else { | 68 } else { |
69 bytes = web_client->GetDataResourceBytes(idr); | 69 bytes = web_client->GetDataResourceBytes(idr); |
70 } | 70 } |
71 | 71 |
72 callback.Run(bytes.get()); | 72 callback.Run(bytes.get()); |
73 } | 73 } |
74 | 74 |
75 std::string SharedResourcesDataSourceIOS::GetMimeType( | 75 std::string SharedResourcesDataSourceIOS::GetMimeType( |
76 const std::string& path) const { | 76 const std::string& path) const { |
77 std::string mime_type; | 77 std::string mime_type; |
78 net::GetMimeTypeFromFile(base::FilePath().AppendASCII(path), &mime_type); | 78 net::GetMimeTypeFromFile(base::FilePath().AppendASCII(path), &mime_type); |
79 return mime_type; | 79 return mime_type; |
80 } | 80 } |
81 | 81 |
82 } // namespace web | 82 } // namespace web |
OLD | NEW |