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