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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 void WebstoreInstaller::Start() { | 199 void WebstoreInstaller::Start() { |
200 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 200 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
201 AddRef(); // Balanced in ReportSuccess and ReportFailure. | 201 AddRef(); // Balanced in ReportSuccess and ReportFailure. |
202 | 202 |
203 if (!Extension::IdIsValid(id_)) { | 203 if (!Extension::IdIsValid(id_)) { |
204 ReportFailure(kInvalidIdError); | 204 ReportFailure(kInvalidIdError); |
205 return; | 205 return; |
206 } | 206 } |
207 | 207 |
208 FilePath download_path = DownloadPrefs::FromDownloadManager( | 208 FilePath download_path = DownloadPrefs::FromDownloadManager( |
209 BrowserContext::GetDownloadManager(profile_))->download_path(); | 209 BrowserContext::GetDownloadManager(profile_))->DownloadPath(); |
210 BrowserThread::PostTask( | 210 BrowserThread::PostTask( |
211 BrowserThread::FILE, FROM_HERE, | 211 BrowserThread::FILE, FROM_HERE, |
212 base::Bind(&GetDownloadFilePath, download_path, id_, | 212 base::Bind(&GetDownloadFilePath, download_path, id_, |
213 base::Bind(&WebstoreInstaller::StartDownload, this))); | 213 base::Bind(&WebstoreInstaller::StartDownload, this))); |
214 } | 214 } |
215 | 215 |
216 void WebstoreInstaller::Observe(int type, | 216 void WebstoreInstaller::Observe(int type, |
217 const content::NotificationSource& source, | 217 const content::NotificationSource& source, |
218 const content::NotificationDetails& details) { | 218 const content::NotificationDetails& details) { |
219 switch (type) { | 219 switch (type) { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 void WebstoreInstaller::ReportSuccess() { | 353 void WebstoreInstaller::ReportSuccess() { |
354 if (delegate_) { | 354 if (delegate_) { |
355 delegate_->OnExtensionInstallSuccess(id_); | 355 delegate_->OnExtensionInstallSuccess(id_); |
356 delegate_ = NULL; | 356 delegate_ = NULL; |
357 } | 357 } |
358 | 358 |
359 Release(); // Balanced in Start(). | 359 Release(); // Balanced in Start(). |
360 } | 360 } |
361 | 361 |
362 } // namespace extensions | 362 } // namespace extensions |
OLD | NEW |