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

Side by Side 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 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/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 4233 matching lines...) Expand 10 before | Expand all | Expand 10 after
4244 extension->id())) 4244 extension->id()))
4245 ShowExtensionDisabledUI(service, profile_, extension); 4245 ShowExtensionDisabledUI(service, profile_, extension);
4246 } 4246 }
4247 break; 4247 break;
4248 } 4248 }
4249 4249
4250 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { 4250 case chrome::NOTIFICATION_EXTENSION_UNLOADED: {
4251 if (window()->GetLocationBar()) 4251 if (window()->GetLocationBar())
4252 window()->GetLocationBar()->UpdatePageActions(); 4252 window()->GetLocationBar()->UpdatePageActions();
4253 4253
4254 // Close any tabs from the unloaded extension. 4254 // Close any tabs from the unloaded extension, unless it's terminated,
4255 const Extension* extension = 4255 // in which case let the sad tabs remain.
4256 content::Details<UnloadedExtensionInfo>(details)->extension; 4256 if (content::Details<UnloadedExtensionInfo>(details)->reason !=
4257 TabStripModel* model = tab_handler_->GetTabStripModel(); 4257 extension_misc::UNLOAD_REASON_TERMINATE) {
4258 for (int i = model->count() - 1; i >= 0; --i) { 4258 const Extension* extension =
4259 TabContents* tc = model->GetTabContentsAt(i)->tab_contents(); 4259 content::Details<UnloadedExtensionInfo>(details)->extension;
4260 bool close_tab_contents = 4260 TabStripModel* model = tab_handler_->GetTabStripModel();
4261 tc->GetURL().SchemeIs(chrome::kExtensionScheme) && 4261 for (int i = model->count() - 1; i >= 0; --i) {
4262 tc->GetURL().host() == extension->id(); 4262 TabContents* tc = model->GetTabContentsAt(i)->tab_contents();
4263 // We want to close all panels originated by the unloaded extension. 4263 bool close_tab_contents =
4264 close_tab_contents = close_tab_contents || (type_ == TYPE_PANEL && 4264 tc->GetURL().SchemeIs(chrome::kExtensionScheme) &&
4265 (web_app::GetExtensionIdFromApplicationName(app_name_) == 4265 tc->GetURL().host() == extension->id();
4266 // We want to close all panels originated by the unloaded extension.
4267 close_tab_contents = close_tab_contents ||
4268 (type_ == TYPE_PANEL &&
4269 (web_app::GetExtensionIdFromApplicationName(app_name_) ==
4266 extension->id())); 4270 extension->id()));
4267 if (close_tab_contents) { 4271 if (close_tab_contents) {
4268 CloseTabContents(tc); 4272 CloseTabContents(tc);
4273 }
4269 } 4274 }
4270 } 4275 }
4271
4272 break; 4276 break;
4273 } 4277 }
4274 4278
4275 case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: { 4279 case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: {
4276 Profile* profile = content::Source<Profile>(source).ptr(); 4280 Profile* profile = content::Source<Profile>(source).ptr();
4277 if (profile_->IsSameProfile(profile) && window()->GetLocationBar()) 4281 if (profile_->IsSameProfile(profile) && window()->GetLocationBar())
4278 window()->GetLocationBar()->InvalidatePageActions(); 4282 window()->GetLocationBar()->InvalidatePageActions();
4279 break; 4283 break;
4280 } 4284 }
4281 4285
(...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after
5508 } 5512 }
5509 5513
5510 void Browser::UpdateFullscreenExitBubbleContent() { 5514 void Browser::UpdateFullscreenExitBubbleContent() {
5511 GURL url; 5515 GURL url;
5512 if (fullscreened_tab_) 5516 if (fullscreened_tab_)
5513 url = fullscreened_tab_->tab_contents()->GetURL(); 5517 url = fullscreened_tab_->tab_contents()->GetURL();
5514 5518
5515 window_->UpdateFullscreenExitBubbleContent( 5519 window_->UpdateFullscreenExitBubbleContent(
5516 url, GetFullscreenExitBubbleType()); 5520 url, GetFullscreenExitBubbleType());
5517 } 5521 }
OLDNEW
« 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