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 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 int index, | 169 int index, |
170 TabContentsWrapper* new_contents) { | 170 TabContentsWrapper* new_contents) { |
171 // TODO: this should reset group/opener of any tabs that point at | 171 // TODO: this should reset group/opener of any tabs that point at |
172 // old_contents. | 172 // old_contents. |
173 DCHECK(ContainsIndex(index)); | 173 DCHECK(ContainsIndex(index)); |
174 TabContentsWrapper* old_contents = GetContentsAt(index); | 174 TabContentsWrapper* old_contents = GetContentsAt(index); |
175 | 175 |
176 contents_data_[index]->contents = new_contents; | 176 contents_data_[index]->contents = new_contents; |
177 | 177 |
178 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, | 178 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, |
179 TabReplacedAt(old_contents, new_contents, index)); | 179 TabReplacedAt(this, old_contents, new_contents, index)); |
180 | 180 |
181 // When the selected tab contents is replaced send out selected notification | 181 // When the selected tab contents is replaced send out selected notification |
182 // too. We do this as nearly all observers need to treat a replace of the | 182 // too. We do this as nearly all observers need to treat a replace of the |
183 // selected contents as selection changing. | 183 // selected contents as selection changing. |
184 if (selected_index_ == index) { | 184 if (selected_index_ == index) { |
185 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, | 185 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, |
186 TabSelectedAt(old_contents, new_contents, | 186 TabSelectedAt(old_contents, new_contents, |
187 selected_index_, false)); | 187 selected_index_, false)); |
188 } | 188 } |
189 return old_contents; | 189 return old_contents; |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, | 1004 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, |
1005 TabMoved(moved_data->contents, index, to_position)); | 1005 TabMoved(moved_data->contents, index, to_position)); |
1006 } | 1006 } |
1007 | 1007 |
1008 // static | 1008 // static |
1009 bool TabStripModel::OpenerMatches(const TabContentsData* data, | 1009 bool TabStripModel::OpenerMatches(const TabContentsData* data, |
1010 const NavigationController* opener, | 1010 const NavigationController* opener, |
1011 bool use_group) { | 1011 bool use_group) { |
1012 return data->opener == opener || (use_group && data->group == opener); | 1012 return data->opener == opener || (use_group && data->group == opener); |
1013 } | 1013 } |
OLD | NEW |