| OLD | NEW |
| 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 "extensions/browser/user_script_loader.h" | 5 #include "extensions/browser/user_script_loader.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/version.h" | 10 #include "base/version.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 bool GetDeclarationValue(const base::StringPiece& line, | 28 bool GetDeclarationValue(const base::StringPiece& line, |
| 29 const base::StringPiece& prefix, | 29 const base::StringPiece& prefix, |
| 30 std::string* value) { | 30 std::string* value) { |
| 31 base::StringPiece::size_type index = line.find(prefix); | 31 base::StringPiece::size_type index = line.find(prefix); |
| 32 if (index == base::StringPiece::npos) | 32 if (index == base::StringPiece::npos) |
| 33 return false; | 33 return false; |
| 34 | 34 |
| 35 std::string temp(line.data() + index + prefix.length(), | 35 std::string temp(line.data() + index + prefix.length(), |
| 36 line.length() - index - prefix.length()); | 36 line.length() - index - prefix.length()); |
| 37 | 37 |
| 38 if (temp.empty() || !IsWhitespace(temp[0])) | 38 if (temp.empty() || !base::IsUnicodeWhitespace(temp[0])) |
| 39 return false; | 39 return false; |
| 40 | 40 |
| 41 base::TrimWhitespaceASCII(temp, base::TRIM_ALL, value); | 41 base::TrimWhitespaceASCII(temp, base::TRIM_ALL, value); |
| 42 return true; | 42 return true; |
| 43 } | 43 } |
| 44 | 44 |
| 45 } // namespace | 45 } // namespace |
| 46 | 46 |
| 47 // static | 47 // static |
| 48 bool UserScriptLoader::ParseMetadataHeader(const base::StringPiece& script_text, | 48 bool UserScriptLoader::ParseMetadataHeader(const base::StringPiece& script_text, |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) | 397 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) |
| 398 return; // This can legitimately fail if the renderer asserts at startup. | 398 return; // This can legitimately fail if the renderer asserts at startup. |
| 399 | 399 |
| 400 if (base::SharedMemory::IsHandleValid(handle_for_process)) { | 400 if (base::SharedMemory::IsHandleValid(handle_for_process)) { |
| 401 process->Send(new ExtensionMsg_UpdateUserScripts( | 401 process->Send(new ExtensionMsg_UpdateUserScripts( |
| 402 handle_for_process, host_id(), changed_hosts, whitelisted_only)); | 402 handle_for_process, host_id(), changed_hosts, whitelisted_only)); |
| 403 } | 403 } |
| 404 } | 404 } |
| 405 | 405 |
| 406 } // namespace extensions | 406 } // namespace extensions |
| OLD | NEW |