OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tabs/tab_strip_model.h" | 5 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 int index = GetWrapperIndex(content::Source<WebContents>(source).ptr()); | 1013 int index = GetWrapperIndex(content::Source<WebContents>(source).ptr()); |
1014 if (index != TabStripModel::kNoTab) { | 1014 if (index != TabStripModel::kNoTab) { |
1015 // Note that we only detach the contents here, not close it - it's | 1015 // Note that we only detach the contents here, not close it - it's |
1016 // already been closed. We just want to undo our bookkeeping. | 1016 // already been closed. We just want to undo our bookkeeping. |
1017 DetachTabContentsAt(index); | 1017 DetachTabContentsAt(index); |
1018 } | 1018 } |
1019 break; | 1019 break; |
1020 } | 1020 } |
1021 | 1021 |
1022 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { | 1022 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { |
1023 const Extension* extension = | 1023 const extensions::Extension* extension = |
1024 content::Details<UnloadedExtensionInfo>(details)->extension; | 1024 content::Details<extensions::UnloadedExtensionInfo>( |
| 1025 details)->extension; |
1025 // Iterate backwards as we may remove items while iterating. | 1026 // Iterate backwards as we may remove items while iterating. |
1026 for (int i = count() - 1; i >= 0; i--) { | 1027 for (int i = count() - 1; i >= 0; i--) { |
1027 TabContentsWrapper* contents = GetTabContentsAt(i); | 1028 TabContentsWrapper* contents = GetTabContentsAt(i); |
1028 if (contents->extension_tab_helper()->extension_app() == extension) { | 1029 if (contents->extension_tab_helper()->extension_app() == extension) { |
1029 // The extension an app tab was created from has been nuked. Delete | 1030 // The extension an app tab was created from has been nuked. Delete |
1030 // the WebContents. Deleting a WebContents results in a notification | 1031 // the WebContents. Deleting a WebContents results in a notification |
1031 // of type NOTIFICATION_WEB_CONTENTS_DESTROYED; we do the necessary | 1032 // of type NOTIFICATION_WEB_CONTENTS_DESTROYED; we do the necessary |
1032 // cleanup in handling that notification. | 1033 // cleanup in handling that notification. |
1033 | 1034 |
1034 InternalCloseTab(contents, i, false); | 1035 InternalCloseTab(contents, i, false); |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1344 void TabStripModel::ForgetOpenersAndGroupsReferencing( | 1345 void TabStripModel::ForgetOpenersAndGroupsReferencing( |
1345 const NavigationController* tab) { | 1346 const NavigationController* tab) { |
1346 for (TabContentsDataVector::const_iterator i = contents_data_.begin(); | 1347 for (TabContentsDataVector::const_iterator i = contents_data_.begin(); |
1347 i != contents_data_.end(); ++i) { | 1348 i != contents_data_.end(); ++i) { |
1348 if ((*i)->group == tab) | 1349 if ((*i)->group == tab) |
1349 (*i)->group = NULL; | 1350 (*i)->group = NULL; |
1350 if ((*i)->opener == tab) | 1351 if ((*i)->opener == tab) |
1351 (*i)->opener = NULL; | 1352 (*i)->opener = NULL; |
1352 } | 1353 } |
1353 } | 1354 } |
OLD | NEW |