summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_install_ui.cc
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-04 06:46:21 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-04 06:46:21 +0000
commitd2817019145d7806d400ae70bf9fb4b5681905c8 (patch)
tree21cf799953ab964c5d089bdb519b86bae4823269 /chrome/browser/extensions/extension_install_ui.cc
parenta3a63ff836382403dc681befbd1cc866e8e5c117 (diff)
downloadchromium_src-d2817019145d7806d400ae70bf9fb4b5681905c8.zip
chromium_src-d2817019145d7806d400ae70bf9fb4b5681905c8.tar.gz
chromium_src-d2817019145d7806d400ae70bf9fb4b5681905c8.tar.bz2
Implement first cut at the extension installation prompt on Windows.
Had to move set_path() earlier in the unpack process so that we would have real paths for the resources, so that we could load and display the icon in the ui. This exposed a problem where page actions had absolute paths and other images in extensions had relative paths. Extension::GetBrowserImages() was expecting relative paths, and it just happened to work because in both cases Extension was initialized without a path. Modified page actions to use relative paths to be consistent with other images. Review URL: http://codereview.chromium.org/160516 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22368 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_install_ui.cc')
-rw-r--r--chrome/browser/extensions/extension_install_ui.cc35
1 files changed, 21 insertions, 14 deletions
diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc
index 4416701..135aac7 100644
--- a/chrome/browser/extensions/extension_install_ui.cc
+++ b/chrome/browser/extensions/extension_install_ui.cc
@@ -4,12 +4,17 @@
#include "chrome/browser/extensions/extension_install_ui.h"
+#include <map>
+
#include "app/l10n_util.h"
-#include "grit/chromium_strings.h"
+#include "base/file_util.h"
#include "chrome/browser/browser_list.h"
+#include "chrome/browser/browser_window.h"
#include "chrome/browser/extensions/theme_preview_infobar_delegate.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/common/extensions/extension.h"
+#include "grit/chromium_strings.h"
#if defined(OS_WIN)
#include "app/win_util.h"
@@ -23,24 +28,24 @@ ExtensionInstallUI::ExtensionInstallUI(Profile* profile)
: profile_(profile), ui_loop_(MessageLoop::current()) {
}
-bool ExtensionInstallUI::ConfirmInstall(Extension* extension) {
+void ExtensionInstallUI::ConfirmInstall(CrxInstaller* installer,
+ Extension* extension,
+ SkBitmap* install_icon) {
DCHECK(ui_loop_ == MessageLoop::current());
// We special-case themes to not show any confirm UI. Instead they are
// immediately installed, and then we show an infobar (see OnInstallSuccess)
// to allow the user to revert if they don't like it.
- if (extension->IsTheme())
- return true;
+ if (extension->IsTheme()) {
+ installer->ContinueInstall();
+ return;
+ }
#if defined(OS_WIN)
- if (win_util::MessageBox(GetForegroundWindow(),
- L"Are you sure you want to install this extension?\n\n"
- L"You should only install extensions from sources you trust.",
- l10n_util::GetString(IDS_PRODUCT_NAME).c_str(),
- MB_OKCANCEL) != IDOK) {
- return false;
- }
+ ShowExtensionInstallPrompt(profile_, installer, extension, install_icon);
+
#elif defined(OS_MACOSX)
+ // TODO(port): Implement nicer UI.
// Using CoreFoundation to do this dialog is unimaginably lame but will do
// until the UI is redone.
scoped_cftyperef<CFStringRef> product_name(
@@ -53,13 +58,15 @@ bool ExtensionInstallUI::ConfirmInstall(Extension* extension) {
"This is a temporary message and it will be removed when "
"extensions UI is finalized."),
NULL, CFSTR("Cancel"), NULL, &response)) {
- return false;
+ installer->AbortInstall();
+ } else {
+ installer->ContinueInstall();
}
#else
+ // TODO(port): Implement some UI.
NOTREACHED();
+ installer->ContinueInstall();
#endif // OS_*
-
- return true;
}
void ExtensionInstallUI::OnInstallSuccess(Extension* extension) {