| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/crx_installer.h" | 5 #include "chrome/browser/extensions/crx_installer.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/task.h" | 11 #include "base/task.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/extensions/extension_file_util.h" | 13 #include "chrome/browser/extensions/extension_file_util.h" |
| 14 #include "chrome/common/extensions/extension_error_reporter.h" | 14 #include "chrome/common/extensions/extension_error_reporter.h" |
| 15 #include "chrome/common/notification_service.h" |
| 16 #include "chrome/common/notification_type.h" |
| 15 #include "grit/chromium_strings.h" | 17 #include "grit/chromium_strings.h" |
| 16 #include "third_party/skia/include/core/SkBitmap.h" | 18 #include "third_party/skia/include/core/SkBitmap.h" |
| 17 #include "webkit/glue/image_decoder.h" | 19 #include "webkit/glue/image_decoder.h" |
| 18 | 20 |
| 19 namespace { | 21 namespace { |
| 20 // Helper function to delete files. This is used to avoid ugly casts which | 22 // Helper function to delete files. This is used to avoid ugly casts which |
| 21 // would be necessary with PostMessage since file_util::Delete is overloaded. | 23 // would be necessary with PostMessage since file_util::Delete is overloaded. |
| 22 static void DeleteFileHelper(const FilePath& path, bool recursive) { | 24 static void DeleteFileHelper(const FilePath& path, bool recursive) { |
| 23 file_util::Delete(path, recursive); | 25 file_util::Delete(path, recursive); |
| 24 } | 26 } |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 | 247 |
| 246 void CrxInstaller::ReportFailureFromFileThread(const std::string& error) { | 248 void CrxInstaller::ReportFailureFromFileThread(const std::string& error) { |
| 247 DCHECK(MessageLoop::current() == file_loop_); | 249 DCHECK(MessageLoop::current() == file_loop_); |
| 248 ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, | 250 ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, |
| 249 &CrxInstaller::ReportFailureFromUIThread, error)); | 251 &CrxInstaller::ReportFailureFromUIThread, error)); |
| 250 } | 252 } |
| 251 | 253 |
| 252 void CrxInstaller::ReportFailureFromUIThread(const std::string& error) { | 254 void CrxInstaller::ReportFailureFromUIThread(const std::string& error) { |
| 253 DCHECK(MessageLoop::current() == ui_loop_); | 255 DCHECK(MessageLoop::current() == ui_loop_); |
| 254 | 256 |
| 257 NotificationService* service = NotificationService::current(); |
| 258 service->Notify(NotificationType::NO_THEME_DETECTED, |
| 259 Source<CrxInstaller>(this), |
| 260 NotificationService::NoDetails()); |
| 261 |
| 255 // This isn't really necessary, it is only used because unit tests expect to | 262 // This isn't really necessary, it is only used because unit tests expect to |
| 256 // see errors get reported via this interface. | 263 // see errors get reported via this interface. |
| 257 // | 264 // |
| 258 // TODO(aa): Need to go through unit tests and clean them up too, probably get | 265 // TODO(aa): Need to go through unit tests and clean them up too, probably get |
| 259 // rid of this line. | 266 // rid of this line. |
| 260 ExtensionErrorReporter::GetInstance()->ReportError(error, false); // quiet | 267 ExtensionErrorReporter::GetInstance()->ReportError(error, false); // quiet |
| 261 | 268 |
| 262 if (client_.get()) | 269 if (client_.get()) |
| 263 client_->OnInstallFailure(error); | 270 client_->OnInstallFailure(error); |
| 264 } | 271 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 292 client_->OnInstallSuccess(extension_.get()); | 299 client_->OnInstallSuccess(extension_.get()); |
| 293 | 300 |
| 294 // Tell the frontend about the installation and hand off ownership of | 301 // Tell the frontend about the installation and hand off ownership of |
| 295 // extension_ to it. | 302 // extension_ to it. |
| 296 frontend_->OnExtensionInstalled(extension_.release(), | 303 frontend_->OnExtensionInstalled(extension_.release(), |
| 297 allow_privilege_increase_); | 304 allow_privilege_increase_); |
| 298 | 305 |
| 299 // We're done. We don't post any more tasks to ourselves so we are deleted | 306 // We're done. We don't post any more tasks to ourselves so we are deleted |
| 300 // soon. | 307 // soon. |
| 301 } | 308 } |
| OLD | NEW |