blob: d6371c73a0f7a0c9b72ab87f919b3fcdc78a3dbe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/app_list/extension_uninstaller.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
ExtensionUninstaller::ExtensionUninstaller(
Profile* profile,
const std::string& extension_id,
AppListControllerDelegate* controller)
: profile_(profile),
app_id_(extension_id),
controller_(controller) {
}
ExtensionUninstaller::~ExtensionUninstaller() {
}
void ExtensionUninstaller::Run() {
const extensions::Extension* extension =
extensions::ExtensionRegistry::Get(profile_)->GetInstalledExtension(
app_id_);
if (!extension) {
CleanUp();
return;
}
controller_->OnShowChildDialog();
dialog_.reset(extensions::ExtensionUninstallDialog::Create(
profile_, controller_->GetAppListWindow(), this));
dialog_->ConfirmUninstall(extension,
extensions::UNINSTALL_REASON_USER_INITIATED);
}
void ExtensionUninstaller::OnExtensionUninstallDialogClosed(
bool did_start_uninstall,
const base::string16& error) {
controller_->OnCloseChildDialog();
CleanUp();
}
void ExtensionUninstaller::CleanUp() {
delete this;
}
|