| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 // Must be executed on the FILE thread. | 94 // Must be executed on the FILE thread. |
| 95 void GetDownloadFilePath( | 95 void GetDownloadFilePath( |
| 96 const FilePath& download_directory, const std::string& id, | 96 const FilePath& download_directory, const std::string& id, |
| 97 const base::Callback<void(const FilePath&)>& callback) { | 97 const base::Callback<void(const FilePath&)>& callback) { |
| 98 FilePath directory(g_download_directory_for_tests ? | 98 FilePath directory(g_download_directory_for_tests ? |
| 99 *g_download_directory_for_tests : download_directory); | 99 *g_download_directory_for_tests : download_directory); |
| 100 | 100 |
| 101 #if defined (OS_CHROMEOS) | 101 #if defined (OS_CHROMEOS) |
| 102 // Do not use drive for extension downloads. | 102 // Do not use drive for extension downloads. |
| 103 if (gdata::util::IsUnderDriveMountPoint(directory)) | 103 if (drive::util::IsUnderDriveMountPoint(directory)) |
| 104 directory = download_util::GetDefaultDownloadDirectory(); | 104 directory = download_util::GetDefaultDownloadDirectory(); |
| 105 #endif | 105 #endif |
| 106 | 106 |
| 107 // Ensure the download directory exists. TODO(asargent) - make this use | 107 // Ensure the download directory exists. TODO(asargent) - make this use |
| 108 // common code from the downloads system. | 108 // common code from the downloads system. |
| 109 if (!file_util::DirectoryExists(directory)) { | 109 if (!file_util::DirectoryExists(directory)) { |
| 110 if (!file_util::CreateDirectory(directory)) { | 110 if (!file_util::CreateDirectory(directory)) { |
| 111 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 111 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 112 base::Bind(callback, FilePath())); | 112 base::Bind(callback, FilePath())); |
| 113 return; | 113 return; |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 void WebstoreInstaller::ReportSuccess() { | 378 void WebstoreInstaller::ReportSuccess() { |
| 379 if (delegate_) { | 379 if (delegate_) { |
| 380 delegate_->OnExtensionInstallSuccess(id_); | 380 delegate_->OnExtensionInstallSuccess(id_); |
| 381 delegate_ = NULL; | 381 delegate_ = NULL; |
| 382 } | 382 } |
| 383 | 383 |
| 384 Release(); // Balanced in Start(). | 384 Release(); // Balanced in Start(). |
| 385 } | 385 } |
| 386 | 386 |
| 387 } // namespace extensions | 387 } // namespace extensions |
| OLD | NEW |