Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: chrome/browser/extensions/convert_web_app.cc

Issue 11198067: Move extension unpack intermediate dir to Extensions/Temp (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: standardize names Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 return base::StringPrintf("%i.%i.%i.%i", 79 return base::StringPrintf("%i.%i.%i.%i",
80 create_time_exploded.year, 80 create_time_exploded.year,
81 create_time_exploded.month, 81 create_time_exploded.month,
82 create_time_exploded.day_of_month, 82 create_time_exploded.day_of_month,
83 static_cast<uint16>(stamp)); 83 static_cast<uint16>(stamp));
84 } 84 }
85 85
86 scoped_refptr<Extension> ConvertWebAppToExtension( 86 scoped_refptr<Extension> ConvertWebAppToExtension(
87 const WebApplicationInfo& web_app, 87 const WebApplicationInfo& web_app,
88 const Time& create_time) { 88 const Time& create_time,
89 FilePath user_data_temp_dir = extension_file_util::GetUserDataTempDir(); 89 const FilePath& extensions_dir) {
90 if (user_data_temp_dir.empty()) { 90 FilePath install_temp_dir =
91 extension_file_util::GetInstallTempDir(extensions_dir);
92 if (install_temp_dir.empty()) {
91 LOG(ERROR) << "Could not get path to profile temporary directory."; 93 LOG(ERROR) << "Could not get path to profile temporary directory.";
92 return NULL; 94 return NULL;
93 } 95 }
94 96
95 ScopedTempDir temp_dir; 97 ScopedTempDir temp_dir;
96 if (!temp_dir.CreateUniqueTempDirUnderPath(user_data_temp_dir)) { 98 if (!temp_dir.CreateUniqueTempDirUnderPath(install_temp_dir)) {
97 LOG(ERROR) << "Could not create temporary directory."; 99 LOG(ERROR) << "Could not create temporary directory.";
98 return NULL; 100 return NULL;
99 } 101 }
100 102
101 // Create the manifest 103 // Create the manifest
102 scoped_ptr<DictionaryValue> root(new DictionaryValue); 104 scoped_ptr<DictionaryValue> root(new DictionaryValue);
103 if (!web_app.is_bookmark_app) 105 if (!web_app.is_bookmark_app)
104 root->SetString(keys::kPublicKey, GenerateKey(web_app.manifest_url)); 106 root->SetString(keys::kPublicKey, GenerateKey(web_app.manifest_url));
105 else 107 else
106 root->SetString(keys::kPublicKey, GenerateKey(web_app.app_url)); 108 root->SetString(keys::kPublicKey, GenerateKey(web_app.app_url));
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 if (!extension) { 193 if (!extension) {
192 LOG(ERROR) << error; 194 LOG(ERROR) << error;
193 return NULL; 195 return NULL;
194 } 196 }
195 197
196 temp_dir.Take(); // The caller takes ownership of the directory. 198 temp_dir.Take(); // The caller takes ownership of the directory.
197 return extension; 199 return extension;
198 } 200 }
199 201
200 } // namespace extensions 202 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/convert_web_app.h ('k') | chrome/browser/extensions/convert_web_app_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698