| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/manifest_handlers/content_scripts_handler.h" | 5 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 if (content_script->HasKey(keys::kAllFrames)) { | 103 if (content_script->HasKey(keys::kAllFrames)) { |
| 104 bool all_frames = false; | 104 bool all_frames = false; |
| 105 if (!content_script->GetBoolean(keys::kAllFrames, &all_frames)) { | 105 if (!content_script->GetBoolean(keys::kAllFrames, &all_frames)) { |
| 106 *error = ErrorUtils::FormatErrorMessageUTF16( | 106 *error = ErrorUtils::FormatErrorMessageUTF16( |
| 107 errors::kInvalidAllFrames, base::IntToString(definition_index)); | 107 errors::kInvalidAllFrames, base::IntToString(definition_index)); |
| 108 return false; | 108 return false; |
| 109 } | 109 } |
| 110 result->set_match_all_frames(all_frames); | 110 result->set_match_all_frames(all_frames); |
| 111 } | 111 } |
| 112 | 112 |
| 113 // match about blank |
| 114 if (content_script->HasKey(keys::kMatchAboutBlank)) { |
| 115 bool match_about_blank = false; |
| 116 if (!content_script->GetBoolean(keys::kMatchAboutBlank, |
| 117 &match_about_blank)) { |
| 118 *error = ErrorUtils::FormatErrorMessageUTF16( |
| 119 errors::kInvalidMatchAboutBlank, base::IntToString(definition_index)); |
| 120 return false; |
| 121 } |
| 122 result->set_match_about_blank(match_about_blank); |
| 123 } |
| 124 |
| 113 // matches (required) | 125 // matches (required) |
| 114 const base::ListValue* matches = NULL; | 126 const base::ListValue* matches = NULL; |
| 115 if (!content_script->GetList(keys::kMatches, &matches)) { | 127 if (!content_script->GetList(keys::kMatches, &matches)) { |
| 116 *error = ErrorUtils::FormatErrorMessageUTF16( | 128 *error = ErrorUtils::FormatErrorMessageUTF16( |
| 117 errors::kInvalidMatches, | 129 errors::kInvalidMatches, |
| 118 base::IntToString(definition_index)); | 130 base::IntToString(definition_index)); |
| 119 return false; | 131 return false; |
| 120 } | 132 } |
| 121 | 133 |
| 122 if (matches->GetSize() == 0) { | 134 if (matches->GetSize() == 0) { |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 if (!IsScriptValid(path, css_script.relative_path(), | 471 if (!IsScriptValid(path, css_script.relative_path(), |
| 460 IDS_EXTENSION_LOAD_CSS_FAILED, error)) | 472 IDS_EXTENSION_LOAD_CSS_FAILED, error)) |
| 461 return false; | 473 return false; |
| 462 } | 474 } |
| 463 } | 475 } |
| 464 | 476 |
| 465 return true; | 477 return true; |
| 466 } | 478 } |
| 467 | 479 |
| 468 } // namespace extensions | 480 } // namespace extensions |
| OLD | NEW |