Commit 15379646 authored by jstritar@chromium.org's avatar jstritar@chromium.org

Simplify ExtensionMsg_Loaded_Params message interface.

BUG=none
TEST=extension browser tests


Review URL: http://codereview.chromium.org/7619011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96468 0039d316-1c4b-4281-b951-d872f2087c98
parent cefa749d
...@@ -1390,8 +1390,7 @@ void ExtensionService::NotifyExtensionLoaded(const Extension* extension) { ...@@ -1390,8 +1390,7 @@ void ExtensionService::NotifyExtensionLoaded(const Extension* extension) {
Profile::FromBrowserContext(host->browser_context()); Profile::FromBrowserContext(host->browser_context());
if (host_profile->GetOriginalProfile() == profile_->GetOriginalProfile()) { if (host_profile->GetOriginalProfile() == profile_->GetOriginalProfile()) {
host->Send( host->Send(
new ExtensionMsg_Loaded(ExtensionMsg_Loaded_Params( new ExtensionMsg_Loaded(ExtensionMsg_Loaded_Params(extension)));
extension, extension->GetActivePermissions())));
} }
} }
...@@ -2455,8 +2454,7 @@ void ExtensionService::Observe(int type, ...@@ -2455,8 +2454,7 @@ void ExtensionService::Observe(int type,
// Loaded extensions. // Loaded extensions.
for (size_t i = 0; i < extensions_.size(); ++i) { for (size_t i = 0; i < extensions_.size(); ++i) {
process->Send(new ExtensionMsg_Loaded( process->Send(new ExtensionMsg_Loaded(
ExtensionMsg_Loaded_Params( ExtensionMsg_Loaded_Params(extensions_[i])));
extensions_[i], extensions_[i]->GetActivePermissions())));
} }
break; break;
} }
......
...@@ -8,30 +8,29 @@ ...@@ -8,30 +8,29 @@
#include "content/common/common_param_traits.h" #include "content/common/common_param_traits.h"
ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params() ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params()
: location(Extension::INVALID) { : location(Extension::INVALID) {}
}
ExtensionMsg_Loaded_Params::~ExtensionMsg_Loaded_Params() { ExtensionMsg_Loaded_Params::~ExtensionMsg_Loaded_Params() {}
}
ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params( ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params(
const ExtensionMsg_Loaded_Params& other) const ExtensionMsg_Loaded_Params& other)
: manifest(other.manifest->DeepCopy()), : manifest(other.manifest->DeepCopy()),
location(other.location), location(other.location),
path(other.path), path(other.path),
apis(other.apis),
explicit_hosts(other.explicit_hosts),
scriptable_hosts(other.scriptable_hosts),
id(other.id), id(other.id),
creation_flags(other.creation_flags) { creation_flags(other.creation_flags) {}
}
ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params( ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params(
const Extension* extension, const Extension* extension)
const ExtensionPermissionSet* active)
: manifest(new DictionaryValue()), : manifest(new DictionaryValue()),
location(extension->location()), location(extension->location()),
path(extension->path()), path(extension->path()),
apis(active->apis()), apis(extension->GetActivePermissions()->apis()),
explicit_hosts(active->explicit_hosts()), explicit_hosts(extension->GetActivePermissions()->explicit_hosts()),
scriptable_hosts(active->scriptable_hosts()), scriptable_hosts(extension->GetActivePermissions()->scriptable_hosts()),
id(extension->id()), id(extension->id()),
creation_flags(extension->creation_flags()) { creation_flags(extension->creation_flags()) {
// As we need more bits of extension data in the renderer, add more keys to // As we need more bits of extension data in the renderer, add more keys to
...@@ -65,15 +64,13 @@ scoped_refptr<Extension> ...@@ -65,15 +64,13 @@ scoped_refptr<Extension>
&error)); &error));
if (!extension.get()) if (!extension.get())
LOG(ERROR) << "Error deserializing extension: " << error; LOG(ERROR) << "Error deserializing extension: " << error;
else
extension->SetActivePermissions(
new ExtensionPermissionSet(apis, explicit_hosts, scriptable_hosts));
return extension; return extension;
} }
const ExtensionPermissionSet*
ExtensionMsg_Loaded_Params::GetActivePermissions() const {
return new ExtensionPermissionSet(apis, explicit_hosts, scriptable_hosts);
}
namespace IPC { namespace IPC {
template <> template <>
......
...@@ -91,9 +91,7 @@ typedef std::map<std::string, std::string> SubstitutionMap; ...@@ -91,9 +91,7 @@ typedef std::map<std::string, std::string> SubstitutionMap;
struct ExtensionMsg_Loaded_Params { struct ExtensionMsg_Loaded_Params {
ExtensionMsg_Loaded_Params(); ExtensionMsg_Loaded_Params();
~ExtensionMsg_Loaded_Params(); ~ExtensionMsg_Loaded_Params();
explicit ExtensionMsg_Loaded_Params( explicit ExtensionMsg_Loaded_Params(const Extension* extension);
const Extension* extension,
const ExtensionPermissionSet* active_permissions);
// A copy constructor is needed because this structure can end up getting // A copy constructor is needed because this structure can end up getting
// copied inside the IPC machinery on gcc <= 4.2. // copied inside the IPC machinery on gcc <= 4.2.
...@@ -102,9 +100,6 @@ struct ExtensionMsg_Loaded_Params { ...@@ -102,9 +100,6 @@ struct ExtensionMsg_Loaded_Params {
// Creates a new extension from the data in this object. // Creates a new extension from the data in this object.
scoped_refptr<Extension> ConvertToExtension() const; scoped_refptr<Extension> ConvertToExtension() const;
// Passes ownership to the caller.
const ExtensionPermissionSet* GetActivePermissions() const;
// The subset of the extension manifest data we send to renderers. // The subset of the extension manifest data we send to renderers.
scoped_ptr<DictionaryValue> manifest; scoped_ptr<DictionaryValue> manifest;
......
...@@ -151,7 +151,6 @@ void ExtensionDispatcher::OnLoaded(const ExtensionMsg_Loaded_Params& params) { ...@@ -151,7 +151,6 @@ void ExtensionDispatcher::OnLoaded(const ExtensionMsg_Loaded_Params& params) {
} }
extensions_.Insert(extension); extensions_.Insert(extension);
extension->SetActivePermissions(params.GetActivePermissions());
} }
void ExtensionDispatcher::OnUnloaded(const std::string& id) { void ExtensionDispatcher::OnUnloaded(const std::string& id) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment