Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: ios/web/webui/shared_resources_data_source_ios.cc

Issue 1227413007: Move ReplaceStringPlaceholders to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@join
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/renderer/i18n_custom_bindings.cc ('k') | remoting/host/disconnect_window_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « extensions/renderer/i18n_custom_bindings.cc ('k') | remoting/host/disconnect_window_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698