Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9358)

Unified Diff: chrome/common/extensions/extension_messages.cc

Issue 10073011: Fix the optional permissions API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/extension_messages.cc
diff --git a/chrome/common/extensions/extension_messages.cc b/chrome/common/extensions/extension_messages.cc
index bda807bf4be43809ebc622f1849faa0432b9704e..838943d7527e741c828404de3de221bb743559d0 100644
--- a/chrome/common/extensions/extension_messages.cc
+++ b/chrome/common/extensions/extension_messages.cc
@@ -19,6 +19,9 @@ ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params(
: manifest(extension->manifest()->value()->DeepCopy()),
location(extension->location()),
path(extension->path()),
+ apis(extension->GetActivePermissions()->apis()),
+ explicit_hosts(extension->GetActivePermissions()->explicit_hosts()),
+ scriptable_hosts(extension->GetActivePermissions()->scriptable_hosts()),
id(extension->id()),
creation_flags(extension->creation_flags()) {
}
@@ -30,9 +33,13 @@ scoped_refptr<Extension>
scoped_refptr<Extension> extension(
Extension::Create(path, location, *manifest, creation_flags,
&error));
- if (!extension.get())
+ if (!extension.get()) {
DLOG(ERROR) << "Error deserializing extension: " << error;
+ return extension;
+ }
+ extension->SetActivePermissions(
+ new ExtensionPermissionSet(apis, explicit_hosts, scriptable_hosts));
return extension;
}
@@ -133,6 +140,9 @@ void ParamTraits<ExtensionMsg_Loaded_Params>::Write(Message* m,
WriteParam(m, p.path);
WriteParam(m, *(p.manifest));
WriteParam(m, p.creation_flags);
+ WriteParam(m, p.apis);
+ WriteParam(m, p.explicit_hosts);
+ WriteParam(m, p.scriptable_hosts);
}
bool ParamTraits<ExtensionMsg_Loaded_Params>::Read(const Message* m,
@@ -142,7 +152,10 @@ bool ParamTraits<ExtensionMsg_Loaded_Params>::Read(const Message* m,
return ReadParam(m, iter, &p->location) &&
ReadParam(m, iter, &p->path) &&
ReadParam(m, iter, p->manifest.get()) &&
- ReadParam(m, iter, &p->creation_flags);
+ ReadParam(m, iter, &p->creation_flags) &&
+ ReadParam(m, iter, &p->apis) &&
+ ReadParam(m, iter, &p->explicit_hosts) &&
+ ReadParam(m, iter, &p->scriptable_hosts);
}
void ParamTraits<ExtensionMsg_Loaded_Params>::Log(const param_type& p,

Powered by Google App Engine
This is Rietveld 408576698