OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 script->set_name_space(value); | 105 script->set_name_space(value); |
106 } else if (GetDeclarationValue(line, kNameDeclaration, &value)) { | 106 } else if (GetDeclarationValue(line, kNameDeclaration, &value)) { |
107 script->set_name(value); | 107 script->set_name(value); |
108 } else if (GetDeclarationValue(line, kVersionDeclaration, &value)) { | 108 } else if (GetDeclarationValue(line, kVersionDeclaration, &value)) { |
109 scoped_ptr<Version> version(Version::GetVersionFromString(value)); | 109 scoped_ptr<Version> version(Version::GetVersionFromString(value)); |
110 if (version.get()) | 110 if (version.get()) |
111 script->set_version(version->GetString()); | 111 script->set_version(version->GetString()); |
112 } else if (GetDeclarationValue(line, kDescriptionDeclaration, &value)) { | 112 } else if (GetDeclarationValue(line, kDescriptionDeclaration, &value)) { |
113 script->set_description(value); | 113 script->set_description(value); |
114 } else if (GetDeclarationValue(line, kMatchDeclaration, &value)) { | 114 } else if (GetDeclarationValue(line, kMatchDeclaration, &value)) { |
115 URLPattern pattern(UserScript::kValidUserScriptSchemes); | 115 URLPattern pattern(URLPattern::IGNORE_PORTS, |
116 if (URLPattern::PARSE_SUCCESS != | 116 UserScript::kValidUserScriptSchemes); |
117 pattern.Parse(value, URLPattern::IGNORE_PORTS)) | 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, kRunAtDeclaration, &value)) { | 120 } else if (GetDeclarationValue(line, kRunAtDeclaration, &value)) { |
121 if (value == kRunAtDocumentStartValue) | 121 if (value == kRunAtDocumentStartValue) |
122 script->set_run_location(UserScript::DOCUMENT_START); | 122 script->set_run_location(UserScript::DOCUMENT_START); |
123 else if (value == kRunAtDocumentEndValue) | 123 else if (value == kRunAtDocumentEndValue) |
124 script->set_run_location(UserScript::DOCUMENT_END); | 124 script->set_run_location(UserScript::DOCUMENT_END); |
125 else if (value == kRunAtDocumentIdleValue) | 125 else if (value == kRunAtDocumentIdleValue) |
126 script->set_run_location(UserScript::DOCUMENT_IDLE); | 126 script->set_run_location(UserScript::DOCUMENT_IDLE); |
127 else | 127 else |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 if (!handle) | 424 if (!handle) |
425 return; | 425 return; |
426 | 426 |
427 base::SharedMemoryHandle handle_for_process; | 427 base::SharedMemoryHandle handle_for_process; |
428 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) | 428 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) |
429 return; // This can legitimately fail if the renderer asserts at startup. | 429 return; // This can legitimately fail if the renderer asserts at startup. |
430 | 430 |
431 if (base::SharedMemory::IsHandleValid(handle_for_process)) | 431 if (base::SharedMemory::IsHandleValid(handle_for_process)) |
432 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process)); | 432 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process)); |
433 } | 433 } |
OLD | NEW |