| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 5 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
| 11 #include "chrome/common/extensions/extension_icon_set.h" | 11 #include "chrome/common/extensions/extension_icon_set.h" |
| 12 #include "chrome/common/extensions/extension_resource.h" | 12 #include "chrome/common/extensions/extension_resource.h" |
| 13 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
| 14 #include "grit/theme_resources.h" | 14 #include "grit/theme_resources.h" |
| 15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
| 16 | 16 |
| 17 // Size of extension icon in top left of dialog. | 17 // Size of extension icon in top left of dialog. |
| 18 static const int kIconSize = 69; | 18 static const int kIconSize = 69; |
| 19 | 19 |
| 20 ExtensionUninstallDialog::ExtensionUninstallDialog(Profile* profile) | 20 ExtensionUninstallDialog::ExtensionUninstallDialog( |
| 21 Profile* profile, |
| 22 ExtensionUninstallDialog::Delegate* delegate) |
| 21 : profile_(profile), | 23 : profile_(profile), |
| 24 delegate_(delegate), |
| 25 extension_(NULL), |
| 22 ui_loop_(MessageLoop::current()), | 26 ui_loop_(MessageLoop::current()), |
| 23 delegate_(NULL), | 27 ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)) {} |
| 24 extension_(NULL), | |
| 25 ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)) { | |
| 26 } | |
| 27 | 28 |
| 28 ExtensionUninstallDialog::~ExtensionUninstallDialog() { | 29 ExtensionUninstallDialog::~ExtensionUninstallDialog() {} |
| 29 } | |
| 30 | 30 |
| 31 void ExtensionUninstallDialog::ConfirmUninstall(Delegate* delegate, | 31 void ExtensionUninstallDialog::ConfirmUninstall(const Extension* extension) { |
| 32 const Extension* extension) { | |
| 33 DCHECK(ui_loop_ == MessageLoop::current()); | 32 DCHECK(ui_loop_ == MessageLoop::current()); |
| 34 delegate_ = delegate; | |
| 35 extension_ = extension; | 33 extension_ = extension; |
| 36 | 34 |
| 37 ExtensionResource image = | 35 ExtensionResource image = |
| 38 extension_->GetIconResource(Extension::EXTENSION_ICON_LARGE, | 36 extension_->GetIconResource(Extension::EXTENSION_ICON_LARGE, |
| 39 ExtensionIconSet::MATCH_EXACTLY); | 37 ExtensionIconSet::MATCH_EXACTLY); |
| 40 // Load the image asynchronously. The response will be sent to OnImageLoaded. | 38 // Load the image asynchronously. The response will be sent to OnImageLoaded. |
| 41 tracker_.LoadImage(extension_, image, | 39 tracker_.LoadImage(extension_, image, |
| 42 gfx::Size(kIconSize, kIconSize), | 40 gfx::Size(kIconSize, kIconSize), |
| 43 ImageLoadingTracker::DONT_CACHE); | 41 ImageLoadingTracker::DONT_CACHE); |
| 44 } | 42 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 57 IDR_EXTENSION_DEFAULT_ICON); | 55 IDR_EXTENSION_DEFAULT_ICON); |
| 58 } | 56 } |
| 59 } | 57 } |
| 60 } | 58 } |
| 61 | 59 |
| 62 void ExtensionUninstallDialog::OnImageLoaded(SkBitmap* image, | 60 void ExtensionUninstallDialog::OnImageLoaded(SkBitmap* image, |
| 63 const ExtensionResource& resource, | 61 const ExtensionResource& resource, |
| 64 int index) { | 62 int index) { |
| 65 SetIcon(image); | 63 SetIcon(image); |
| 66 | 64 |
| 67 Show(profile_, delegate_, extension_, &icon_); | 65 Show(); |
| 68 } | 66 } |
| OLD | NEW |