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