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

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

Issue 11365201: Remove TabContents from TabStripModelObserver::TabMoved. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: linux oops 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 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 WebContentsData* moved_data = contents_data_[index]; 1242 WebContentsData* moved_data = contents_data_[index];
1243 contents_data_.erase(contents_data_.begin() + index); 1243 contents_data_.erase(contents_data_.begin() + index);
1244 contents_data_.insert(contents_data_.begin() + to_position, moved_data); 1244 contents_data_.insert(contents_data_.begin() + to_position, moved_data);
1245 1245
1246 selection_model_.Move(index, to_position); 1246 selection_model_.Move(index, to_position);
1247 if (!selection_model_.IsSelected(select_after_move) && select_after_move) { 1247 if (!selection_model_.IsSelected(select_after_move) && select_after_move) {
1248 // TODO(sky): why doesn't this code notify observers? 1248 // TODO(sky): why doesn't this code notify observers?
1249 selection_model_.SetSelectedIndex(to_position); 1249 selection_model_.SetSelectedIndex(to_position);
1250 } 1250 }
1251 1251
1252 TabContents* tab_contents =
1253 TabContents::FromWebContents(moved_data->contents);
1254 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, 1252 FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
1255 TabMoved(tab_contents, index, to_position)); 1253 TabMoved(moved_data->contents, index, to_position));
1256 } 1254 }
1257 1255
1258 void TabStripModel::MoveSelectedTabsToImpl(int index, 1256 void TabStripModel::MoveSelectedTabsToImpl(int index,
1259 size_t start, 1257 size_t start,
1260 size_t length) { 1258 size_t length) {
1261 DCHECK(start < selection_model_.selected_indices().size() && 1259 DCHECK(start < selection_model_.selected_indices().size() &&
1262 start + length <= selection_model_.selected_indices().size()); 1260 start + length <= selection_model_.selected_indices().size());
1263 size_t end = start + length; 1261 size_t end = start + length;
1264 int count_before_index = 0; 1262 int count_before_index = 0;
1265 for (size_t i = start; i < end && 1263 for (size_t i = start; i < end &&
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 void TabStripModel::ForgetOpenersAndGroupsReferencing( 1299 void TabStripModel::ForgetOpenersAndGroupsReferencing(
1302 const WebContents* tab) { 1300 const WebContents* tab) {
1303 for (WebContentsDataVector::const_iterator i = contents_data_.begin(); 1301 for (WebContentsDataVector::const_iterator i = contents_data_.begin();
1304 i != contents_data_.end(); ++i) { 1302 i != contents_data_.end(); ++i) {
1305 if ((*i)->group == tab) 1303 if ((*i)->group == tab)
1306 (*i)->group = NULL; 1304 (*i)->group = NULL;
1307 if ((*i)->opener == tab) 1305 if ((*i)->opener == tab)
1308 (*i)->opener = NULL; 1306 (*i)->opener = NULL;
1309 } 1307 }
1310 } 1308 }
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