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

Side by Side Diff: chrome/browser/extensions/user_script_master.cc

Issue 89243003: Move EmptyString, kWhitespace and the BOM to base. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/extensions/user_script_master.h" 5 #include "chrome/browser/extensions/user_script_master.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 if (localization_messages) { 214 if (localization_messages) {
215 std::string error; 215 std::string error;
216 MessageBundle::ReplaceMessagesWithExternalDictionary( 216 MessageBundle::ReplaceMessagesWithExternalDictionary(
217 *localization_messages, &content, &error); 217 *localization_messages, &content, &error);
218 if (!error.empty()) { 218 if (!error.empty()) {
219 LOG(WARNING) << "Failed to replace messages in script: " << error; 219 LOG(WARNING) << "Failed to replace messages in script: " << error;
220 } 220 }
221 } 221 }
222 222
223 // Remove BOM from the content. 223 // Remove BOM from the content.
224 std::string::size_type index = content.find(kUtf8ByteOrderMark); 224 std::string::size_type index = content.find(base::kUtf8ByteOrderMark);
225 if (index == 0) { 225 if (index == 0) {
226 script_file->set_content(content.substr(strlen(kUtf8ByteOrderMark))); 226 script_file->set_content(content.substr(strlen(base::kUtf8ByteOrderMark)));
227 } else { 227 } else {
228 script_file->set_content(content); 228 script_file->set_content(content);
229 } 229 }
230 230
231 return true; 231 return true;
232 } 232 }
233 233
234 void UserScriptMaster::ScriptReloader::LoadUserScripts( 234 void UserScriptMaster::ScriptReloader::LoadUserScripts(
235 UserScriptList* user_scripts) { 235 UserScriptList* user_scripts) {
236 for (size_t i = 0; i < user_scripts->size(); ++i) { 236 for (size_t i = 0; i < user_scripts->size(); ++i) {
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 458
459 base::SharedMemoryHandle handle_for_process; 459 base::SharedMemoryHandle handle_for_process;
460 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) 460 if (!shared_memory->ShareToProcess(handle, &handle_for_process))
461 return; // This can legitimately fail if the renderer asserts at startup. 461 return; // This can legitimately fail if the renderer asserts at startup.
462 462
463 if (base::SharedMemory::IsHandleValid(handle_for_process)) 463 if (base::SharedMemory::IsHandleValid(handle_for_process))
464 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process)); 464 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process));
465 } 465 }
466 466
467 } // namespace extensions 467 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/drive/drive_api_util.cc ('k') | chrome/browser/history/url_index_private_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698