OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/common/extensions/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
6 | 6 |
7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 if (!content_script->GetString(keys::kRunAt, &run_location)) { | 189 if (!content_script->GetString(keys::kRunAt, &run_location)) { |
190 *error = ExtensionErrorUtils::FormatErrorMessage(errors::kInvalidRunAt, | 190 *error = ExtensionErrorUtils::FormatErrorMessage(errors::kInvalidRunAt, |
191 IntToString(definition_index)); | 191 IntToString(definition_index)); |
192 return false; | 192 return false; |
193 } | 193 } |
194 | 194 |
195 if (run_location == values::kRunAtDocumentStart) { | 195 if (run_location == values::kRunAtDocumentStart) { |
196 result->set_run_location(UserScript::DOCUMENT_START); | 196 result->set_run_location(UserScript::DOCUMENT_START); |
197 } else if (run_location == values::kRunAtDocumentEnd) { | 197 } else if (run_location == values::kRunAtDocumentEnd) { |
198 result->set_run_location(UserScript::DOCUMENT_END); | 198 result->set_run_location(UserScript::DOCUMENT_END); |
| 199 } else if (run_location == values::kRunAtDocumentIdle) { |
| 200 result->set_run_location(UserScript::DOCUMENT_IDLE); |
199 } else { | 201 } else { |
200 *error = ExtensionErrorUtils::FormatErrorMessage(errors::kInvalidRunAt, | 202 *error = ExtensionErrorUtils::FormatErrorMessage(errors::kInvalidRunAt, |
201 IntToString(definition_index)); | 203 IntToString(definition_index)); |
202 return false; | 204 return false; |
203 } | 205 } |
204 } | 206 } |
205 | 207 |
206 // matches | 208 // matches |
207 ListValue* matches = NULL; | 209 ListValue* matches = NULL; |
208 if (!content_script->GetList(keys::kMatches, &matches)) { | 210 if (!content_script->GetList(keys::kMatches, &matches)) { |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 UserScript::PatternList::const_iterator pattern = | 1180 UserScript::PatternList::const_iterator pattern = |
1179 content_script->url_patterns().begin(); | 1181 content_script->url_patterns().begin(); |
1180 for (; pattern != content_script->url_patterns().end(); ++pattern) { | 1182 for (; pattern != content_script->url_patterns().end(); ++pattern) { |
1181 if (pattern->match_subdomains() && pattern->host().empty()) | 1183 if (pattern->match_subdomains() && pattern->host().empty()) |
1182 return true; | 1184 return true; |
1183 } | 1185 } |
1184 } | 1186 } |
1185 | 1187 |
1186 return false; | 1188 return false; |
1187 } | 1189 } |
OLD | NEW |