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 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 | 940 |
941 // Initialize the permissions (optional). | 941 // Initialize the permissions (optional). |
942 if (source.HasKey(keys::kPermissions)) { | 942 if (source.HasKey(keys::kPermissions)) { |
943 ListValue* permissions = NULL; | 943 ListValue* permissions = NULL; |
944 if (!source.GetList(keys::kPermissions, &permissions)) { | 944 if (!source.GetList(keys::kPermissions, &permissions)) { |
945 *error = ExtensionErrorUtils::FormatErrorMessage( | 945 *error = ExtensionErrorUtils::FormatErrorMessage( |
946 errors::kInvalidPermissions, ""); | 946 errors::kInvalidPermissions, ""); |
947 return false; | 947 return false; |
948 } | 948 } |
949 | 949 |
950 if (permissions->GetSize() == 0) { | |
951 ExtensionErrorReporter::GetInstance()->ReportError( | |
952 errors::kInvalidPermissionCountWarning, false); | |
953 } | |
954 | |
955 for (size_t i = 0; i < permissions->GetSize(); ++i) { | 950 for (size_t i = 0; i < permissions->GetSize(); ++i) { |
956 std::string permission_str; | 951 std::string permission_str; |
957 if (!permissions->GetString(i, &permission_str)) { | 952 if (!permissions->GetString(i, &permission_str)) { |
958 *error = ExtensionErrorUtils::FormatErrorMessage( | 953 *error = ExtensionErrorUtils::FormatErrorMessage( |
959 errors::kInvalidPermission, IntToString(i)); | 954 errors::kInvalidPermission, IntToString(i)); |
960 return false; | 955 return false; |
961 } | 956 } |
962 | 957 |
963 // Check if it's a module permission. If so, enable that permission. | 958 // Check if it's a module permission. If so, enable that permission. |
964 if (IsAPIPermission(permission_str)) { | 959 if (IsAPIPermission(permission_str)) { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 UserScript::PatternList::const_iterator pattern = | 1126 UserScript::PatternList::const_iterator pattern = |
1132 content_script->url_patterns().begin(); | 1127 content_script->url_patterns().begin(); |
1133 for (; pattern != content_script->url_patterns().end(); ++pattern) { | 1128 for (; pattern != content_script->url_patterns().end(); ++pattern) { |
1134 if (pattern->match_subdomains() && pattern->host().empty()) | 1129 if (pattern->match_subdomains() && pattern->host().empty()) |
1135 return true; | 1130 return true; |
1136 } | 1131 } |
1137 } | 1132 } |
1138 | 1133 |
1139 return false; | 1134 return false; |
1140 } | 1135 } |
OLD | NEW |