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

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: Change ASSERT_EQ to EXPECT_EQ. 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 4254 matching lines...) Expand 10 before | Expand all | Expand 10 after
4265 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { 4265 case chrome::NOTIFICATION_EXTENSION_UNLOADED: {
4266 if (window()->GetLocationBar()) 4266 if (window()->GetLocationBar())
4267 window()->GetLocationBar()->UpdatePageActions(); 4267 window()->GetLocationBar()->UpdatePageActions();
4268 4268
4269 // Close any tabs from the unloaded extension. 4269 // Close any tabs from the unloaded extension.
4270 const Extension* extension = 4270 const Extension* extension =
4271 content::Details<UnloadedExtensionInfo>(details)->extension; 4271 content::Details<UnloadedExtensionInfo>(details)->extension;
4272 TabStripModel* model = tab_handler_->GetTabStripModel(); 4272 TabStripModel* model = tab_handler_->GetTabStripModel();
4273 for (int i = model->count() - 1; i >= 0; --i) { 4273 for (int i = model->count() - 1; i >= 0; --i) {
4274 TabContents* tc = model->GetTabContentsAt(i)->tab_contents(); 4274 TabContents* tc = model->GetTabContentsAt(i)->tab_contents();
4275 if (tc->GetURL().SchemeIs(chrome::kExtensionScheme) && 4275 bool close_tab_contents =
4276 tc->GetURL().host() == extension->id()) { 4276 tc->GetURL().SchemeIs(chrome::kExtensionScheme) &&
4277 tc->GetURL().host() == extension->id();
4278 // We want to close all panels originated by the unloaded extension.
4279 close_tab_contents = close_tab_contents ||
4280 ((web_app::GetExtensionIdFromApplicationName(app_name_) ==
jennb 2011/10/28 21:12:27 I would reverse the check to have type_ == TYPE_PA
jennb 2011/10/28 21:12:27 Will this work correctly if there is no app name?
prasadt 2011/10/28 21:53:28 Done.
prasadt 2011/10/28 21:53:28 Yes. GetExtensionIdFromApplicationName just return
4281 extension->id()) && type_ == TYPE_PANEL);
4282 if (close_tab_contents) {
4277 CloseTabContents(tc); 4283 CloseTabContents(tc);
4278 } 4284 }
4279 } 4285 }
4280 4286
4281 break; 4287 break;
4282 } 4288 }
4283 4289
4284 case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: { 4290 case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: {
4285 Profile* profile = content::Source<Profile>(source).ptr(); 4291 Profile* profile = content::Source<Profile>(source).ptr();
4286 if (profile_->IsSameProfile(profile) && window()->GetLocationBar()) 4292 if (profile_->IsSameProfile(profile) && window()->GetLocationBar())
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after
5510 } 5516 }
5511 5517
5512 void Browser::UpdateFullscreenExitBubbleContent() { 5518 void Browser::UpdateFullscreenExitBubbleContent() {
5513 GURL url; 5519 GURL url;
5514 if (fullscreened_tab_) 5520 if (fullscreened_tab_)
5515 url = fullscreened_tab_->tab_contents()->GetURL(); 5521 url = fullscreened_tab_->tab_contents()->GetURL();
5516 5522
5517 window_->UpdateFullscreenExitBubbleContent( 5523 window_->UpdateFullscreenExitBubbleContent(
5518 url, GetFullscreenExitBubbleType()); 5524 url, GetFullscreenExitBubbleType());
5519 } 5525 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698