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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // filename and when the download starts writing to it (think concurrently | 110 // filename and when the download starts writing to it (think concurrently |
111 // running sharded browser tests installing the same test file, for | 111 // running sharded browser tests installing the same test file, for |
112 // instance). | 112 // instance). |
113 std::string random_number = | 113 std::string random_number = |
114 base::Uint64ToString(base::RandGenerator(kuint16max)); | 114 base::Uint64ToString(base::RandGenerator(kuint16max)); |
115 | 115 |
116 base::FilePath file = | 116 base::FilePath file = |
117 download_directory.AppendASCII(id + "_" + random_number + ".crx"); | 117 download_directory.AppendASCII(id + "_" + random_number + ".crx"); |
118 | 118 |
119 int uniquifier = | 119 int uniquifier = |
120 file_util::GetUniquePathNumber(file, base::FilePath::StringType()); | 120 base::GetUniquePathNumber(file, base::FilePath::StringType()); |
121 if (uniquifier > 0) { | 121 if (uniquifier > 0) { |
122 file = file.InsertBeforeExtensionASCII( | 122 file = file.InsertBeforeExtensionASCII( |
123 base::StringPrintf(" (%d)", uniquifier)); | 123 base::StringPrintf(" (%d)", uniquifier)); |
124 } | 124 } |
125 | 125 |
126 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 126 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
127 base::Bind(callback, file)); | 127 base::Bind(callback, file)); |
128 } | 128 } |
129 | 129 |
130 bool UseSeparateWebstoreDownloadDirectory() { | 130 bool UseSeparateWebstoreDownloadDirectory() { |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 1, | 658 1, |
659 kMaxSizeKb, | 659 kMaxSizeKb, |
660 kNumBuckets); | 660 kNumBuckets); |
661 } | 661 } |
662 UMA_HISTOGRAM_BOOLEAN( | 662 UMA_HISTOGRAM_BOOLEAN( |
663 "Extensions.WebstoreDownload.InterruptTotalSizeUnknown", | 663 "Extensions.WebstoreDownload.InterruptTotalSizeUnknown", |
664 total_bytes <= 0); | 664 total_bytes <= 0); |
665 } | 665 } |
666 | 666 |
667 } // namespace extensions | 667 } // namespace extensions |
OLD | NEW |