Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(484)

Side by Side Diff: chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm

Issue 7920023: Fix crashes related to the extension uninstall dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make Show() pure virtual Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #import "chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h" 5 #import "chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h"
6 6
7 #include "base/sys_string_conversions.h" 7 #include "base/sys_string_conversions.h"
8 #include "base/task.h" 8 #include "base/task.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_tabs_module.h" 10 #include "chrome/browser/extensions/extension_tabs_module.h"
(...skipping 22 matching lines...) Expand all
33 #include "ui/base/l10n/l10n_util_mac.h" 33 #include "ui/base/l10n/l10n_util_mac.h"
34 34
35 // A class that loads the extension icon on the I/O thread before showing the 35 // A class that loads the extension icon on the I/O thread before showing the
36 // confirmation dialog to uninstall the given extension. 36 // confirmation dialog to uninstall the given extension.
37 // Also acts as the extension's UI delegate in order to display the dialog. 37 // Also acts as the extension's UI delegate in order to display the dialog.
38 class AsyncUninstaller : public ExtensionUninstallDialog::Delegate { 38 class AsyncUninstaller : public ExtensionUninstallDialog::Delegate {
39 public: 39 public:
40 AsyncUninstaller(const Extension* extension, Profile* profile) 40 AsyncUninstaller(const Extension* extension, Profile* profile)
41 : extension_(extension), 41 : extension_(extension),
42 profile_(profile) { 42 profile_(profile) {
43 extension_uninstall_dialog_.reset(new ExtensionUninstallDialog(profile)); 43 extension_uninstall_dialog_.reset(
44 extension_uninstall_dialog_->ConfirmUninstall(this, extension_); 44 ExtensionUninstallDialog::Create(profile, this));
45 extension_uninstall_dialog_->ConfirmUninstall(extension_);
45 } 46 }
46 47
47 ~AsyncUninstaller() {} 48 ~AsyncUninstaller() {}
48 49
49 // ExtensionUninstallDialog::Delegate: 50 // ExtensionUninstallDialog::Delegate:
50 virtual void ExtensionDialogAccepted() { 51 virtual void ExtensionUninstallAccepted() {
51 profile_->GetExtensionService()-> 52 profile_->GetExtensionService()->
52 UninstallExtension(extension_->id(), false, NULL); 53 UninstallExtension(extension_->id(), false, NULL);
53 } 54 }
54 virtual void ExtensionDialogCanceled() {} 55 virtual void ExtensionUninstallCanceled() {}
55 56
56 private: 57 private:
57 // The extension that we're loading the icon for. Weak. 58 // The extension that we're loading the icon for. Weak.
58 const Extension* extension_; 59 const Extension* extension_;
59 60
60 // The current profile. Weak. 61 // The current profile. Weak.
61 Profile* profile_; 62 Profile* profile_;
62 63
63 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_; 64 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_;
64 65
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 } 316 }
316 return YES; 317 return YES;
317 } 318 }
318 319
319 - (void)invalidateProfile { 320 - (void)invalidateProfile {
320 observer_.reset(); 321 observer_.reset();
321 profile_ = NULL; 322 profile_ = NULL;
322 } 323 }
323 324
324 @end 325 @end
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extensions_ui.cc ('k') | chrome/browser/ui/cocoa/extensions/extension_uninstall_dialog_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698