OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 InternalCloseTabs(closing_tabs, CLOSE_NONE); | 202 InternalCloseTabs(closing_tabs, CLOSE_NONE); |
203 } | 203 } |
204 | 204 |
205 TabContentsWrapper* TabStripModel::DetachTabContentsAt(int index) { | 205 TabContentsWrapper* TabStripModel::DetachTabContentsAt(int index) { |
206 if (contents_data_.empty()) | 206 if (contents_data_.empty()) |
207 return NULL; | 207 return NULL; |
208 | 208 |
209 DCHECK(ContainsIndex(index)); | 209 DCHECK(ContainsIndex(index)); |
210 | 210 |
211 TabContentsWrapper* removed_contents = GetContentsAt(index); | 211 TabContentsWrapper* removed_contents = GetContentsAt(index); |
212 int next_selected_index = order_controller_->DetermineNewSelectedIndex(index); | 212 // TODO(sky): nuke reason and old_data when we figure out what is causing |
| 213 // 34135. |
| 214 volatile int reason = 0; |
| 215 int next_selected_index = |
| 216 order_controller_->DetermineNewSelectedIndex(index, &reason); |
| 217 volatile TabContentsData old_data = *contents_data_.at(index); |
213 delete contents_data_.at(index); | 218 delete contents_data_.at(index); |
214 contents_data_.erase(contents_data_.begin() + index); | 219 contents_data_.erase(contents_data_.begin() + index); |
215 if (empty()) | 220 if (empty()) |
216 closing_all_ = true; | 221 closing_all_ = true; |
217 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, | 222 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, |
218 TabDetachedAt(removed_contents, index)); | 223 TabDetachedAt(removed_contents, index)); |
219 if (empty()) { | 224 if (empty()) { |
220 // TabDetachedAt() might unregister observers, so send |TabStripEmtpy()| in | 225 // TabDetachedAt() might unregister observers, so send |TabStripEmtpy()| in |
221 // a second pass. | 226 // a second pass. |
222 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, TabStripEmpty()); | 227 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, TabStripEmpty()); |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, | 1009 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, |
1005 TabMoved(moved_data->contents, index, to_position)); | 1010 TabMoved(moved_data->contents, index, to_position)); |
1006 } | 1011 } |
1007 | 1012 |
1008 // static | 1013 // static |
1009 bool TabStripModel::OpenerMatches(const TabContentsData* data, | 1014 bool TabStripModel::OpenerMatches(const TabContentsData* data, |
1010 const NavigationController* opener, | 1015 const NavigationController* opener, |
1011 bool use_group) { | 1016 bool use_group) { |
1012 return data->opener == opener || (use_group && data->group == opener); | 1017 return data->opener == opener || (use_group && data->group == opener); |
1013 } | 1018 } |
OLD | NEW |