| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/common/extensions/extension_messages.h" | 5 #include "chrome/common/extensions/extension_messages.h" |
| 6 | 6 |
| 7 #include "chrome/common/extensions/extension.h" | 7 #include "chrome/common/extensions/extension.h" |
| 8 #include "chrome/common/extensions/extension_constants.h" | 8 #include "chrome/common/extensions/extension_constants.h" |
| 9 #include "chrome/common/extensions/permissions/permissions_data.h" | 9 #include "chrome/common/extensions/permissions/permissions_data.h" |
| 10 #include "content/public/common/common_param_traits.h" | 10 #include "content/public/common/common_param_traits.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 creation_flags(Extension::NO_FLAGS){} | 25 creation_flags(Extension::NO_FLAGS){} |
| 26 | 26 |
| 27 ExtensionMsg_Loaded_Params::~ExtensionMsg_Loaded_Params() {} | 27 ExtensionMsg_Loaded_Params::~ExtensionMsg_Loaded_Params() {} |
| 28 | 28 |
| 29 ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params( | 29 ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params( |
| 30 const Extension* extension) | 30 const Extension* extension) |
| 31 : manifest(extension->manifest()->value()->DeepCopy()), | 31 : manifest(extension->manifest()->value()->DeepCopy()), |
| 32 location(extension->location()), | 32 location(extension->location()), |
| 33 path(extension->path()), | 33 path(extension->path()), |
| 34 apis(extension->GetActivePermissions()->apis()), | 34 apis(extension->GetActivePermissions()->apis()), |
| 35 manifest_permissions( |
| 36 extension->GetActivePermissions()->manifest_permissions()), |
| 35 explicit_hosts(extension->GetActivePermissions()->explicit_hosts()), | 37 explicit_hosts(extension->GetActivePermissions()->explicit_hosts()), |
| 36 scriptable_hosts(extension->GetActivePermissions()->scriptable_hosts()), | 38 scriptable_hosts(extension->GetActivePermissions()->scriptable_hosts()), |
| 37 id(extension->id()), | 39 id(extension->id()), |
| 38 creation_flags(extension->creation_flags()) { | 40 creation_flags(extension->creation_flags()) { |
| 39 } | 41 } |
| 40 | 42 |
| 41 scoped_refptr<Extension> ExtensionMsg_Loaded_Params::ConvertToExtension( | 43 scoped_refptr<Extension> ExtensionMsg_Loaded_Params::ConvertToExtension( |
| 42 std::string* error) const { | 44 std::string* error) const { |
| 43 scoped_refptr<Extension> extension = | 45 scoped_refptr<Extension> extension = |
| 44 Extension::Create(path, location, *manifest, creation_flags, error); | 46 Extension::Create(path, location, *manifest, creation_flags, error); |
| 45 if (extension.get()) { | 47 if (extension.get()) { |
| 46 extensions::PermissionsData::SetActivePermissions( | 48 extensions::PermissionsData::SetActivePermissions( |
| 47 extension.get(), | 49 extension.get(), |
| 48 new PermissionSet(apis, explicit_hosts, scriptable_hosts)); | 50 new PermissionSet(apis, manifest_permissions, |
| 51 explicit_hosts, scriptable_hosts)); |
| 49 } | 52 } |
| 50 return extension; | 53 return extension; |
| 51 } | 54 } |
| 52 | 55 |
| 53 namespace IPC { | 56 namespace IPC { |
| 54 | 57 |
| 55 template <> | 58 template <> |
| 56 struct ParamTraits<Manifest::Location> { | 59 struct ParamTraits<Manifest::Location> { |
| 57 typedef Manifest::Location param_type; | 60 typedef Manifest::Location param_type; |
| 58 static void Write(Message* m, const param_type& p) { | 61 static void Write(Message* m, const param_type& p) { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 ReadParam(m, iter, &p->explicit_hosts) && | 209 ReadParam(m, iter, &p->explicit_hosts) && |
| 207 ReadParam(m, iter, &p->scriptable_hosts); | 210 ReadParam(m, iter, &p->scriptable_hosts); |
| 208 } | 211 } |
| 209 | 212 |
| 210 void ParamTraits<ExtensionMsg_Loaded_Params>::Log(const param_type& p, | 213 void ParamTraits<ExtensionMsg_Loaded_Params>::Log(const param_type& p, |
| 211 std::string* l) { | 214 std::string* l) { |
| 212 l->append(p.id); | 215 l->append(p.id); |
| 213 } | 216 } |
| 214 | 217 |
| 215 } // namespace IPC | 218 } // namespace IPC |
| OLD | NEW |