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

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

Issue 7134035: Make an inserted selected tab selected before calling TabInsertedAt on observers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/tabs/basics/events.html » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/tabs/tab_strip_model.h" 5 #include "chrome/browser/tabs/tab_strip_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // Forget any existing relationships, we don't want to make things too 148 // Forget any existing relationships, we don't want to make things too
149 // confusing by having multiple groups active at the same time. 149 // confusing by having multiple groups active at the same time.
150 ForgetAllOpeners(); 150 ForgetAllOpeners();
151 } 151 }
152 data->opener = &selected_contents->controller(); 152 data->opener = &selected_contents->controller();
153 } 153 }
154 154
155 contents_data_.insert(contents_data_.begin() + index, data); 155 contents_data_.insert(contents_data_.begin() + index, data);
156 156
157 selection_model_.IncrementFrom(index); 157 selection_model_.IncrementFrom(index);
158 if (active) {
sky 2011/06/09 17:13:01 I'm nervous of the effects of doing this on the Ta
Yoyo Zhou 2011/06/09 18:08:54 It gets discarded in ExtensionBrowserEventRouter::
159 selection_model_.SetSelectedIndex(index);
160 }
158 161
159 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, 162 FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
160 TabInsertedAt(contents, index, active)); 163 TabInsertedAt(contents, index, active));
161 164
162 if (active) { 165 if (active) {
163 selection_model_.SetSelectedIndex(index);
164 NotifyTabSelectedIfChanged(selected_contents, index, false); 166 NotifyTabSelectedIfChanged(selected_contents, index, false);
165 } 167 }
166 } 168 }
167 169
168 TabContentsWrapper* TabStripModel::ReplaceTabContentsAt( 170 TabContentsWrapper* TabStripModel::ReplaceTabContentsAt(
169 int index, 171 int index,
170 TabContentsWrapper* new_contents) { 172 TabContentsWrapper* new_contents) {
171 DCHECK(ContainsIndex(index)); 173 DCHECK(ContainsIndex(index));
172 TabContentsWrapper* old_contents = GetContentsAt(index); 174 TabContentsWrapper* old_contents = GetContentsAt(index);
173 175
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 void TabStripModel::ForgetOpenersAndGroupsReferencing( 1313 void TabStripModel::ForgetOpenersAndGroupsReferencing(
1312 const NavigationController* tab) { 1314 const NavigationController* tab) {
1313 for (TabContentsDataVector::const_iterator i = contents_data_.begin(); 1315 for (TabContentsDataVector::const_iterator i = contents_data_.begin();
1314 i != contents_data_.end(); ++i) { 1316 i != contents_data_.end(); ++i) {
1315 if ((*i)->group == tab) 1317 if ((*i)->group == tab)
1316 (*i)->group = NULL; 1318 (*i)->group = NULL;
1317 if ((*i)->opener == tab) 1319 if ((*i)->opener == tab)
1318 (*i)->opener = NULL; 1320 (*i)->opener = NULL;
1319 } 1321 }
1320 } 1322 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/tabs/basics/events.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698