| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/app_list/extension_uninstaller.h" | 5 #include "chrome/browser/ui/app_list/extension_uninstaller.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 9 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
| 10 #include "extensions/browser/extension_system.h" | 10 #include "extensions/browser/extension_system.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 void ExtensionUninstaller::Run() { | 26 void ExtensionUninstaller::Run() { |
| 27 const extensions::Extension* extension = | 27 const extensions::Extension* extension = |
| 28 extensions::ExtensionSystem::Get(profile_)->extension_service()-> | 28 extensions::ExtensionSystem::Get(profile_)->extension_service()-> |
| 29 GetInstalledExtension(app_id_); | 29 GetInstalledExtension(app_id_); |
| 30 if (!extension) { | 30 if (!extension) { |
| 31 CleanUp(); | 31 CleanUp(); |
| 32 return; | 32 return; |
| 33 } | 33 } |
| 34 controller_->OnShowChildDialog(); | 34 controller_->OnShowChildDialog(); |
| 35 dialog_.reset( | 35 dialog_.reset(extensions::ExtensionUninstallDialog::CreateModal( |
| 36 extensions::ExtensionUninstallDialog::Create(profile_, NULL, this)); | 36 profile_, controller_->GetAppListWindow(), this)); |
| 37 dialog_->ConfirmUninstall(extension); | 37 dialog_->ConfirmUninstall(extension); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void ExtensionUninstaller::ExtensionUninstallAccepted() { | 40 void ExtensionUninstaller::ExtensionUninstallAccepted() { |
| 41 ExtensionService* service = | 41 ExtensionService* service = |
| 42 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 42 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
| 43 const extensions::Extension* extension = | 43 const extensions::Extension* extension = |
| 44 service->GetInstalledExtension(app_id_); | 44 service->GetInstalledExtension(app_id_); |
| 45 if (extension) { | 45 if (extension) { |
| 46 service->UninstallExtension( | 46 service->UninstallExtension( |
| 47 app_id_, extensions::UNINSTALL_REASON_USER_INITIATED, NULL); | 47 app_id_, extensions::UNINSTALL_REASON_USER_INITIATED, NULL); |
| 48 } | 48 } |
| 49 controller_->OnCloseChildDialog(); | 49 controller_->OnCloseChildDialog(); |
| 50 CleanUp(); | 50 CleanUp(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void ExtensionUninstaller::ExtensionUninstallCanceled() { | 53 void ExtensionUninstaller::ExtensionUninstallCanceled() { |
| 54 controller_->OnCloseChildDialog(); | 54 controller_->OnCloseChildDialog(); |
| 55 CleanUp(); | 55 CleanUp(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void ExtensionUninstaller::CleanUp() { | 58 void ExtensionUninstaller::CleanUp() { |
| 59 delete this; | 59 delete this; |
| 60 } | 60 } |
| OLD | NEW |