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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 script->add_glob(value); | 100 script->add_glob(value); |
101 } else if (GetDeclarationValue(line, kExcludeDeclaration, &value)) { | 101 } else if (GetDeclarationValue(line, kExcludeDeclaration, &value)) { |
102 ReplaceSubstringsAfterOffset(&value, 0, "\\", "\\\\"); | 102 ReplaceSubstringsAfterOffset(&value, 0, "\\", "\\\\"); |
103 ReplaceSubstringsAfterOffset(&value, 0, "?", "\\?"); | 103 ReplaceSubstringsAfterOffset(&value, 0, "?", "\\?"); |
104 script->add_exclude_glob(value); | 104 script->add_exclude_glob(value); |
105 } else if (GetDeclarationValue(line, kNamespaceDeclaration, &value)) { | 105 } else if (GetDeclarationValue(line, kNamespaceDeclaration, &value)) { |
106 script->set_name_space(value); | 106 script->set_name_space(value); |
107 } else if (GetDeclarationValue(line, kNameDeclaration, &value)) { | 107 } else if (GetDeclarationValue(line, kNameDeclaration, &value)) { |
108 script->set_name(value); | 108 script->set_name(value); |
109 } else if (GetDeclarationValue(line, kVersionDeclaration, &value)) { | 109 } else if (GetDeclarationValue(line, kVersionDeclaration, &value)) { |
110 scoped_ptr<Version> version(Version::GetVersionFromString(value)); | 110 Version version(value); |
111 if (version.get()) | 111 if (version.IsValid()) |
112 script->set_version(version->GetString()); | 112 script->set_version(version.GetString()); |
113 } else if (GetDeclarationValue(line, kDescriptionDeclaration, &value)) { | 113 } else if (GetDeclarationValue(line, kDescriptionDeclaration, &value)) { |
114 script->set_description(value); | 114 script->set_description(value); |
115 } else if (GetDeclarationValue(line, kMatchDeclaration, &value)) { | 115 } else if (GetDeclarationValue(line, kMatchDeclaration, &value)) { |
116 URLPattern pattern(UserScript::kValidUserScriptSchemes); | 116 URLPattern pattern(UserScript::kValidUserScriptSchemes); |
117 if (URLPattern::PARSE_SUCCESS != pattern.Parse(value)) | 117 if (URLPattern::PARSE_SUCCESS != pattern.Parse(value)) |
118 return false; | 118 return false; |
119 script->add_url_pattern(pattern); | 119 script->add_url_pattern(pattern); |
120 } else if (GetDeclarationValue(line, kExcludeMatchDeclaration, &value)) { | 120 } else if (GetDeclarationValue(line, kExcludeMatchDeclaration, &value)) { |
121 URLPattern exclude(UserScript::kValidUserScriptSchemes); | 121 URLPattern exclude(UserScript::kValidUserScriptSchemes); |
122 if (URLPattern::PARSE_SUCCESS != exclude.Parse(value)) | 122 if (URLPattern::PARSE_SUCCESS != exclude.Parse(value)) |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 if (!handle) | 431 if (!handle) |
432 return; | 432 return; |
433 | 433 |
434 base::SharedMemoryHandle handle_for_process; | 434 base::SharedMemoryHandle handle_for_process; |
435 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) | 435 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) |
436 return; // This can legitimately fail if the renderer asserts at startup. | 436 return; // This can legitimately fail if the renderer asserts at startup. |
437 | 437 |
438 if (base::SharedMemory::IsHandleValid(handle_for_process)) | 438 if (base::SharedMemory::IsHandleValid(handle_for_process)) |
439 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process)); | 439 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process)); |
440 } | 440 } |
OLD | NEW |