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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/app_list/extension_uninstaller.h"
7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/extensions/extension_system.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
11 #include "extensions/common/extension.h"
13 ExtensionUninstaller::ExtensionUninstaller(
15 const std::string
& extension_id
,
16 AppListControllerDelegate
* controller
)
18 app_id_(extension_id
),
19 controller_(controller
) {
22 ExtensionUninstaller::~ExtensionUninstaller() {
25 void ExtensionUninstaller::Run() {
26 const extensions::Extension
* extension
=
27 extensions::ExtensionSystem::Get(profile_
)->extension_service()->
28 GetInstalledExtension(app_id_
);
33 controller_
->OnShowExtensionPrompt();
34 dialog_
.reset(ExtensionUninstallDialog::Create(profile_
, NULL
, this));
35 dialog_
->ConfirmUninstall(extension
);
38 void ExtensionUninstaller::ExtensionUninstallAccepted() {
39 ExtensionService
* service
=
40 extensions::ExtensionSystem::Get(profile_
)->extension_service();
41 const extensions::Extension
* extension
=
42 service
->GetInstalledExtension(app_id_
);
44 service
->UninstallExtension(app_id_
,
45 false, /* external_uninstall*/
48 controller_
->OnCloseExtensionPrompt();
52 void ExtensionUninstaller::ExtensionUninstallCanceled() {
53 controller_
->OnCloseExtensionPrompt();
57 void ExtensionUninstaller::CleanUp() {