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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 = new TabContents( |
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 NULL /* session_storage_namespace */)); | |
215 TabContents* old_contents = GetContentsAt(index); | 214 TabContents* old_contents = GetContentsAt(index); |
216 // 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 |
217 // back/forward history and continue to display the correct title/favicon. | 216 // back/forward history and continue to display the correct title/favicon. |
218 null_contents->web_contents()->GetController().CopyStateFrom( | 217 null_contents->web_contents()->GetController().CopyStateFrom( |
219 old_contents->web_contents()->GetController()); | 218 old_contents->web_contents()->GetController()); |
220 // Replace the tab we're discarding with the null version. | 219 // Replace the tab we're discarding with the null version. |
221 ReplaceTabContentsAt(index, null_contents); | 220 ReplaceTabContentsAt(index, null_contents); |
222 // Mark the tab so it will reload when we click. | 221 // Mark the tab so it will reload when we click. |
223 contents_data_[index]->discarded = true; | 222 contents_data_[index]->discarded = true; |
224 // Discard the old tab's renderer. | 223 // Discard the old tab's renderer. |
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1327 void TabStripModel::ForgetOpenersAndGroupsReferencing( | 1326 void TabStripModel::ForgetOpenersAndGroupsReferencing( |
1328 const NavigationController* tab) { | 1327 const NavigationController* tab) { |
1329 for (TabContentsDataVector::const_iterator i = contents_data_.begin(); | 1328 for (TabContentsDataVector::const_iterator i = contents_data_.begin(); |
1330 i != contents_data_.end(); ++i) { | 1329 i != contents_data_.end(); ++i) { |
1331 if ((*i)->group == tab) | 1330 if ((*i)->group == tab) |
1332 (*i)->group = NULL; | 1331 (*i)->group = NULL; |
1333 if ((*i)->opener == tab) | 1332 if ((*i)->opener == tab) |
1334 (*i)->opener = NULL; | 1333 (*i)->opener = NULL; |
1335 } | 1334 } |
1336 } | 1335 } |
OLD | NEW |