Index: extensions/common/permissions/set_disjunction_permission.h |
diff --git a/extensions/common/permissions/set_disjunction_permission.h b/extensions/common/permissions/set_disjunction_permission.h |
index 3a3e9c575296a63d8530f87160c1eda48976afec..b13294f3a38eedcb390da6a946293756a8daa493 100644 |
--- a/extensions/common/permissions/set_disjunction_permission.h |
+++ b/extensions/common/permissions/set_disjunction_permission.h |
@@ -9,6 +9,7 @@ |
#include <set> |
#include <string> |
+#include "base/json/json_writer.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/values.h" |
#include "extensions/common/extension_messages.h" |
@@ -112,8 +113,10 @@ class SetDisjunctionPermission : public APIPermission { |
return result->data_set_.empty() ? NULL : result.release(); |
} |
- virtual bool FromValue(const base::Value* value, |
- std::string* error) OVERRIDE { |
+ virtual bool FromValue( |
+ const base::Value* value, |
+ std::string* error, |
+ std::vector<std::string>* unhandled_permissions) OVERRIDE { |
data_set_.clear(); |
const base::ListValue* list = NULL; |
@@ -123,6 +126,7 @@ class SetDisjunctionPermission : public APIPermission { |
return false; |
} |
+ bool unhandled = false; |
for (size_t i = 0; i < list->GetSize(); ++i) { |
const base::Value* item_value = NULL; |
bool got_item = list->Get(i, &item_value); |
@@ -130,13 +134,21 @@ class SetDisjunctionPermission : public APIPermission { |
DCHECK(item_value); |
PermissionDataType data; |
- if (!data.FromValue(item_value)) { |
- if (error) |
- *error = "Cannot parse an item from the permission list"; |
- return false; |
+ if (data.FromValue(item_value)) { |
+ data_set_.insert(data); |
+ } else { |
+ unhandled = true; |
vandebo (ex-Chrome)
2014/04/01 23:11:04
This is the meat of the change.
|
+ if (unhandled_permissions) { |
+ std::string unknown_permission; |
+ base::JSONWriter::Write(item_value, &unknown_permission); |
+ unhandled_permissions->push_back(unknown_permission); |
+ } |
} |
- |
- data_set_.insert(data); |
+ } |
+ if (unhandled && !unhandled_permissions) { |
Yoyo Zhou
2014/04/02 00:31:31
Seems like you can put this inside the for loop an
vandebo (ex-Chrome)
2014/04/02 16:46:59
Done.
|
+ if (error) |
+ *error = "Cannot parse an item from the permission list"; |
+ return false; |
} |
return true; |
} |