summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_uninstall_dialog.h
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-26 01:36:28 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-26 01:36:28 +0000
commit502e3961179b6855a717409e6947f9a389bc304d (patch)
tree476bd9aabf1892fcd505a81c7574ebe1be9764d6 /chrome/browser/extensions/extension_uninstall_dialog.h
parente294c1ae1f2d659ce4d5730a6bd90dd512926d3c (diff)
downloadchromium_src-502e3961179b6855a717409e6947f9a389bc304d.zip
chromium_src-502e3961179b6855a717409e6947f9a389bc304d.tar.gz
chromium_src-502e3961179b6855a717409e6947f9a389bc304d.tar.bz2
extensions: Refactor ExtensionInstallUI class.
- Remove extension_install_dialog.h. - Add ExtensionUninstallDialog class to handle just the uninstall dialog. BUG=66730 TEST=None R=aa@chromium.org Review URL: http://codereview.chromium.org/6721013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79479 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_uninstall_dialog.h')
-rw-r--r--chrome/browser/extensions/extension_uninstall_dialog.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_uninstall_dialog.h b/chrome/browser/extensions/extension_uninstall_dialog.h
new file mode 100644
index 0000000..086f219
--- /dev/null
+++ b/chrome/browser/extensions/extension_uninstall_dialog.h
@@ -0,0 +1,76 @@
+// Copyright (c) 2011 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.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_UNINSTALL_DIALOG_H_
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_UNINSTALL_DIALOG_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "chrome/browser/extensions/image_loading_tracker.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+
+class MessageLoop;
+class Profile;
+
+class ExtensionUninstallDialog : public ImageLoadingTracker::Observer {
+ public:
+ class Delegate {
+ public:
+ // We call this method to signal that the uninstallation should continue.
+ virtual void ExtensionDialogAccepted() = 0;
+
+ // We call this method to signal that the uninstallation should stop.
+ virtual void ExtensionDialogCanceled() = 0;
+
+ protected:
+ virtual ~Delegate() {}
+ };
+
+ explicit ExtensionUninstallDialog(Profile* profile);
+ virtual ~ExtensionUninstallDialog();
+
+ // This is called by the extensions management page to verify whether the
+ // uninstallation should proceed.
+ // Starts the process of showing a confirmation UI, which is split into two.
+ // 1) Set off a 'load icon' task.
+ // 2) Handle the load icon response and show the UI (OnImageLoaded).
+ void ConfirmUninstall(Delegate* delegate, const Extension* extension);
+
+ private:
+ // Creates an appropriate ExtensionUninstallDialog for the platform.
+ static void Show(Profile* profile,
+ Delegate* delegate,
+ const Extension* extension,
+ SkBitmap* icon);
+
+ // Sets the icon that will be used in any UI. If |icon| is NULL, or contains
+ // an empty bitmap, then a default icon will be used instead.
+ void SetIcon(SkBitmap* icon);
+
+ // ImageLoadingTracker::Observer:
+ virtual void OnImageLoaded(SkBitmap* image,
+ const ExtensionResource& resource,
+ int index) OVERRIDE;
+
+ Profile* profile_;
+ MessageLoop* ui_loop_;
+
+ // The delegate we will call Accepted/Canceled on after confirmation UI.
+ Delegate* delegate_;
+
+ // The extension we are showing the UI for.
+ const Extension* extension_;
+
+ // Keeps track of extension images being loaded on the File thread for the
+ // purpose of showing the install UI.
+ ImageLoadingTracker tracker_;
+
+ // The extensions icon.
+ SkBitmap icon_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionUninstallDialog);
+};
+
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_UNINSTALL_DIALOG_H_