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 "chrome/common/extensions/manifest.h" |
8 #include "content/public/common/common_param_traits.h" | 9 #include "content/public/common/common_param_traits.h" |
9 | 10 |
10 ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params() | 11 ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params() |
11 : location(Extension::INVALID), | 12 : location(Extension::INVALID), |
12 creation_flags(Extension::NO_FLAGS){} | 13 creation_flags(Extension::NO_FLAGS){} |
13 | 14 |
14 ExtensionMsg_Loaded_Params::~ExtensionMsg_Loaded_Params() {} | 15 ExtensionMsg_Loaded_Params::~ExtensionMsg_Loaded_Params() {} |
15 | 16 |
16 ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params( | 17 ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params( |
17 const ExtensionMsg_Loaded_Params& other) | 18 const ExtensionMsg_Loaded_Params& other) |
(...skipping 24 matching lines...) Expand all Loading... |
42 extension_manifest_keys::kIcons, | 43 extension_manifest_keys::kIcons, |
43 extension_manifest_keys::kName, | 44 extension_manifest_keys::kName, |
44 extension_manifest_keys::kPageAction, | 45 extension_manifest_keys::kPageAction, |
45 extension_manifest_keys::kPageActions, | 46 extension_manifest_keys::kPageActions, |
46 extension_manifest_keys::kPermissions, | 47 extension_manifest_keys::kPermissions, |
47 extension_manifest_keys::kPlatformApp, | 48 extension_manifest_keys::kPlatformApp, |
48 extension_manifest_keys::kPublicKey, | 49 extension_manifest_keys::kPublicKey, |
49 extension_manifest_keys::kVersion, | 50 extension_manifest_keys::kVersion, |
50 }; | 51 }; |
51 | 52 |
52 // Copy only the data we need. | 53 // Copy only the data we need and bypass the manifest type checks. |
| 54 DictionaryValue* source = extension->manifest()->value(); |
53 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kRendererExtensionKeys); ++i) { | 55 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kRendererExtensionKeys); ++i) { |
54 Value* temp = NULL; | 56 Value* temp = NULL; |
55 if (extension->manifest_value()->Get(kRendererExtensionKeys[i], &temp)) | 57 if (source->Get(kRendererExtensionKeys[i], &temp)) |
56 manifest->Set(kRendererExtensionKeys[i], temp->DeepCopy()); | 58 manifest->Set(kRendererExtensionKeys[i], temp->DeepCopy()); |
57 } | 59 } |
58 } | 60 } |
59 | 61 |
60 scoped_refptr<Extension> | 62 scoped_refptr<Extension> |
61 ExtensionMsg_Loaded_Params::ConvertToExtension() const { | 63 ExtensionMsg_Loaded_Params::ConvertToExtension() const { |
62 std::string error; | 64 std::string error; |
63 | 65 |
64 scoped_refptr<Extension> extension( | 66 scoped_refptr<Extension> extension( |
65 Extension::Create(path, location, *manifest, creation_flags, | 67 Extension::Create(path, location, *manifest, creation_flags, |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 ReadParam(m, iter, &p->explicit_hosts) && | 189 ReadParam(m, iter, &p->explicit_hosts) && |
188 ReadParam(m, iter, &p->scriptable_hosts); | 190 ReadParam(m, iter, &p->scriptable_hosts); |
189 } | 191 } |
190 | 192 |
191 void ParamTraits<ExtensionMsg_Loaded_Params>::Log(const param_type& p, | 193 void ParamTraits<ExtensionMsg_Loaded_Params>::Log(const param_type& p, |
192 std::string* l) { | 194 std::string* l) { |
193 l->append(p.id); | 195 l->append(p.id); |
194 } | 196 } |
195 | 197 |
196 } // namespace IPC | 198 } // namespace IPC |
OLD | NEW |