Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / ui / app_list / extension_uninstaller.cc
blobc5fdb7ff74e33b585c69a00495f3a26607e1f135
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/profiles/profile.h"
8 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
9 #include "extensions/browser/extension_registry.h"
10 #include "extensions/browser/uninstall_reason.h"
11 #include "extensions/common/extension.h"
13 ExtensionUninstaller::ExtensionUninstaller(
14 Profile* profile,
15 const std::string& extension_id,
16 AppListControllerDelegate* controller)
17 : profile_(profile),
18 app_id_(extension_id),
19 controller_(controller) {
22 ExtensionUninstaller::~ExtensionUninstaller() {
25 void ExtensionUninstaller::Run() {
26 const extensions::Extension* extension =
27 extensions::ExtensionRegistry::Get(profile_)->GetInstalledExtension(
28 app_id_);
29 if (!extension) {
30 CleanUp();
31 return;
33 controller_->OnShowChildDialog();
34 dialog_.reset(extensions::ExtensionUninstallDialog::Create(
35 profile_, controller_->GetAppListWindow(), this));
36 dialog_->ConfirmUninstall(extension,
37 extensions::UNINSTALL_REASON_USER_INITIATED,
38 extensions::UNINSTALL_SOURCE_APP_LIST);
41 void ExtensionUninstaller::OnExtensionUninstallDialogClosed(
42 bool did_start_uninstall,
43 const base::string16& error) {
44 controller_->OnCloseChildDialog();
45 CleanUp();
48 void ExtensionUninstaller::CleanUp() {
49 delete this;