| 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/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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |