diff options
author | jstritar@chromium.org <jstritar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-11 22:22:05 +0000 |
---|---|---|
committer | jstritar@chromium.org <jstritar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-11 22:22:05 +0000 |
commit | 15379646c444c8029b0c6cf4e47e06003c246767 (patch) | |
tree | 42fe4fed4639224e99ca3e5b421cd83614f3a872 | |
parent | cefa749d026c083bc3fd0e6977dbec1890185c4a (diff) | |
download | chromium_src-15379646c444c8029b0c6cf4e47e06003c246767.zip chromium_src-15379646c444c8029b0c6cf4e47e06003c246767.tar.gz chromium_src-15379646c444c8029b0c6cf4e47e06003c246767.tar.bz2 |
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
-rw-r--r-- | chrome/browser/extensions/extension_service.cc | 6 | ||||
-rw-r--r-- | chrome/common/extensions/extension_messages.cc | 29 | ||||
-rw-r--r-- | chrome/common/extensions/extension_messages.h | 7 | ||||
-rw-r--r-- | chrome/renderer/extensions/extension_dispatcher.cc | 1 |
4 files changed, 16 insertions, 27 deletions
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index b49f5bd..a4d04c9 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -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; } diff --git a/chrome/common/extensions/extension_messages.cc b/chrome/common/extensions/extension_messages.cc index fe88896..60f04e0 100644 --- a/chrome/common/extensions/extension_messages.cc +++ b/chrome/common/extensions/extension_messages.cc @@ -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 <> diff --git a/chrome/common/extensions/extension_messages.h b/chrome/common/extensions/extension_messages.h index 4cb6c5c..1cab15e 100644 --- a/chrome/common/extensions/extension_messages.h +++ b/chrome/common/extensions/extension_messages.h @@ -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; diff --git a/chrome/renderer/extensions/extension_dispatcher.cc b/chrome/renderer/extensions/extension_dispatcher.cc index 8090aeb..15312ae 100644 --- a/chrome/renderer/extensions/extension_dispatcher.cc +++ b/chrome/renderer/extensions/extension_dispatcher.cc @@ -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) { |