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

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

Issue 11359201: Remove TabContents from TabStripModelObserver::TabReplacedAt. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 1 month 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
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 <string> 9 #include <string>
10 10
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 TabContents* TabStripModel::ReplaceTabContentsAt(int index, 152 TabContents* TabStripModel::ReplaceTabContentsAt(int index,
153 TabContents* new_contents) { 153 TabContents* new_contents) {
154 DCHECK(ContainsIndex(index)); 154 DCHECK(ContainsIndex(index));
155 TabContents* old_contents = GetTabContentsAtImpl(index); 155 TabContents* old_contents = GetTabContentsAtImpl(index);
156 156
157 ForgetOpenersAndGroupsReferencing(old_contents->web_contents()); 157 ForgetOpenersAndGroupsReferencing(old_contents->web_contents());
158 158
159 contents_data_[index]->contents = new_contents->web_contents(); 159 contents_data_[index]->contents = new_contents->web_contents();
160 160
161 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, 161 FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
162 TabReplacedAt(this, old_contents, new_contents, index)); 162 TabReplacedAt(this,
163 old_contents->web_contents(),
164 new_contents->web_contents(),
165 index));
163 166
164 // When the active tab contents is replaced send out a selection notification 167 // When the active tab contents is replaced send out a selection notification
165 // too. We do this as nearly all observers need to treat a replacement of the 168 // too. We do this as nearly all observers need to treat a replacement of the
166 // selected contents as the selection changing. 169 // selected contents as the selection changing.
167 if (active_index() == index) { 170 if (active_index() == index) {
168 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, 171 FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
169 ActiveTabChanged(old_contents->web_contents(), 172 ActiveTabChanged(old_contents->web_contents(),
170 new_contents->web_contents(), 173 new_contents->web_contents(),
171 active_index(), false)); 174 active_index(), false));
172 } 175 }
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 void TabStripModel::ForgetOpenersAndGroupsReferencing( 1267 void TabStripModel::ForgetOpenersAndGroupsReferencing(
1265 const WebContents* tab) { 1268 const WebContents* tab) {
1266 for (WebContentsDataVector::const_iterator i = contents_data_.begin(); 1269 for (WebContentsDataVector::const_iterator i = contents_data_.begin();
1267 i != contents_data_.end(); ++i) { 1270 i != contents_data_.end(); ++i) {
1268 if ((*i)->group == tab) 1271 if ((*i)->group == tab)
1269 (*i)->group = NULL; 1272 (*i)->group = NULL;
1270 if ((*i)->opener == tab) 1273 if ((*i)->opener == tab)
1271 (*i)->opener = NULL; 1274 (*i)->opener = NULL;
1272 } 1275 }
1273 } 1276 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc ('k') | chrome/browser/ui/tabs/tab_strip_model_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698