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

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

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 &resource_id)) { 196 &resource_id)) {
197 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 197 const ResourceBundle& rb = ResourceBundle::GetSharedInstance();
198 content = rb.GetRawDataResource(resource_id).as_string(); 198 content = rb.GetRawDataResource(resource_id).as_string();
199 } else { 199 } else {
200 LOG(WARNING) << "Failed to get file path to " 200 LOG(WARNING) << "Failed to get file path to "
201 << script_file->relative_path().value() << " from " 201 << script_file->relative_path().value() << " from "
202 << script_file->extension_root().value(); 202 << script_file->extension_root().value();
203 return false; 203 return false;
204 } 204 }
205 } else { 205 } else {
206 if (!file_util::ReadFileToString(path, &content)) { 206 if (!base::ReadFileToString(path, &content)) {
207 LOG(WARNING) << "Failed to load user script file: " << path.value(); 207 LOG(WARNING) << "Failed to load user script file: " << path.value();
208 return false; 208 return false;
209 } 209 }
210 } 210 }
211 211
212 // Localize the content. 212 // Localize the content.
213 if (localization_messages) { 213 if (localization_messages) {
214 std::string error; 214 std::string error;
215 MessageBundle::ReplaceMessagesWithExternalDictionary( 215 MessageBundle::ReplaceMessagesWithExternalDictionary(
216 *localization_messages, &content, &error); 216 *localization_messages, &content, &error);
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 451
452 base::SharedMemoryHandle handle_for_process; 452 base::SharedMemoryHandle handle_for_process;
453 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) 453 if (!shared_memory->ShareToProcess(handle, &handle_for_process))
454 return; // This can legitimately fail if the renderer asserts at startup. 454 return; // This can legitimately fail if the renderer asserts at startup.
455 455
456 if (base::SharedMemory::IsHandleValid(handle_for_process)) 456 if (base::SharedMemory::IsHandleValid(handle_for_process))
457 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process)); 457 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process));
458 } 458 }
459 459
460 } // namespace extensions 460 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/sandboxed_unpacker.cc ('k') | chrome/browser/feedback/feedback_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698