| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 script->add_glob(value); | 108 script->add_glob(value); |
| 109 } else if (GetDeclarationValue(line, kExcludeDeclaration, &value)) { | 109 } else if (GetDeclarationValue(line, kExcludeDeclaration, &value)) { |
| 110 ReplaceSubstringsAfterOffset(&value, 0, "\\", "\\\\"); | 110 ReplaceSubstringsAfterOffset(&value, 0, "\\", "\\\\"); |
| 111 ReplaceSubstringsAfterOffset(&value, 0, "?", "\\?"); | 111 ReplaceSubstringsAfterOffset(&value, 0, "?", "\\?"); |
| 112 script->add_exclude_glob(value); | 112 script->add_exclude_glob(value); |
| 113 } else if (GetDeclarationValue(line, kNamespaceDeclaration, &value)) { | 113 } else if (GetDeclarationValue(line, kNamespaceDeclaration, &value)) { |
| 114 script->set_name_space(value); | 114 script->set_name_space(value); |
| 115 } else if (GetDeclarationValue(line, kNameDeclaration, &value)) { | 115 } else if (GetDeclarationValue(line, kNameDeclaration, &value)) { |
| 116 script->set_name(value); | 116 script->set_name(value); |
| 117 } else if (GetDeclarationValue(line, kVersionDeclaration, &value)) { | 117 } else if (GetDeclarationValue(line, kVersionDeclaration, &value)) { |
| 118 base::Version version(value); | 118 Version version(value); |
| 119 if (version.IsValid()) | 119 if (version.IsValid()) |
| 120 script->set_version(version.GetString()); | 120 script->set_version(version.GetString()); |
| 121 } else if (GetDeclarationValue(line, kDescriptionDeclaration, &value)) { | 121 } else if (GetDeclarationValue(line, kDescriptionDeclaration, &value)) { |
| 122 script->set_description(value); | 122 script->set_description(value); |
| 123 } else if (GetDeclarationValue(line, kMatchDeclaration, &value)) { | 123 } else if (GetDeclarationValue(line, kMatchDeclaration, &value)) { |
| 124 URLPattern pattern(UserScript::ValidUserScriptSchemes()); | 124 URLPattern pattern(UserScript::ValidUserScriptSchemes()); |
| 125 if (URLPattern::PARSE_SUCCESS != pattern.Parse(value)) | 125 if (URLPattern::PARSE_SUCCESS != pattern.Parse(value)) |
| 126 return false; | 126 return false; |
| 127 script->add_url_pattern(pattern); | 127 script->add_url_pattern(pattern); |
| 128 } else if (GetDeclarationValue(line, kExcludeMatchDeclaration, &value)) { | 128 } else if (GetDeclarationValue(line, kExcludeMatchDeclaration, &value)) { |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |