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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 | 95 |
96 if (!in_metadata) { | 96 if (!in_metadata) { |
97 if (line.starts_with(kUserScriptBegin)) | 97 if (line.starts_with(kUserScriptBegin)) |
98 in_metadata = true; | 98 in_metadata = true; |
99 } else { | 99 } else { |
100 if (line.starts_with(kUserScriptEng)) | 100 if (line.starts_with(kUserScriptEng)) |
101 break; | 101 break; |
102 | 102 |
103 std::string value; | 103 std::string value; |
104 if (GetDeclarationValue(line, kIncludeDeclaration, &value)) { | 104 if (GetDeclarationValue(line, kIncludeDeclaration, &value)) { |
105 // We escape some characters that MatchPattern() considers special. | 105 if (value == "about:blank") { |
106 ReplaceSubstringsAfterOffset(&value, 0, "\\", "\\\\"); | 106 script->set_match_about_blank(true); |
not at google - send to devlin
2014/04/21 22:34:41
to answer your question: it might be easy, but it'
robwu
2014/04/21 23:21:46
Done.
| |
107 ReplaceSubstringsAfterOffset(&value, 0, "?", "\\?"); | 107 } else { |
108 script->add_glob(value); | 108 // We escape some characters that MatchPattern() considers special. |
109 ReplaceSubstringsAfterOffset(&value, 0, "\\", "\\\\"); | |
110 ReplaceSubstringsAfterOffset(&value, 0, "?", "\\?"); | |
111 script->add_glob(value); | |
112 } | |
109 } else if (GetDeclarationValue(line, kExcludeDeclaration, &value)) { | 113 } else if (GetDeclarationValue(line, kExcludeDeclaration, &value)) { |
110 ReplaceSubstringsAfterOffset(&value, 0, "\\", "\\\\"); | 114 ReplaceSubstringsAfterOffset(&value, 0, "\\", "\\\\"); |
111 ReplaceSubstringsAfterOffset(&value, 0, "?", "\\?"); | 115 ReplaceSubstringsAfterOffset(&value, 0, "?", "\\?"); |
112 script->add_exclude_glob(value); | 116 script->add_exclude_glob(value); |
113 } else if (GetDeclarationValue(line, kNamespaceDeclaration, &value)) { | 117 } else if (GetDeclarationValue(line, kNamespaceDeclaration, &value)) { |
114 script->set_name_space(value); | 118 script->set_name_space(value); |
115 } else if (GetDeclarationValue(line, kNameDeclaration, &value)) { | 119 } else if (GetDeclarationValue(line, kNameDeclaration, &value)) { |
116 script->set_name(value); | 120 script->set_name(value); |
117 } else if (GetDeclarationValue(line, kVersionDeclaration, &value)) { | 121 } else if (GetDeclarationValue(line, kVersionDeclaration, &value)) { |
118 Version version(value); | 122 Version version(value); |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
457 | 461 |
458 base::SharedMemoryHandle handle_for_process; | 462 base::SharedMemoryHandle handle_for_process; |
459 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) | 463 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) |
460 return; // This can legitimately fail if the renderer asserts at startup. | 464 return; // This can legitimately fail if the renderer asserts at startup. |
461 | 465 |
462 if (base::SharedMemory::IsHandleValid(handle_for_process)) | 466 if (base::SharedMemory::IsHandleValid(handle_for_process)) |
463 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process)); | 467 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process)); |
464 } | 468 } |
465 | 469 |
466 } // namespace extensions | 470 } // namespace extensions |
OLD | NEW |