| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |