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) {
Profile::FromBrowserContext(host->browser_context());
if (host_profile->GetOriginalProfile() == profile_->GetOriginalProfile()) {
host->Send(
new ExtensionMsg_Loaded(ExtensionMsg_Loaded_Params(
extension, extension->GetActivePermissions())));
new ExtensionMsg_Loaded(ExtensionMsg_Loaded_Params(extension)));
}
}
......@@ -2455,8 +2454,7 @@ void ExtensionService::Observe(int type,
// Loaded extensions.
for (size_t i = 0; i < extensions_.size(); ++i) {
process->Send(new ExtensionMsg_Loaded(
ExtensionMsg_Loaded_Params(
extensions_[i], extensions_[i]->GetActivePermissions())));
ExtensionMsg_Loaded_Params(extensions_[i])));
}
break;
}
......
......@@ -8,30 +8,29 @@
#include "content/common/common_param_traits.h"
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(
const ExtensionMsg_Loaded_Params& other)
: manifest(other.manifest->DeepCopy()),
location(other.location),
path(other.path),
apis(other.apis),
explicit_hosts(other.explicit_hosts),
scriptable_hosts(other.scriptable_hosts),
id(other.id),
creation_flags(other.creation_flags) {
}
creation_flags(other.creation_flags) {}
ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params(
const Extension* extension,
const ExtensionPermissionSet* active)
const Extension* extension)
: manifest(new DictionaryValue()),
location(extension->location()),
path(extension->path()),
apis(active->apis()),
explicit_hosts(active->explicit_hosts()),
scriptable_hosts(active->scriptable_hosts()),
apis(extension->GetActivePermissions()->apis()),
explicit_hosts(extension->GetActivePermissions()->explicit_hosts()),
scriptable_hosts(extension->GetActivePermissions()->scriptable_hosts()),
id(extension->id()),
creation_flags(extension->creation_flags()) {
// As we need more bits of extension data in the renderer, add more keys to
......@@ -65,15 +64,13 @@ scoped_refptr<Extension>
&error));
if (!extension.get())
LOG(ERROR) << "Error deserializing extension: " << error;
else
extension->SetActivePermissions(
new ExtensionPermissionSet(apis, explicit_hosts, scriptable_hosts));
return extension;
}
const ExtensionPermissionSet*
ExtensionMsg_Loaded_Params::GetActivePermissions() const {
return new ExtensionPermissionSet(apis, explicit_hosts, scriptable_hosts);
}
namespace IPC {
template <>
......
......@@ -91,9 +91,7 @@ typedef std::map<std::string, std::string> SubstitutionMap;
struct ExtensionMsg_Loaded_Params {
ExtensionMsg_Loaded_Params();
~ExtensionMsg_Loaded_Params();
explicit ExtensionMsg_Loaded_Params(
const Extension* extension,
const ExtensionPermissionSet* active_permissions);
explicit ExtensionMsg_Loaded_Params(const Extension* extension);
// A copy constructor is needed because this structure can end up getting
// copied inside the IPC machinery on gcc <= 4.2.
......@@ -102,9 +100,6 @@ struct ExtensionMsg_Loaded_Params {
// Creates a new extension from the data in this object.
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.
scoped_ptr<DictionaryValue> manifest;
......
......@@ -151,7 +151,6 @@ void ExtensionDispatcher::OnLoaded(const ExtensionMsg_Loaded_Params& params) {
}
extensions_.Insert(extension);
extension->SetActivePermissions(params.GetActivePermissions());
}
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