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

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

Issue 9316004: Move common file path related methods between chrome & content to file_util. I reduced the 4 meth... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 10 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/webstore_installer.h" 5 #include "chrome/browser/extensions/webstore_installer.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 // This is to help avoid a race condition between when we generate this 96 // This is to help avoid a race condition between when we generate this
97 // filename and when the download starts writing to it (think concurrently 97 // filename and when the download starts writing to it (think concurrently
98 // running sharded browser tests installing the same test file, for 98 // running sharded browser tests installing the same test file, for
99 // instance). 99 // instance).
100 std::string random_number = 100 std::string random_number =
101 base::Uint64ToString(base::RandGenerator(kuint16max)); 101 base::Uint64ToString(base::RandGenerator(kuint16max));
102 102
103 FilePath file = directory.AppendASCII(id + "_" + random_number + ".crx"); 103 FilePath file = directory.AppendASCII(id + "_" + random_number + ".crx");
104 104
105 int uniquifier = DownloadFile::GetUniquePathNumber(file); 105 int uniquifier = file_util::GetUniquePathNumber(file, FILE_PATH_LITERAL(""));
106 if (uniquifier > 0) 106 if (uniquifier > 0)
107 DownloadFile::AppendNumberToPath(&file, uniquifier); 107 file_util::AppendNumberToPath(&file, uniquifier);
108 108
109 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 109 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
110 base::Bind(callback, file)); 110 base::Bind(callback, file));
111 } 111 }
112 112
113 } // namespace 113 } // namespace
114 114
115 115
116 WebstoreInstaller::WebstoreInstaller(Profile* profile, 116 WebstoreInstaller::WebstoreInstaller(Profile* profile,
117 Delegate* delegate, 117 Delegate* delegate,
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 Release(); // Balanced in Start(). 227 Release(); // Balanced in Start().
228 } 228 }
229 229
230 void WebstoreInstaller::ReportSuccess() { 230 void WebstoreInstaller::ReportSuccess() {
231 if (delegate_) 231 if (delegate_)
232 delegate_->OnExtensionInstallSuccess(id_); 232 delegate_->OnExtensionInstallSuccess(id_);
233 233
234 Release(); // Balanced in Start(). 234 Release(); // Balanced in Start().
235 } 235 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698