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

Side by Side Diff: chrome/browser/extensions/extension_context_menu_model.cc

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 #include "chrome/browser/extensions/extension_context_menu_model.h" 5 #include "chrome/browser/extensions/extension_context_menu_model.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/extension_tabs_module.h" 9 #include "chrome/browser/extensions/extension_tabs_module.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 extension_service->SetBrowserActionVisibility(extension, false); 124 extension_service->SetBrowserActionVisibility(extension, false);
125 break; 125 break;
126 } 126 }
127 case DISABLE: { 127 case DISABLE: {
128 ExtensionService* extension_service = profile_->GetExtensionService(); 128 ExtensionService* extension_service = profile_->GetExtensionService();
129 extension_service->DisableExtension(extension_id_); 129 extension_service->DisableExtension(extension_id_);
130 break; 130 break;
131 } 131 }
132 case UNINSTALL: { 132 case UNINSTALL: {
133 AddRef(); // Balanced in Accepted() and Canceled() 133 AddRef(); // Balanced in Accepted() and Canceled()
134 extension_uninstall_dialog_.reset(new ExtensionUninstallDialog(profile_)); 134 extension_uninstall_dialog_.reset(
135 extension_uninstall_dialog_->ConfirmUninstall(this, extension); 135 ExtensionUninstallDialog::Create(profile_, this));
136 extension_uninstall_dialog_->ConfirmUninstall(extension);
136 break; 137 break;
137 } 138 }
138 case MANAGE: { 139 case MANAGE: {
139 browser_->ShowOptionsTab(chrome::kExtensionsSubPage); 140 browser_->ShowOptionsTab(chrome::kExtensionsSubPage);
140 break; 141 break;
141 } 142 }
142 case INSPECT_POPUP: { 143 case INSPECT_POPUP: {
143 delegate_->InspectPopup(extension_action_); 144 delegate_->InspectPopup(extension_action_);
144 break; 145 break;
145 } 146 }
146 default: 147 default:
147 NOTREACHED() << "Unknown option"; 148 NOTREACHED() << "Unknown option";
148 break; 149 break;
149 } 150 }
150 } 151 }
151 152
152 void ExtensionContextMenuModel::ExtensionDialogAccepted() { 153 void ExtensionContextMenuModel::ExtensionUninstallAccepted() {
153 if (GetExtension()) 154 if (GetExtension())
154 profile_->GetExtensionService()->UninstallExtension(extension_id_, false, 155 profile_->GetExtensionService()->UninstallExtension(extension_id_, false,
155 NULL); 156 NULL);
156 157
157 Release(); 158 Release();
158 } 159 }
159 160
160 void ExtensionContextMenuModel::ExtensionDialogCanceled() { 161 void ExtensionContextMenuModel::ExtensionUninstallCanceled() {
161 Release(); 162 Release();
162 } 163 }
163 164
164 const Extension* ExtensionContextMenuModel::GetExtension() const { 165 const Extension* ExtensionContextMenuModel::GetExtension() const {
165 ExtensionService* extension_service = profile_->GetExtensionService(); 166 ExtensionService* extension_service = profile_->GetExtensionService();
166 return extension_service->GetExtensionById(extension_id_, false); 167 return extension_service->GetExtensionById(extension_id_, false);
167 } 168 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_context_menu_model.h ('k') | chrome/browser/extensions/extension_install_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698