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

Side by Side Diff: extensions/browser/api/execute_code_function.cc

Issue 1902873002: Convert //extensions/browser/api from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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 #ifndef EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_IMPL_H_ 5 #ifndef EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_IMPL_H_
6 #define EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_IMPL_H_ 6 #define EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_IMPL_H_
7 7
8 #include "extensions/browser/api/execute_code_function.h" 8 #include "extensions/browser/api/execute_code_function.h"
9 9
10 #include "extensions/browser/component_extension_resource_manager.h" 10 #include "extensions/browser/component_extension_resource_manager.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 void ExecuteCodeFunction::GetFileURLAndLocalizeCSS( 77 void ExecuteCodeFunction::GetFileURLAndLocalizeCSS(
78 ScriptExecutor::ScriptType script_type, 78 ScriptExecutor::ScriptType script_type,
79 const std::string& data, 79 const std::string& data,
80 const std::string& extension_id, 80 const std::string& extension_id,
81 const base::FilePath& extension_path, 81 const base::FilePath& extension_path,
82 const std::string& extension_default_locale) { 82 const std::string& extension_default_locale) {
83 std::string localized_data = data; 83 std::string localized_data = data;
84 // Check if the file is CSS and needs localization. 84 // Check if the file is CSS and needs localization.
85 if ((script_type == ScriptExecutor::CSS) && !extension_id.empty() && 85 if ((script_type == ScriptExecutor::CSS) && !extension_id.empty() &&
86 (data.find(MessageBundle::kMessageBegin) != std::string::npos)) { 86 (data.find(MessageBundle::kMessageBegin) != std::string::npos)) {
87 scoped_ptr<SubstitutionMap> localization_messages( 87 std::unique_ptr<SubstitutionMap> localization_messages(
88 file_util::LoadMessageBundleSubstitutionMap( 88 file_util::LoadMessageBundleSubstitutionMap(
89 extension_path, extension_id, extension_default_locale)); 89 extension_path, extension_id, extension_default_locale));
90 90
91 // We need to do message replacement on the data, so it has to be mutable. 91 // We need to do message replacement on the data, so it has to be mutable.
92 std::string error; 92 std::string error;
93 MessageBundle::ReplaceMessagesWithExternalDictionary( 93 MessageBundle::ReplaceMessagesWithExternalDictionary(
94 *localization_messages, &localized_data, &error); 94 *localization_messages, &localized_data, &error);
95 } 95 }
96 96
97 file_url_ = net::FilePathToFileURL(resource_.GetFilePath()); 97 file_url_ = net::FilePathToFileURL(resource_.GetFilePath());
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 const base::ListValue& result) { 240 const base::ListValue& result) {
241 if (!error.empty()) 241 if (!error.empty())
242 SetError(error); 242 SetError(error);
243 243
244 SendResponse(error.empty()); 244 SendResponse(error.empty());
245 } 245 }
246 246
247 } // namespace extensions 247 } // namespace extensions
248 248
249 #endif // EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_IMPL_H_ 249 #endif // EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_IMPL_H_
OLDNEW
« no previous file with comments | « extensions/browser/api/execute_code_function.h ('k') | extensions/browser/api/extensions_api_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698