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 <cmath> | 7 #include <cmath> |
8 #include <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 LOG(ERROR) << "Could not create temporary directory."; | 96 LOG(ERROR) << "Could not create temporary directory."; |
97 return NULL; | 97 return NULL; |
98 } | 98 } |
99 | 99 |
100 // Create the manifest | 100 // Create the manifest |
101 scoped_ptr<DictionaryValue> root(new DictionaryValue); | 101 scoped_ptr<DictionaryValue> root(new DictionaryValue); |
102 if (!web_app.is_bookmark_app) | 102 if (!web_app.is_bookmark_app) |
103 root->SetString(keys::kPublicKey, GenerateKey(web_app.manifest_url)); | 103 root->SetString(keys::kPublicKey, GenerateKey(web_app.manifest_url)); |
104 else | 104 else |
105 root->SetString(keys::kPublicKey, GenerateKey(web_app.app_url)); | 105 root->SetString(keys::kPublicKey, GenerateKey(web_app.app_url)); |
| 106 |
| 107 if (web_app.is_offline_enabled) |
| 108 root->SetBoolean(keys::kOfflineEnabled, true); |
| 109 |
106 root->SetString(keys::kName, UTF16ToUTF8(web_app.title)); | 110 root->SetString(keys::kName, UTF16ToUTF8(web_app.title)); |
107 root->SetString(keys::kVersion, ConvertTimeToExtensionVersion(create_time)); | 111 root->SetString(keys::kVersion, ConvertTimeToExtensionVersion(create_time)); |
108 root->SetString(keys::kDescription, UTF16ToUTF8(web_app.description)); | 112 root->SetString(keys::kDescription, UTF16ToUTF8(web_app.description)); |
109 root->SetString(keys::kLaunchWebURL, web_app.app_url.spec()); | 113 root->SetString(keys::kLaunchWebURL, web_app.app_url.spec()); |
110 | 114 |
111 if (!web_app.launch_container.empty()) | 115 if (!web_app.launch_container.empty()) |
112 root->SetString(keys::kLaunchContainer, web_app.launch_container); | 116 root->SetString(keys::kLaunchContainer, web_app.launch_container); |
113 | 117 |
114 // Add the icons. | 118 // Add the icons. |
115 DictionaryValue* icons = new DictionaryValue(); | 119 DictionaryValue* icons = new DictionaryValue(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 extension_flags, | 188 extension_flags, |
185 &error); | 189 &error); |
186 if (!extension) { | 190 if (!extension) { |
187 LOG(ERROR) << error; | 191 LOG(ERROR) << error; |
188 return NULL; | 192 return NULL; |
189 } | 193 } |
190 | 194 |
191 temp_dir.Take(); // The caller takes ownership of the directory. | 195 temp_dir.Take(); // The caller takes ownership of the directory. |
192 return extension; | 196 return extension; |
193 } | 197 } |
OLD | NEW |