| 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/common/common_param_traits.h" | 8 #include "content/common/common_param_traits.h" |
| 9 | 9 |
| 10 ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params() | 10 ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params() |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // Copy only the data we need. | 42 // Copy only the data we need. |
| 43 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kRendererExtensionKeys); ++i) { | 43 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kRendererExtensionKeys); ++i) { |
| 44 Value* temp = NULL; | 44 Value* temp = NULL; |
| 45 if (extension->manifest_value()->Get(kRendererExtensionKeys[i], &temp)) | 45 if (extension->manifest_value()->Get(kRendererExtensionKeys[i], &temp)) |
| 46 manifest->Set(kRendererExtensionKeys[i], temp->DeepCopy()); | 46 manifest->Set(kRendererExtensionKeys[i], temp->DeepCopy()); |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 | 49 |
| 50 scoped_refptr<Extension> | 50 scoped_refptr<Extension> |
| 51 ExtensionMsg_Loaded_Params::ConvertToExtension() const { | 51 ExtensionMsg_Loaded_Params::ConvertToExtension() const { |
| 52 // Extensions that are loaded unpacked won't have a key. | |
| 53 const bool kRequireKey = false; | |
| 54 | |
| 55 // The extension may have been loaded in a way that does not require | |
| 56 // strict error checks to pass. Do not do strict checks here. | |
| 57 const bool kStrictErrorChecks = false; | |
| 58 std::string error; | 52 std::string error; |
| 59 | 53 |
| 60 scoped_refptr<Extension> extension( | 54 scoped_refptr<Extension> extension( |
| 61 Extension::Create(path, location, *manifest, kRequireKey, | 55 Extension::Create(path, location, *manifest, Extension::NO_FLAGS, |
| 62 kStrictErrorChecks, &error)); | 56 &error)); |
| 63 if (!extension.get()) | 57 if (!extension.get()) |
| 64 LOG(ERROR) << "Error deserializing extension: " << error; | 58 LOG(ERROR) << "Error deserializing extension: " << error; |
| 65 | 59 |
| 66 return extension; | 60 return extension; |
| 67 } | 61 } |
| 68 | 62 |
| 69 namespace IPC { | 63 namespace IPC { |
| 70 | 64 |
| 71 template <> | 65 template <> |
| 72 struct ParamTraits<Extension::Location> { | 66 struct ParamTraits<Extension::Location> { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 ReadParam(m, iter, &p->path) && | 140 ReadParam(m, iter, &p->path) && |
| 147 ReadParam(m, iter, p->manifest.get()); | 141 ReadParam(m, iter, p->manifest.get()); |
| 148 } | 142 } |
| 149 | 143 |
| 150 void ParamTraits<ExtensionMsg_Loaded_Params>::Log(const param_type& p, | 144 void ParamTraits<ExtensionMsg_Loaded_Params>::Log(const param_type& p, |
| 151 std::string* l) { | 145 std::string* l) { |
| 152 l->append(p.id); | 146 l->append(p.id); |
| 153 } | 147 } |
| 154 | 148 |
| 155 } // namespace IPC | 149 } // namespace IPC |
| OLD | NEW |