| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 script->add_glob(value); | 92 script->add_glob(value); |
| 93 } else if (GetDeclarationValue(line, kExcludeDeclaration, &value)) { | 93 } else if (GetDeclarationValue(line, kExcludeDeclaration, &value)) { |
| 94 base::ReplaceSubstringsAfterOffset(&value, 0, "\\", "\\\\"); | 94 base::ReplaceSubstringsAfterOffset(&value, 0, "\\", "\\\\"); |
| 95 base::ReplaceSubstringsAfterOffset(&value, 0, "?", "\\?"); | 95 base::ReplaceSubstringsAfterOffset(&value, 0, "?", "\\?"); |
| 96 script->add_exclude_glob(value); | 96 script->add_exclude_glob(value); |
| 97 } else if (GetDeclarationValue(line, kNamespaceDeclaration, &value)) { | 97 } else if (GetDeclarationValue(line, kNamespaceDeclaration, &value)) { |
| 98 script->set_name_space(value); | 98 script->set_name_space(value); |
| 99 } else if (GetDeclarationValue(line, kNameDeclaration, &value)) { | 99 } else if (GetDeclarationValue(line, kNameDeclaration, &value)) { |
| 100 script->set_name(value); | 100 script->set_name(value); |
| 101 } else if (GetDeclarationValue(line, kVersionDeclaration, &value)) { | 101 } else if (GetDeclarationValue(line, kVersionDeclaration, &value)) { |
| 102 base::Version version(value); | 102 Version version(value); |
| 103 if (version.IsValid()) | 103 if (version.IsValid()) |
| 104 script->set_version(version.GetString()); | 104 script->set_version(version.GetString()); |
| 105 } else if (GetDeclarationValue(line, kDescriptionDeclaration, &value)) { | 105 } else if (GetDeclarationValue(line, kDescriptionDeclaration, &value)) { |
| 106 script->set_description(value); | 106 script->set_description(value); |
| 107 } else if (GetDeclarationValue(line, kMatchDeclaration, &value)) { | 107 } else if (GetDeclarationValue(line, kMatchDeclaration, &value)) { |
| 108 URLPattern pattern(UserScript::ValidUserScriptSchemes()); | 108 URLPattern pattern(UserScript::ValidUserScriptSchemes()); |
| 109 if (URLPattern::PARSE_SUCCESS != pattern.Parse(value)) | 109 if (URLPattern::PARSE_SUCCESS != pattern.Parse(value)) |
| 110 return false; | 110 return false; |
| 111 script->add_url_pattern(pattern); | 111 script->add_url_pattern(pattern); |
| 112 } else if (GetDeclarationValue(line, kExcludeMatchDeclaration, &value)) { | 112 } else if (GetDeclarationValue(line, kExcludeMatchDeclaration, &value)) { |
| (...skipping 284 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 |