| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 const web_modal::WebContentsModalDialogManager* manager = | 313 const web_modal::WebContentsModalDialogManager* manager = |
| 314 web_modal::WebContentsModalDialogManager::FromWebContents(contents); | 314 web_modal::WebContentsModalDialogManager::FromWebContents(contents); |
| 315 if (manager) | 315 if (manager) |
| 316 data->set_blocked(manager->IsDialogActive()); | 316 data->set_blocked(manager->IsDialogActive()); |
| 317 | 317 |
| 318 contents_data_.insert(contents_data_.begin() + index, data); | 318 contents_data_.insert(contents_data_.begin() + index, data); |
| 319 | 319 |
| 320 selection_model_.IncrementFrom(index); | 320 selection_model_.IncrementFrom(index); |
| 321 | 321 |
| 322 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, | 322 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, |
| 323 TabInsertedAt(contents, index, active)); | 323 TabInsertedAt(this, contents, index, active)); |
| 324 if (active) { | 324 if (active) { |
| 325 ui::ListSelectionModel new_model; | 325 ui::ListSelectionModel new_model; |
| 326 new_model.Copy(selection_model_); | 326 new_model.Copy(selection_model_); |
| 327 new_model.SetSelectedIndex(index); | 327 new_model.SetSelectedIndex(index); |
| 328 SetSelection(new_model, NOTIFY_DEFAULT); | 328 SetSelection(new_model, NOTIFY_DEFAULT); |
| 329 } | 329 } |
| 330 } | 330 } |
| 331 | 331 |
| 332 WebContents* TabStripModel::ReplaceWebContentsAt(int index, | 332 WebContents* TabStripModel::ReplaceWebContentsAt(int index, |
| 333 WebContents* new_contents) { | 333 WebContents* new_contents) { |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 contents_data_[index]->set_pinned(pinned); | 651 contents_data_[index]->set_pinned(pinned); |
| 652 if (pinned && index != non_pinned_tab_index) { | 652 if (pinned && index != non_pinned_tab_index) { |
| 653 MoveWebContentsAtImpl(index, non_pinned_tab_index, false); | 653 MoveWebContentsAtImpl(index, non_pinned_tab_index, false); |
| 654 index = non_pinned_tab_index; | 654 index = non_pinned_tab_index; |
| 655 } else if (!pinned && index + 1 != non_pinned_tab_index) { | 655 } else if (!pinned && index + 1 != non_pinned_tab_index) { |
| 656 MoveWebContentsAtImpl(index, non_pinned_tab_index - 1, false); | 656 MoveWebContentsAtImpl(index, non_pinned_tab_index - 1, false); |
| 657 index = non_pinned_tab_index - 1; | 657 index = non_pinned_tab_index - 1; |
| 658 } | 658 } |
| 659 | 659 |
| 660 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, | 660 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, |
| 661 TabPinnedStateChanged(contents_data_[index]->web_contents(), | 661 TabPinnedStateChanged( |
| 662 index)); | 662 this, contents_data_[index]->web_contents(), index)); |
| 663 } | 663 } |
| 664 | 664 |
| 665 bool TabStripModel::IsTabPinned(int index) const { | 665 bool TabStripModel::IsTabPinned(int index) const { |
| 666 DCHECK(ContainsIndex(index)); | 666 DCHECK(ContainsIndex(index)); |
| 667 return contents_data_[index]->pinned(); | 667 return contents_data_[index]->pinned(); |
| 668 } | 668 } |
| 669 | 669 |
| 670 bool TabStripModel::IsTabBlocked(int index) const { | 670 bool TabStripModel::IsTabBlocked(int index) const { |
| 671 return contents_data_[index]->blocked(); | 671 return contents_data_[index]->blocked(); |
| 672 } | 672 } |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 | 1365 |
| 1366 void TabStripModel::FixOpenersAndGroupsReferencing(int index) { | 1366 void TabStripModel::FixOpenersAndGroupsReferencing(int index) { |
| 1367 WebContents* old_contents = GetWebContentsAtImpl(index); | 1367 WebContents* old_contents = GetWebContentsAtImpl(index); |
| 1368 for (WebContentsData* data : contents_data_) { | 1368 for (WebContentsData* data : contents_data_) { |
| 1369 if (data->group() == old_contents) | 1369 if (data->group() == old_contents) |
| 1370 data->set_group(contents_data_[index]->group()); | 1370 data->set_group(contents_data_[index]->group()); |
| 1371 if (data->opener() == old_contents) | 1371 if (data->opener() == old_contents) |
| 1372 data->set_opener(contents_data_[index]->opener()); | 1372 data->set_opener(contents_data_[index]->opener()); |
| 1373 } | 1373 } |
| 1374 } | 1374 } |
| OLD | NEW |