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

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 8387010: Close all panels originated by the extension when extension unloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Replace RunAllPending in loop with waiting for notifications. Created 9 years, 2 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/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 4266 matching lines...) Expand 10 before | Expand all | Expand 10 after
4277 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { 4277 case chrome::NOTIFICATION_EXTENSION_UNLOADED: {
4278 if (window()->GetLocationBar()) 4278 if (window()->GetLocationBar())
4279 window()->GetLocationBar()->UpdatePageActions(); 4279 window()->GetLocationBar()->UpdatePageActions();
4280 4280
4281 // Close any tabs from the unloaded extension. 4281 // Close any tabs from the unloaded extension.
4282 const Extension* extension = 4282 const Extension* extension =
4283 content::Details<UnloadedExtensionInfo>(details)->extension; 4283 content::Details<UnloadedExtensionInfo>(details)->extension;
4284 TabStripModel* model = tab_handler_->GetTabStripModel(); 4284 TabStripModel* model = tab_handler_->GetTabStripModel();
4285 for (int i = model->count() - 1; i >= 0; --i) { 4285 for (int i = model->count() - 1; i >= 0; --i) {
4286 TabContents* tc = model->GetTabContentsAt(i)->tab_contents(); 4286 TabContents* tc = model->GetTabContentsAt(i)->tab_contents();
4287 if (tc->GetURL().SchemeIs(chrome::kExtensionScheme) && 4287 bool close_tab_contents =
4288 tc->GetURL().host() == extension->id()) { 4288 tc->GetURL().SchemeIs(chrome::kExtensionScheme) &&
4289 tc->GetURL().host() == extension->id();
4290 if (!close_tab_contents) {
Dmitry Titov 2011/10/25 20:29:15 nit: could it be more readable like this: close_ta
prasadt 2011/10/28 18:23:19 Done.
4291 // We want to close all panels originated by the unloaded extension.
4292 close_tab_contents =
4293 (web_app::GetExtensionIdFromApplicationName(app_name_) ==
4294 extension->id()) && type_ == TYPE_PANEL;
4295 }
4296 if (close_tab_contents) {
4289 CloseTabContents(tc); 4297 CloseTabContents(tc);
4290 } 4298 }
4291 } 4299 }
4292 4300
4293 break; 4301 break;
4294 } 4302 }
4295 4303
4296 case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: { 4304 case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: {
4297 Profile* profile = content::Source<Profile>(source).ptr(); 4305 Profile* profile = content::Source<Profile>(source).ptr();
4298 if (profile_->IsSameProfile(profile) && window()->GetLocationBar()) 4306 if (profile_->IsSameProfile(profile) && window()->GetLocationBar())
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after
5526 } 5534 }
5527 5535
5528 void Browser::UpdateFullscreenExitBubbleContent() { 5536 void Browser::UpdateFullscreenExitBubbleContent() {
5529 GURL url; 5537 GURL url;
5530 if (fullscreened_tab_) 5538 if (fullscreened_tab_)
5531 url = fullscreened_tab_->tab_contents()->GetURL(); 5539 url = fullscreened_tab_->tab_contents()->GetURL();
5532 5540
5533 window_->UpdateFullscreenExitBubbleContent( 5541 window_->UpdateFullscreenExitBubbleContent(
5534 url, GetFullscreenExitBubbleType()); 5542 url, GetFullscreenExitBubbleType());
5535 } 5543 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/panels/panel_browsertest.cc » ('j') | chrome/browser/ui/panels/panel_browsertest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698