| 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 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1092 } | 1092 } |
| 1093 | 1093 |
| 1094 void TabStripModel::GetIndicesWithSameDomain(int index, | 1094 void TabStripModel::GetIndicesWithSameDomain(int index, |
| 1095 std::vector<int>* indices) { | 1095 std::vector<int>* indices) { |
| 1096 std::string domain = GetWebContentsAt(index)->GetURL().host(); | 1096 std::string domain = GetWebContentsAt(index)->GetURL().host(); |
| 1097 if (domain.empty()) | 1097 if (domain.empty()) |
| 1098 return; | 1098 return; |
| 1099 for (int i = 0; i < count(); ++i) { | 1099 for (int i = 0; i < count(); ++i) { |
| 1100 if (i == index) | 1100 if (i == index) |
| 1101 continue; | 1101 continue; |
| 1102 if (GetWebContentsAt(i)->GetURL().host() == domain) | 1102 if (GetWebContentsAt(i)->GetURL().host_piece() == domain) |
| 1103 indices->push_back(i); | 1103 indices->push_back(i); |
| 1104 } | 1104 } |
| 1105 } | 1105 } |
| 1106 | 1106 |
| 1107 void TabStripModel::GetIndicesWithSameOpener(int index, | 1107 void TabStripModel::GetIndicesWithSameOpener(int index, |
| 1108 std::vector<int>* indices) { | 1108 std::vector<int>* indices) { |
| 1109 WebContents* opener = contents_data_[index]->group(); | 1109 WebContents* opener = contents_data_[index]->group(); |
| 1110 if (!opener) { | 1110 if (!opener) { |
| 1111 // If there is no group, find all tabs with the selected tab as the opener. | 1111 // If there is no group, find all tabs with the selected tab as the opener. |
| 1112 opener = GetWebContentsAt(index); | 1112 opener = GetWebContentsAt(index); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1128 std::vector<int> indices; | 1128 std::vector<int> indices; |
| 1129 indices.push_back(index); | 1129 indices.push_back(index); |
| 1130 return indices; | 1130 return indices; |
| 1131 } | 1131 } |
| 1132 return selection_model_.selected_indices(); | 1132 return selection_model_.selected_indices(); |
| 1133 } | 1133 } |
| 1134 | 1134 |
| 1135 bool TabStripModel::IsNewTabAtEndOfTabStrip(WebContents* contents) const { | 1135 bool TabStripModel::IsNewTabAtEndOfTabStrip(WebContents* contents) const { |
| 1136 const GURL& url = contents->GetURL(); | 1136 const GURL& url = contents->GetURL(); |
| 1137 return url.SchemeIs(content::kChromeUIScheme) && | 1137 return url.SchemeIs(content::kChromeUIScheme) && |
| 1138 url.host() == chrome::kChromeUINewTabHost && | 1138 url.host_piece() == chrome::kChromeUINewTabHost && |
| 1139 contents == GetWebContentsAtImpl(count() - 1) && | 1139 contents == GetWebContentsAtImpl(count() - 1) && |
| 1140 contents->GetController().GetEntryCount() == 1; | 1140 contents->GetController().GetEntryCount() == 1; |
| 1141 } | 1141 } |
| 1142 | 1142 |
| 1143 bool TabStripModel::InternalCloseTabs(const std::vector<int>& indices, | 1143 bool TabStripModel::InternalCloseTabs(const std::vector<int>& indices, |
| 1144 uint32_t close_types) { | 1144 uint32_t close_types) { |
| 1145 if (indices.empty()) | 1145 if (indices.empty()) |
| 1146 return true; | 1146 return true; |
| 1147 | 1147 |
| 1148 CloseTracker close_tracker(GetWebContentsFromIndices(indices)); | 1148 CloseTracker close_tracker(GetWebContentsFromIndices(indices)); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1362 | 1362 |
| 1363 void TabStripModel::FixOpenersAndGroupsReferencing(int index) { | 1363 void TabStripModel::FixOpenersAndGroupsReferencing(int index) { |
| 1364 WebContents* old_contents = GetWebContentsAtImpl(index); | 1364 WebContents* old_contents = GetWebContentsAtImpl(index); |
| 1365 for (auto& data : contents_data_) { | 1365 for (auto& data : contents_data_) { |
| 1366 if (data->group() == old_contents) | 1366 if (data->group() == old_contents) |
| 1367 data->set_group(contents_data_[index]->group()); | 1367 data->set_group(contents_data_[index]->group()); |
| 1368 if (data->opener() == old_contents) | 1368 if (data->opener() == old_contents) |
| 1369 data->set_opener(contents_data_[index]->opener()); | 1369 data->set_opener(contents_data_[index]->opener()); |
| 1370 } | 1370 } |
| 1371 } | 1371 } |
| OLD | NEW |