Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1013)

Side by Side Diff: chrome/browser/ui/tabs/tab_strip_model.cc

Issue 1131233004: Fixes regression when opening tabs in background with pinned tabs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change comment so dont trigger copyright check Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/tabs/tab_strip_model_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 DCHECK(opener); 599 DCHECK(opener);
600 DCHECK(ContainsIndex(start_index)); 600 DCHECK(ContainsIndex(start_index));
601 601
602 std::set<const WebContents*> opener_and_descendants; 602 std::set<const WebContents*> opener_and_descendants;
603 opener_and_descendants.insert(opener); 603 opener_and_descendants.insert(opener);
604 int last_index = kNoTab; 604 int last_index = kNoTab;
605 605
606 for (int i = start_index + 1; i < count(); ++i) { 606 for (int i = start_index + 1; i < count(); ++i) {
607 // Test opened by transitively, i.e. include tabs opened by tabs opened by 607 // Test opened by transitively, i.e. include tabs opened by tabs opened by
608 // opener, etc. Stop when we find the first non-descendant. 608 // opener, etc. Stop when we find the first non-descendant.
609 if (!opener_and_descendants.count(contents_data_[i]->opener())) 609 if (!opener_and_descendants.count(contents_data_[i]->opener())) {
610 // Skip over pinned tabs as new tabs are added after pinned tabs.
611 if (contents_data_[i]->pinned())
612 continue;
610 break; 613 break;
614 }
611 opener_and_descendants.insert(contents_data_[i]->web_contents()); 615 opener_and_descendants.insert(contents_data_[i]->web_contents());
612 last_index = i; 616 last_index = i;
613 } 617 }
614 return last_index; 618 return last_index;
615 } 619 }
616 620
617 void TabStripModel::TabNavigating(WebContents* contents, 621 void TabStripModel::TabNavigating(WebContents* contents,
618 ui::PageTransition transition) { 622 ui::PageTransition transition) {
619 if (ShouldForgetOpenersForTransition(transition)) { 623 if (ShouldForgetOpenersForTransition(transition)) {
620 // Don't forget the openers if this tab is a New Tab page opened at the 624 // Don't forget the openers if this tab is a New Tab page opened at the
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 1442
1439 void TabStripModel::FixOpenersAndGroupsReferencing(int index) { 1443 void TabStripModel::FixOpenersAndGroupsReferencing(int index) {
1440 WebContents* old_contents = GetWebContentsAtImpl(index); 1444 WebContents* old_contents = GetWebContentsAtImpl(index);
1441 for (WebContentsData* data : contents_data_) { 1445 for (WebContentsData* data : contents_data_) {
1442 if (data->group() == old_contents) 1446 if (data->group() == old_contents)
1443 data->set_group(contents_data_[index]->group()); 1447 data->set_group(contents_data_[index]->group());
1444 if (data->opener() == old_contents) 1448 if (data->opener() == old_contents)
1445 data->set_opener(contents_data_[index]->opener()); 1449 data->set_opener(contents_data_[index]->opener());
1446 } 1450 }
1447 } 1451 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/tabs/tab_strip_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698