Chromium Code Reviews| 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" |
| 11 #include "extensions/common/extension.h" | 11 #include "extensions/common/extension.h" |
| 12 | 12 |
| 13 using extensions::UninstalledExtensionInfo; | |
|
Devlin
2014/07/16 20:05:43
for non-extensions code, let's limit the using sta
rpaquay
2014/07/16 21:16:45
Done.
| |
| 14 | |
| 13 ExtensionUninstaller::ExtensionUninstaller( | 15 ExtensionUninstaller::ExtensionUninstaller( |
| 14 Profile* profile, | 16 Profile* profile, |
| 15 const std::string& extension_id, | 17 const std::string& extension_id, |
| 16 AppListControllerDelegate* controller) | 18 AppListControllerDelegate* controller) |
| 17 : profile_(profile), | 19 : profile_(profile), |
| 18 app_id_(extension_id), | 20 app_id_(extension_id), |
| 19 controller_(controller) { | 21 controller_(controller) { |
| 20 } | 22 } |
| 21 | 23 |
| 22 ExtensionUninstaller::~ExtensionUninstaller() { | 24 ExtensionUninstaller::~ExtensionUninstaller() { |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 36 dialog_->ConfirmUninstall(extension); | 38 dialog_->ConfirmUninstall(extension); |
| 37 } | 39 } |
| 38 | 40 |
| 39 void ExtensionUninstaller::ExtensionUninstallAccepted() { | 41 void ExtensionUninstaller::ExtensionUninstallAccepted() { |
| 40 ExtensionService* service = | 42 ExtensionService* service = |
| 41 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 43 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
| 42 const extensions::Extension* extension = | 44 const extensions::Extension* extension = |
| 43 service->GetInstalledExtension(app_id_); | 45 service->GetInstalledExtension(app_id_); |
| 44 if (extension) { | 46 if (extension) { |
| 45 service->UninstallExtension( | 47 service->UninstallExtension( |
| 46 app_id_, ExtensionService::UNINSTALL_REASON_USER_INITIATED, NULL); | 48 app_id_, UninstalledExtensionInfo::REASON_USER_INITIATED, NULL); |
| 47 } | 49 } |
| 48 controller_->OnCloseChildDialog(); | 50 controller_->OnCloseChildDialog(); |
| 49 CleanUp(); | 51 CleanUp(); |
| 50 } | 52 } |
| 51 | 53 |
| 52 void ExtensionUninstaller::ExtensionUninstallCanceled() { | 54 void ExtensionUninstaller::ExtensionUninstallCanceled() { |
| 53 controller_->OnCloseChildDialog(); | 55 controller_->OnCloseChildDialog(); |
| 54 CleanUp(); | 56 CleanUp(); |
| 55 } | 57 } |
| 56 | 58 |
| 57 void ExtensionUninstaller::CleanUp() { | 59 void ExtensionUninstaller::CleanUp() { |
| 58 delete this; | 60 delete this; |
| 59 } | 61 } |
| OLD | NEW |