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" |
11 #include "base/rand_util.h" | 11 #include "base/rand_util.h" |
12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 17 #include "chrome/browser/download/download_crx_util.h" |
18 #include "chrome/browser/download/download_prefs.h" | 18 #include "chrome/browser/download/download_prefs.h" |
19 #include "chrome/browser/download/download_util.h" | 19 #include "chrome/browser/download/download_util.h" |
20 #include "chrome/browser/extensions/crx_installer.h" | 20 #include "chrome/browser/extensions/crx_installer.h" |
21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/ui/browser_list.h" | 22 #include "chrome/browser/ui/browser_list.h" |
23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
24 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 24 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
25 #include "chrome/common/chrome_notification_types.h" | 25 #include "chrome/common/chrome_notification_types.h" |
26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/common/extensions/extension.h" | 27 #include "chrome/common/extensions/extension.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 break; | 280 break; |
281 case DownloadItem::INTERRUPTED: | 281 case DownloadItem::INTERRUPTED: |
282 ReportFailure(kDownloadInterruptedError); | 282 ReportFailure(kDownloadInterruptedError); |
283 break; | 283 break; |
284 case DownloadItem::REMOVING: | 284 case DownloadItem::REMOVING: |
285 download_item_->RemoveObserver(this); | 285 download_item_->RemoveObserver(this); |
286 download_item_ = NULL; | 286 download_item_ = NULL; |
287 break; | 287 break; |
288 case DownloadItem::COMPLETE: | 288 case DownloadItem::COMPLETE: |
289 // Wait for other notifications if the download is really an extension. | 289 // Wait for other notifications if the download is really an extension. |
290 if (!ChromeDownloadManagerDelegate::IsExtensionDownload(download)) | 290 if (!download_crx_util::IsExtensionDownload(*download)) |
291 ReportFailure(kInvalidDownloadError); | 291 ReportFailure(kInvalidDownloadError); |
292 break; | 292 break; |
293 default: | 293 default: |
294 // Continue listening if the download is not in one of the above states. | 294 // Continue listening if the download is not in one of the above states. |
295 break; | 295 break; |
296 } | 296 } |
297 } | 297 } |
298 | 298 |
299 void WebstoreInstaller::OnDownloadOpened(DownloadItem* download) { | 299 void WebstoreInstaller::OnDownloadOpened(DownloadItem* download) { |
300 CHECK_EQ(download_item_, download); | 300 CHECK_EQ(download_item_, download); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 } | 334 } |
335 | 335 |
336 void WebstoreInstaller::ReportSuccess() { | 336 void WebstoreInstaller::ReportSuccess() { |
337 if (delegate_) { | 337 if (delegate_) { |
338 delegate_->OnExtensionInstallSuccess(id_); | 338 delegate_->OnExtensionInstallSuccess(id_); |
339 delegate_ = NULL; | 339 delegate_ = NULL; |
340 } | 340 } |
341 | 341 |
342 Release(); // Balanced in Start(). | 342 Release(); // Balanced in Start(). |
343 } | 343 } |
OLD | NEW |