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

Unified Diff: chrome/browser/ui/browser.cc

Issue 8496024: Don't close crashed tabs from extensions with background pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mpcomplete's Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index ffec67caca232279866e909c97ad0d3362429209..8ca95331554ce17f7645ff1376e9ce5a18879cbb 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -4251,24 +4251,28 @@ void Browser::Observe(int type,
if (window()->GetLocationBar())
window()->GetLocationBar()->UpdatePageActions();
- // Close any tabs from the unloaded extension.
- const Extension* extension =
- content::Details<UnloadedExtensionInfo>(details)->extension;
- TabStripModel* model = tab_handler_->GetTabStripModel();
- for (int i = model->count() - 1; i >= 0; --i) {
- TabContents* tc = model->GetTabContentsAt(i)->tab_contents();
- bool close_tab_contents =
- tc->GetURL().SchemeIs(chrome::kExtensionScheme) &&
- tc->GetURL().host() == extension->id();
- // We want to close all panels originated by the unloaded extension.
- close_tab_contents = close_tab_contents || (type_ == TYPE_PANEL &&
- (web_app::GetExtensionIdFromApplicationName(app_name_) ==
+ // Close any tabs from the unloaded extension, unless it's terminated,
+ // in which case let the sad tabs remain.
+ if (content::Details<UnloadedExtensionInfo>(details)->reason !=
+ extension_misc::UNLOAD_REASON_TERMINATE) {
+ const Extension* extension =
+ content::Details<UnloadedExtensionInfo>(details)->extension;
+ TabStripModel* model = tab_handler_->GetTabStripModel();
+ for (int i = model->count() - 1; i >= 0; --i) {
+ TabContents* tc = model->GetTabContentsAt(i)->tab_contents();
+ bool close_tab_contents =
+ tc->GetURL().SchemeIs(chrome::kExtensionScheme) &&
+ tc->GetURL().host() == extension->id();
+ // We want to close all panels originated by the unloaded extension.
+ close_tab_contents = close_tab_contents ||
+ (type_ == TYPE_PANEL &&
+ (web_app::GetExtensionIdFromApplicationName(app_name_) ==
extension->id()));
- if (close_tab_contents) {
- CloseTabContents(tc);
+ if (close_tab_contents) {
+ CloseTabContents(tc);
+ }
}
}
-
break;
}
« no previous file with comments | « chrome/browser/renderer_host/chrome_render_view_host_observer.cc ('k') | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698