| 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 <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1224 // database if applicable. | 1224 // database if applicable. |
| 1225 if (create_historical_tabs) | 1225 if (create_historical_tabs) |
| 1226 delegate_->CreateHistoricalTab(contents); | 1226 delegate_->CreateHistoricalTab(contents); |
| 1227 | 1227 |
| 1228 // Deleting the WebContents will call back to us via | 1228 // Deleting the WebContents will call back to us via |
| 1229 // WebContentsData::WebContentsDestroyed and detach it. | 1229 // WebContentsData::WebContentsDestroyed and detach it. |
| 1230 delete contents; | 1230 delete contents; |
| 1231 } | 1231 } |
| 1232 | 1232 |
| 1233 WebContents* TabStripModel::GetWebContentsAtImpl(int index) const { | 1233 WebContents* TabStripModel::GetWebContentsAtImpl(int index) const { |
| 1234 CHECK(ContainsIndex(index)) << | 1234 CHECK(ContainsIndex(index)); |
| 1235 "Failed to find: " << index << " in: " << count() << " entries."; | |
| 1236 return contents_data_[index]->web_contents(); | 1235 return contents_data_[index]->web_contents(); |
| 1237 } | 1236 } |
| 1238 | 1237 |
| 1239 void TabStripModel::NotifyIfTabDeactivated(WebContents* contents) { | 1238 void TabStripModel::NotifyIfTabDeactivated(WebContents* contents) { |
| 1240 if (contents) { | 1239 if (contents) { |
| 1241 for (auto& observer : observers_) | 1240 for (auto& observer : observers_) |
| 1242 observer.TabDeactivated(contents); | 1241 observer.TabDeactivated(contents); |
| 1243 } | 1242 } |
| 1244 } | 1243 } |
| 1245 | 1244 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1362 | 1361 |
| 1363 void TabStripModel::FixOpenersAndGroupsReferencing(int index) { | 1362 void TabStripModel::FixOpenersAndGroupsReferencing(int index) { |
| 1364 WebContents* old_contents = GetWebContentsAtImpl(index); | 1363 WebContents* old_contents = GetWebContentsAtImpl(index); |
| 1365 for (auto& data : contents_data_) { | 1364 for (auto& data : contents_data_) { |
| 1366 if (data->group() == old_contents) | 1365 if (data->group() == old_contents) |
| 1367 data->set_group(contents_data_[index]->group()); | 1366 data->set_group(contents_data_[index]->group()); |
| 1368 if (data->opener() == old_contents) | 1367 if (data->opener() == old_contents) |
| 1369 data->set_opener(contents_data_[index]->opener()); | 1368 data->set_opener(contents_data_[index]->opener()); |
| 1370 } | 1369 } |
| 1371 } | 1370 } |
| OLD | NEW |