| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/extensions/convert_web_app.h" | 5 #include "chrome/browser/extensions/convert_web_app.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 return NULL; | 95 return NULL; |
| 96 } | 96 } |
| 97 | 97 |
| 98 base::ScopedTempDir temp_dir; | 98 base::ScopedTempDir temp_dir; |
| 99 if (!temp_dir.CreateUniqueTempDirUnderPath(install_temp_dir)) { | 99 if (!temp_dir.CreateUniqueTempDirUnderPath(install_temp_dir)) { |
| 100 LOG(ERROR) << "Could not create temporary directory."; | 100 LOG(ERROR) << "Could not create temporary directory."; |
| 101 return NULL; | 101 return NULL; |
| 102 } | 102 } |
| 103 | 103 |
| 104 // Create the manifest | 104 // Create the manifest |
| 105 scoped_ptr<base::DictionaryValue> root(new base::DictionaryValue); | 105 std::unique_ptr<base::DictionaryValue> root(new base::DictionaryValue); |
| 106 root->SetString(keys::kPublicKey, GenerateKey(web_app.app_url)); | 106 root->SetString(keys::kPublicKey, GenerateKey(web_app.app_url)); |
| 107 root->SetString(keys::kName, base::UTF16ToUTF8(web_app.title)); | 107 root->SetString(keys::kName, base::UTF16ToUTF8(web_app.title)); |
| 108 root->SetString(keys::kVersion, ConvertTimeToExtensionVersion(create_time)); | 108 root->SetString(keys::kVersion, ConvertTimeToExtensionVersion(create_time)); |
| 109 root->SetString(keys::kDescription, base::UTF16ToUTF8(web_app.description)); | 109 root->SetString(keys::kDescription, base::UTF16ToUTF8(web_app.description)); |
| 110 root->SetString(keys::kLaunchWebURL, web_app.app_url.spec()); | 110 root->SetString(keys::kLaunchWebURL, web_app.app_url.spec()); |
| 111 if (web_app.generated_icon_color != SK_ColorTRANSPARENT) { | 111 if (web_app.generated_icon_color != SK_ColorTRANSPARENT) { |
| 112 root->SetString(keys::kAppIconColor, image_util::GenerateHexColorString( | 112 root->SetString(keys::kAppIconColor, image_util::GenerateHexColorString( |
| 113 web_app.generated_icon_color)); | 113 web_app.generated_icon_color)); |
| 114 } | 114 } |
| 115 | 115 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 if (!extension.get()) { | 180 if (!extension.get()) { |
| 181 LOG(ERROR) << error; | 181 LOG(ERROR) << error; |
| 182 return NULL; | 182 return NULL; |
| 183 } | 183 } |
| 184 | 184 |
| 185 temp_dir.Take(); // The caller takes ownership of the directory. | 185 temp_dir.Take(); // The caller takes ownership of the directory. |
| 186 return extension; | 186 return extension; |
| 187 } | 187 } |
| 188 | 188 |
| 189 } // namespace extensions | 189 } // namespace extensions |
| OLD | NEW |