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 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // occurs between the call to add an additional tab and one to close | 199 // occurs between the call to add an additional tab and one to close |
200 // the previous tab. | 200 // the previous tab. |
201 InsertTabContentsAt(index + 1, contents, ADD_ACTIVE | ADD_INHERIT_GROUP); | 201 InsertTabContentsAt(index + 1, contents, ADD_ACTIVE | ADD_INHERIT_GROUP); |
202 std::vector<int> closing_tabs; | 202 std::vector<int> closing_tabs; |
203 closing_tabs.push_back(index); | 203 closing_tabs.push_back(index); |
204 InternalCloseTabs(closing_tabs, CLOSE_NONE); | 204 InternalCloseTabs(closing_tabs, CLOSE_NONE); |
205 } | 205 } |
206 | 206 |
207 TabContents* TabStripModel::DiscardTabContentsAt(int index) { | 207 TabContents* TabStripModel::DiscardTabContentsAt(int index) { |
208 DCHECK(ContainsIndex(index)); | 208 DCHECK(ContainsIndex(index)); |
209 TabContents* null_contents = new TabContents( | 209 TabContents* null_contents = TabContents::Factory::CreateTabContents( |
210 WebContents::Create(profile(), | 210 WebContents::Create(profile(), |
211 NULL /* site_instance */, | 211 NULL /* site_instance */, |
212 MSG_ROUTING_NONE, | 212 MSG_ROUTING_NONE, |
213 NULL /* base_tab_contents */)); | 213 NULL /* base_tab_contents */)); |
214 TabContents* old_contents = GetContentsAt(index); | 214 TabContents* old_contents = GetContentsAt(index); |
215 // Copy over the state from the navigation controller so we preserve the | 215 // Copy over the state from the navigation controller so we preserve the |
216 // back/forward history and continue to display the correct title/favicon. | 216 // back/forward history and continue to display the correct title/favicon. |
217 null_contents->web_contents()->GetController().CopyStateFrom( | 217 null_contents->web_contents()->GetController().CopyStateFrom( |
218 old_contents->web_contents()->GetController()); | 218 old_contents->web_contents()->GetController()); |
219 // Replace the tab we're discarding with the null version. | 219 // Replace the tab we're discarding with the null version. |
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 void TabStripModel::ForgetOpenersAndGroupsReferencing( | 1326 void TabStripModel::ForgetOpenersAndGroupsReferencing( |
1327 const NavigationController* tab) { | 1327 const NavigationController* tab) { |
1328 for (TabContentsDataVector::const_iterator i = contents_data_.begin(); | 1328 for (TabContentsDataVector::const_iterator i = contents_data_.begin(); |
1329 i != contents_data_.end(); ++i) { | 1329 i != contents_data_.end(); ++i) { |
1330 if ((*i)->group == tab) | 1330 if ((*i)->group == tab) |
1331 (*i)->group = NULL; | 1331 (*i)->group = NULL; |
1332 if ((*i)->opener == tab) | 1332 if ((*i)->opener == tab) |
1333 (*i)->opener = NULL; | 1333 (*i)->opener = NULL; |
1334 } | 1334 } |
1335 } | 1335 } |
OLD | NEW |