| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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.h" | 5 #include "chrome/common/extensions/extension.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } | 161 } |
| 162 | 162 |
| 163 scoped_refptr<Extension> extension = new Extension(path, manifest.Pass()); | 163 scoped_refptr<Extension> extension = new Extension(path, manifest.Pass()); |
| 164 extension->install_warnings_.swap(install_warnings); | 164 extension->install_warnings_.swap(install_warnings); |
| 165 | 165 |
| 166 if (!extension->InitFromValue(flags, &error)) { | 166 if (!extension->InitFromValue(flags, &error)) { |
| 167 *utf8_error = UTF16ToUTF8(error); | 167 *utf8_error = UTF16ToUTF8(error); |
| 168 return NULL; | 168 return NULL; |
| 169 } | 169 } |
| 170 | 170 |
| 171 extension->image_id_ = rand(); |
| 172 |
| 171 return extension; | 173 return extension; |
| 172 } | 174 } |
| 173 | 175 |
| 174 // static | 176 // static |
| 175 bool Extension::IdIsValid(const std::string& id) { | 177 bool Extension::IdIsValid(const std::string& id) { |
| 176 // Verify that the id is legal. | 178 // Verify that the id is legal. |
| 177 if (id.size() != (id_util::kIdSize * 2)) | 179 if (id.size() != (id_util::kIdSize * 2)) |
| 178 return false; | 180 return false; |
| 179 | 181 |
| 180 // We only support lowercase IDs, because IDs can be used as URL components | 182 // We only support lowercase IDs, because IDs can be used as URL components |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 | 844 |
| 843 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 845 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
| 844 const Extension* extension, | 846 const Extension* extension, |
| 845 const PermissionSet* permissions, | 847 const PermissionSet* permissions, |
| 846 Reason reason) | 848 Reason reason) |
| 847 : reason(reason), | 849 : reason(reason), |
| 848 extension(extension), | 850 extension(extension), |
| 849 permissions(permissions) {} | 851 permissions(permissions) {} |
| 850 | 852 |
| 851 } // namespace extensions | 853 } // namespace extensions |
| OLD | NEW |