| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/download/download_util.h" | 14 #include "chrome/browser/download/download_util.h" |
| 14 #include "chrome/browser/extensions/crx_installer.h" | 15 #include "chrome/browser/extensions/crx_installer.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/tabs/tab_strip_model.h" | 17 #include "chrome/browser/tabs/tab_strip_model.h" |
| 17 #include "chrome/browser/ui/browser_list.h" | 18 #include "chrome/browser/ui/browser_list.h" |
| 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 19 #include "chrome/common/chrome_notification_types.h" | 20 #include "chrome/common/chrome_notification_types.h" |
| 20 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
| 21 #include "chrome/common/extensions/extension.h" | 22 #include "chrome/common/extensions/extension.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 ReportSuccess(); | 133 ReportSuccess(); |
| 133 break; | 134 break; |
| 134 } | 135 } |
| 135 | 136 |
| 136 case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: { | 137 case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: { |
| 137 CrxInstaller* crx_installer = content::Source<CrxInstaller>(source).ptr(); | 138 CrxInstaller* crx_installer = content::Source<CrxInstaller>(source).ptr(); |
| 138 CHECK(crx_installer); | 139 CHECK(crx_installer); |
| 139 if (!profile_->IsSameProfile(crx_installer->profile())) | 140 if (!profile_->IsSameProfile(crx_installer->profile())) |
| 140 return; | 141 return; |
| 141 | 142 |
| 142 const std::string* error = | 143 // TODO(rdevlin.cronin): Continue removing std::string errors and |
| 143 content::Details<const std::string>(details).ptr(); | 144 // replacing with string16 |
| 145 const string16* error = content::Details<const string16>(details).ptr(); |
| 146 const std::string utf8_error = UTF16ToUTF8(*error); |
| 144 if (download_url_ == crx_installer->original_download_url()) | 147 if (download_url_ == crx_installer->original_download_url()) |
| 145 ReportFailure(*error); | 148 ReportFailure(utf8_error); |
| 146 break; | 149 break; |
| 147 } | 150 } |
| 148 | 151 |
| 149 default: | 152 default: |
| 150 NOTREACHED(); | 153 NOTREACHED(); |
| 151 } | 154 } |
| 152 } | 155 } |
| 153 | 156 |
| 154 void WebstoreInstaller::StartDownload(FilePath file) { | 157 void WebstoreInstaller::StartDownload(FilePath file) { |
| 155 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 158 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 179 | 182 |
| 180 Release(); // Balanced in Start(). | 183 Release(); // Balanced in Start(). |
| 181 } | 184 } |
| 182 | 185 |
| 183 void WebstoreInstaller::ReportSuccess() { | 186 void WebstoreInstaller::ReportSuccess() { |
| 184 if (delegate_) | 187 if (delegate_) |
| 185 delegate_->OnExtensionInstallSuccess(id_); | 188 delegate_->OnExtensionInstallSuccess(id_); |
| 186 | 189 |
| 187 Release(); // Balanced in Start(). | 190 Release(); // Balanced in Start(). |
| 188 } | 191 } |
| OLD | NEW |