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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 WebContents* new_contents) { | 335 WebContents* new_contents) { |
336 delegate_->WillAddWebContents(new_contents); | 336 delegate_->WillAddWebContents(new_contents); |
337 | 337 |
338 DCHECK(ContainsIndex(index)); | 338 DCHECK(ContainsIndex(index)); |
339 WebContents* old_contents = GetWebContentsAtImpl(index); | 339 WebContents* old_contents = GetWebContentsAtImpl(index); |
340 | 340 |
341 FixOpenersAndGroupsReferencing(index); | 341 FixOpenersAndGroupsReferencing(index); |
342 | 342 |
343 contents_data_[index]->SetWebContents(new_contents); | 343 contents_data_[index]->SetWebContents(new_contents); |
344 | 344 |
345 old_contents->OnReplaced(new_contents); | |
wjmaclean
2017/01/19 21:09:05
Can we perhaps re-name this to something like Clon
Kevin McNee
2017/01/25 23:42:56
Done.
The zoom controller is now notified directl
| |
346 | |
345 for (auto& observer : observers_) | 347 for (auto& observer : observers_) |
346 observer.TabReplacedAt(this, old_contents, new_contents, index); | 348 observer.TabReplacedAt(this, old_contents, new_contents, index); |
347 | 349 |
348 // When the active WebContents is replaced send out a selection notification | 350 // When the active WebContents is replaced send out a selection notification |
349 // too. We do this as nearly all observers need to treat a replacement of the | 351 // too. We do this as nearly all observers need to treat a replacement of the |
350 // selected contents as the selection changing. | 352 // selected contents as the selection changing. |
351 if (active_index() == index) { | 353 if (active_index() == index) { |
352 for (auto& observer : observers_) | 354 for (auto& observer : observers_) |
353 observer.ActiveTabChanged(old_contents, new_contents, active_index(), | 355 observer.ActiveTabChanged(old_contents, new_contents, active_index(), |
354 TabStripModelObserver::CHANGE_REASON_REPLACED); | 356 TabStripModelObserver::CHANGE_REASON_REPLACED); |
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1362 | 1364 |
1363 void TabStripModel::FixOpenersAndGroupsReferencing(int index) { | 1365 void TabStripModel::FixOpenersAndGroupsReferencing(int index) { |
1364 WebContents* old_contents = GetWebContentsAtImpl(index); | 1366 WebContents* old_contents = GetWebContentsAtImpl(index); |
1365 for (auto& data : contents_data_) { | 1367 for (auto& data : contents_data_) { |
1366 if (data->group() == old_contents) | 1368 if (data->group() == old_contents) |
1367 data->set_group(contents_data_[index]->group()); | 1369 data->set_group(contents_data_[index]->group()); |
1368 if (data->opener() == old_contents) | 1370 if (data->opener() == old_contents) |
1369 data->set_opener(contents_data_[index]->opener()); | 1371 data->set_opener(contents_data_[index]->opener()); |
1370 } | 1372 } |
1371 } | 1373 } |
OLD | NEW |