OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/tabs/tab_strip_model.h" | 5 #include "chrome/browser/tabs/tab_strip_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 int index = GetWrapperIndex(Source<TabContents>(source).ptr()); | 771 int index = GetWrapperIndex(Source<TabContents>(source).ptr()); |
772 if (index != TabStripModel::kNoTab) { | 772 if (index != TabStripModel::kNoTab) { |
773 // Note that we only detach the contents here, not close it - it's | 773 // Note that we only detach the contents here, not close it - it's |
774 // already been closed. We just want to undo our bookkeeping. | 774 // already been closed. We just want to undo our bookkeeping. |
775 DetachTabContentsAt(index); | 775 DetachTabContentsAt(index); |
776 } | 776 } |
777 break; | 777 break; |
778 } | 778 } |
779 | 779 |
780 case NotificationType::EXTENSION_UNLOADED: { | 780 case NotificationType::EXTENSION_UNLOADED: { |
781 const Extension* extension = Details<const Extension>(details).ptr(); | 781 const Extension* extension = |
| 782 Details<UnloadedExtensionInfo>(details)->extension; |
782 // Iterate backwards as we may remove items while iterating. | 783 // Iterate backwards as we may remove items while iterating. |
783 for (int i = count() - 1; i >= 0; i--) { | 784 for (int i = count() - 1; i >= 0; i--) { |
784 TabContentsWrapper* contents = GetTabContentsAt(i); | 785 TabContentsWrapper* contents = GetTabContentsAt(i); |
785 if (contents->extension_app() == extension) { | 786 if (contents->extension_app() == extension) { |
786 // The extension an app tab was created from has been nuked. Delete | 787 // The extension an app tab was created from has been nuked. Delete |
787 // the TabContents. Deleting a TabContents results in a notification | 788 // the TabContents. Deleting a TabContents results in a notification |
788 // of type TAB_CONTENTS_DESTROYED; we do the necessary cleanup in | 789 // of type TAB_CONTENTS_DESTROYED; we do the necessary cleanup in |
789 // handling that notification. | 790 // handling that notification. |
790 | 791 |
791 InternalCloseTab(contents, i, false); | 792 InternalCloseTab(contents, i, false); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, | 1004 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, |
1004 TabMoved(moved_data->contents, index, to_position)); | 1005 TabMoved(moved_data->contents, index, to_position)); |
1005 } | 1006 } |
1006 | 1007 |
1007 // static | 1008 // static |
1008 bool TabStripModel::OpenerMatches(const TabContentsData* data, | 1009 bool TabStripModel::OpenerMatches(const TabContentsData* data, |
1009 const NavigationController* opener, | 1010 const NavigationController* opener, |
1010 bool use_group) { | 1011 bool use_group) { |
1011 return data->opener == opener || (use_group && data->group == opener); | 1012 return data->opener == opener || (use_group && data->group == opener); |
1012 } | 1013 } |
OLD | NEW |