| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_constants.h" | 7 #include "chrome/common/extensions/extension_constants.h" |
| 8 #include "content/public/common/common_param_traits.h" | 8 #include "content/public/common/common_param_traits.h" |
| 9 | 9 |
| 10 ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params() | 10 ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params() |
| 11 : location(Extension::INVALID), | 11 : location(Extension::INVALID), |
| 12 creation_flags(Extension::NO_FLAGS){} | 12 creation_flags(Extension::NO_FLAGS){} |
| 13 | 13 |
| 14 ExtensionMsg_Loaded_Params::~ExtensionMsg_Loaded_Params() {} | 14 ExtensionMsg_Loaded_Params::~ExtensionMsg_Loaded_Params() {} |
| 15 | 15 |
| 16 ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params( | 16 ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params( |
| 17 const ExtensionMsg_Loaded_Params& other) | 17 const ExtensionMsg_Loaded_Params& other) |
| 18 : manifest(other.manifest->DeepCopy()), | 18 : manifest(other.manifest), |
| 19 location(other.location), | 19 location(other.location), |
| 20 path(other.path), | 20 path(other.path), |
| 21 apis(other.apis), | 21 apis(other.apis), |
| 22 explicit_hosts(other.explicit_hosts), | 22 explicit_hosts(other.explicit_hosts), |
| 23 scriptable_hosts(other.scriptable_hosts), | 23 scriptable_hosts(other.scriptable_hosts), |
| 24 id(other.id), | 24 id(other.id), |
| 25 creation_flags(other.creation_flags) {} | 25 creation_flags(other.creation_flags) {} |
| 26 | 26 |
| 27 ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params( | 27 ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params( |
| 28 const Extension* extension) | 28 const Extension* extension) |
| 29 : manifest(new DictionaryValue()), | 29 : manifest(new DictionaryValue()), |
| 30 location(extension->location()), | 30 location(extension->location()), |
| 31 path(extension->path()), | 31 path(extension->path()), |
| 32 apis(extension->GetActivePermissions()->apis()), | 32 apis(extension->GetActivePermissions()->apis()), |
| 33 explicit_hosts(extension->GetActivePermissions()->explicit_hosts()), | 33 explicit_hosts(extension->GetActivePermissions()->explicit_hosts()), |
| 34 scriptable_hosts(extension->GetActivePermissions()->scriptable_hosts()), | 34 scriptable_hosts(extension->GetActivePermissions()->scriptable_hosts()), |
| 35 id(extension->id()), | 35 id(extension->id()), |
| 36 creation_flags(extension->creation_flags()) { | 36 creation_flags(extension->creation_flags()) { |
| 37 // As we need more bits of extension data in the renderer, add more keys to | 37 // As we need more bits of extension data in the renderer, add more keys to |
| 38 // this list. | 38 // this list. |
| 39 const char* kRendererExtensionKeys[] = { | 39 const char* kRendererExtensionKeys[] = { |
| 40 extension_manifest_keys::kPublicKey, | 40 extension_manifest_keys::kApp, |
| 41 extension_manifest_keys::kContentScripts, |
| 42 extension_manifest_keys::kIcons, |
| 41 extension_manifest_keys::kName, | 43 extension_manifest_keys::kName, |
| 42 extension_manifest_keys::kVersion, | |
| 43 extension_manifest_keys::kIcons, | |
| 44 extension_manifest_keys::kPageAction, | 44 extension_manifest_keys::kPageAction, |
| 45 extension_manifest_keys::kPageActions, | 45 extension_manifest_keys::kPageActions, |
| 46 extension_manifest_keys::kPermissions, | 46 extension_manifest_keys::kPermissions, |
| 47 extension_manifest_keys::kApp, | 47 extension_manifest_keys::kPlatformApp, |
| 48 extension_manifest_keys::kContentScripts | 48 extension_manifest_keys::kPublicKey, |
| 49 extension_manifest_keys::kVersion, |
| 49 }; | 50 }; |
| 50 | 51 |
| 51 // Copy only the data we need. | 52 // Copy only the data we need. |
| 52 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kRendererExtensionKeys); ++i) { | 53 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kRendererExtensionKeys); ++i) { |
| 53 Value* temp = NULL; | 54 Value* temp = NULL; |
| 54 if (extension->manifest_value()->Get(kRendererExtensionKeys[i], &temp)) | 55 if (extension->manifest_value()->Get(kRendererExtensionKeys[i], &temp)) |
| 55 manifest->Set(kRendererExtensionKeys[i], temp->DeepCopy()); | 56 manifest->Set(kRendererExtensionKeys[i], temp->DeepCopy()); |
| 56 } | 57 } |
| 57 } | 58 } |
| 58 | 59 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 ReadParam(m, iter, &p->explicit_hosts) && | 187 ReadParam(m, iter, &p->explicit_hosts) && |
| 187 ReadParam(m, iter, &p->scriptable_hosts); | 188 ReadParam(m, iter, &p->scriptable_hosts); |
| 188 } | 189 } |
| 189 | 190 |
| 190 void ParamTraits<ExtensionMsg_Loaded_Params>::Log(const param_type& p, | 191 void ParamTraits<ExtensionMsg_Loaded_Params>::Log(const param_type& p, |
| 191 std::string* l) { | 192 std::string* l) { |
| 192 l->append(p.id); | 193 l->append(p.id); |
| 193 } | 194 } |
| 194 | 195 |
| 195 } // namespace IPC | 196 } // namespace IPC |
| OLD | NEW |