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

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

Issue 7003068: Fix crash when you uninstall a permissions-upgrade disabled extension. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: initialize extension to NULL Created 9 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_management_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_disabled_infobar_delegate.h" 5 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/extensions/extension_install_ui.h" 10 #include "chrome/browser/extensions/extension_install_ui.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 extension_); 145 extension_);
146 return true; 146 return true;
147 } 147 }
148 148
149 void ExtensionDisabledInfobarDelegate::Observe( 149 void ExtensionDisabledInfobarDelegate::Observe(
150 NotificationType type, 150 NotificationType type,
151 const NotificationSource& source, 151 const NotificationSource& source,
152 const NotificationDetails& details) { 152 const NotificationDetails& details) {
153 // TODO(mpcomplete): RemoveInfoBar doesn't seem to always result in us getting 153 // TODO(mpcomplete): RemoveInfoBar doesn't seem to always result in us getting
154 // deleted. 154 // deleted.
155 const Extension* extension; 155 const Extension* extension = NULL;
156 if (type.value == NotificationType::EXTENSION_LOADED) { 156 if (type.value == NotificationType::EXTENSION_LOADED) {
157 extension = Details<const Extension>(details).ptr(); 157 extension = Details<const Extension>(details).ptr();
158 } else { 158 } else {
159 DCHECK_EQ(NotificationType::EXTENSION_UNLOADED, type.value); 159 DCHECK_EQ(NotificationType::EXTENSION_UNLOADED, type.value);
160 UnloadedExtensionInfo* info = Details<UnloadedExtensionInfo>(details).ptr(); 160 UnloadedExtensionInfo* info = Details<UnloadedExtensionInfo>(details).ptr();
161 extension = (info->reason == UnloadedExtensionInfo::DISABLE) ? 161 if (info->reason == UnloadedExtensionInfo::DISABLE ||
162 info->extension : NULL; 162 info->reason == UnloadedExtensionInfo::UNINSTALL)
163 extension = info->extension;
163 } 164 }
164 if (extension == extension_) 165 if (extension == extension_)
165 tab_contents_->RemoveInfoBar(this); 166 tab_contents_->RemoveInfoBar(this);
166 } 167 }
167 168
168 169
169 // Globals -------------------------------------------------------------------- 170 // Globals --------------------------------------------------------------------
170 171
171 void ShowExtensionDisabledUI(ExtensionService* service, Profile* profile, 172 void ShowExtensionDisabledUI(ExtensionService* service, Profile* profile,
172 const Extension* extension) { 173 const Extension* extension) {
173 Browser* browser = BrowserList::GetLastActiveWithProfile(profile); 174 Browser* browser = BrowserList::GetLastActiveWithProfile(profile);
174 if (!browser) 175 if (!browser)
175 return; 176 return;
176 177
177 TabContentsWrapper* tab_contents = browser->GetSelectedTabContentsWrapper(); 178 TabContentsWrapper* tab_contents = browser->GetSelectedTabContentsWrapper();
178 if (!tab_contents) 179 if (!tab_contents)
179 return; 180 return;
180 181
181 tab_contents->AddInfoBar(new ExtensionDisabledInfobarDelegate( 182 tab_contents->AddInfoBar(new ExtensionDisabledInfobarDelegate(
182 tab_contents, service, extension)); 183 tab_contents, service, extension));
183 } 184 }
184 185
185 void ShowExtensionDisabledDialog(ExtensionService* service, Profile* profile, 186 void ShowExtensionDisabledDialog(ExtensionService* service, Profile* profile,
186 const Extension* extension) { 187 const Extension* extension) {
187 // This object manages its own lifetime. 188 // This object manages its own lifetime.
188 new ExtensionDisabledDialogDelegate(profile, service, extension); 189 new ExtensionDisabledDialogDelegate(profile, service, extension);
189 } 190 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_management_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698