| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 using content::BrowserContext; | 45 using content::BrowserContext; |
| 46 using content::BrowserThread; | 46 using content::BrowserThread; |
| 47 using content::DownloadId; | 47 using content::DownloadId; |
| 48 using content::DownloadItem; | 48 using content::DownloadItem; |
| 49 using content::DownloadManager; | 49 using content::DownloadManager; |
| 50 using content::NavigationController; | 50 using content::NavigationController; |
| 51 using content::DownloadUrlParameters; | 51 using content::DownloadUrlParameters; |
| 52 | 52 |
| 53 namespace { | 53 namespace { |
| 54 | 54 |
| 55 using extensions::Extension; | |
| 56 | |
| 57 // Key used to attach the Approval to the DownloadItem. | 55 // Key used to attach the Approval to the DownloadItem. |
| 58 const char kApprovalKey[] = "extensions.webstore_installer"; | 56 const char kApprovalKey[] = "extensions.webstore_installer"; |
| 59 | 57 |
| 60 const char kInvalidIdError[] = "Invalid id"; | 58 const char kInvalidIdError[] = "Invalid id"; |
| 61 const char kNoBrowserError[] = "No browser found"; | 59 const char kNoBrowserError[] = "No browser found"; |
| 62 const char kDownloadDirectoryError[] = "Could not create download directory"; | 60 const char kDownloadDirectoryError[] = "Could not create download directory"; |
| 63 const char kDownloadCanceledError[] = "Download canceled"; | 61 const char kDownloadCanceledError[] = "Download canceled"; |
| 64 const char kInstallCanceledError[] = "Install canceled"; | 62 const char kInstallCanceledError[] = "Install canceled"; |
| 65 const char kDownloadInterruptedError[] = "Download interrupted"; | 63 const char kDownloadInterruptedError[] = "Download interrupted"; |
| 66 const char kInvalidDownloadError[] = "Download was not a CRX"; | 64 const char kInvalidDownloadError[] = "Download was not a CRX"; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 int uniquifier = file_util::GetUniquePathNumber(file, FILE_PATH_LITERAL("")); | 126 int uniquifier = file_util::GetUniquePathNumber(file, FILE_PATH_LITERAL("")); |
| 129 if (uniquifier > 0) | 127 if (uniquifier > 0) |
| 130 file = file.InsertBeforeExtensionASCII(StringPrintf(" (%d)", uniquifier)); | 128 file = file.InsertBeforeExtensionASCII(StringPrintf(" (%d)", uniquifier)); |
| 131 | 129 |
| 132 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 130 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 133 base::Bind(callback, file)); | 131 base::Bind(callback, file)); |
| 134 } | 132 } |
| 135 | 133 |
| 136 } // namespace | 134 } // namespace |
| 137 | 135 |
| 136 namespace extensions { |
| 137 |
| 138 WebstoreInstaller::Approval::Approval() | 138 WebstoreInstaller::Approval::Approval() |
| 139 : profile(NULL), | 139 : profile(NULL), |
| 140 use_app_installed_bubble(false), | 140 use_app_installed_bubble(false), |
| 141 skip_post_install_ui(false), | 141 skip_post_install_ui(false), |
| 142 skip_install_dialog(false), | 142 skip_install_dialog(false), |
| 143 record_oauth2_grant(false) { | 143 record_oauth2_grant(false) { |
| 144 } | 144 } |
| 145 | 145 |
| 146 scoped_ptr<WebstoreInstaller::Approval> | 146 scoped_ptr<WebstoreInstaller::Approval> |
| 147 WebstoreInstaller::Approval::CreateWithInstallPrompt(Profile* profile) { | 147 WebstoreInstaller::Approval::CreateWithInstallPrompt(Profile* profile) { |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 } | 351 } |
| 352 | 352 |
| 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 |
| 362 } // namespace extensions |
| OLD | NEW |