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

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

Issue 11434091: Remove various TabContents use from TabStripModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 | « chrome/browser/ui/tabs/tab_strip_model.h ('k') | no next file » | 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) 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 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, 1132 FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
1133 ActiveTabChanged(old_contents, new_contents, 1133 ActiveTabChanged(old_contents, new_contents,
1134 active_index(), 1134 active_index(),
1135 notify_types == NOTIFY_USER_GESTURE)); 1135 notify_types == NOTIFY_USER_GESTURE));
1136 // Activating a discarded tab reloads it, so it is no longer discarded. 1136 // Activating a discarded tab reloads it, so it is no longer discarded.
1137 contents_data_[active_index()]->discarded = false; 1137 contents_data_[active_index()]->discarded = false;
1138 } 1138 }
1139 } 1139 }
1140 1140
1141 void TabStripModel::NotifyIfActiveOrSelectionChanged( 1141 void TabStripModel::NotifyIfActiveOrSelectionChanged(
1142 TabContents* old_contents, 1142 WebContents* old_contents,
1143 NotifyTypes notify_types, 1143 NotifyTypes notify_types,
1144 const TabStripSelectionModel& old_model) { 1144 const TabStripSelectionModel& old_model) {
1145 NotifyIfActiveTabChanged(old_contents ? old_contents->web_contents() : NULL, 1145 NotifyIfActiveTabChanged(old_contents, notify_types);
1146 notify_types);
1147 1146
1148 if (!selection_model().Equals(old_model)) { 1147 if (!selection_model().Equals(old_model)) {
1149 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, 1148 FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
1150 TabSelectionChanged(this, old_model)); 1149 TabSelectionChanged(this, old_model));
1151 } 1150 }
1152 } 1151 }
1153 1152
1154 void TabStripModel::SetSelection( 1153 void TabStripModel::SetSelection(
1155 const TabStripSelectionModel& new_model, 1154 const TabStripSelectionModel& new_model,
1156 NotifyTypes notify_types) { 1155 NotifyTypes notify_types) {
1157 TabContents* old_contents = GetActiveTabContents(); 1156 WebContents* old_contents = GetActiveWebContents();
1158 TabStripSelectionModel old_model; 1157 TabStripSelectionModel old_model;
1159 old_model.Copy(selection_model_); 1158 old_model.Copy(selection_model_);
1160 if (new_model.active() != selection_model_.active()) 1159 if (new_model.active() != selection_model_.active())
1161 NotifyIfTabDeactivated(old_contents ? old_contents->web_contents() : NULL); 1160 NotifyIfTabDeactivated(old_contents);
1162 selection_model_.Copy(new_model); 1161 selection_model_.Copy(new_model);
1163 NotifyIfActiveOrSelectionChanged(old_contents, notify_types, old_model); 1162 NotifyIfActiveOrSelectionChanged(old_contents, notify_types, old_model);
1164 } 1163 }
1165 1164
1166 void TabStripModel::SelectRelativeTab(bool next) { 1165 void TabStripModel::SelectRelativeTab(bool next) {
1167 // This may happen during automated testing or if a user somehow buffers 1166 // This may happen during automated testing or if a user somehow buffers
1168 // many key accelerators. 1167 // many key accelerators.
1169 if (contents_data_.empty()) 1168 if (contents_data_.empty())
1170 return; 1169 return;
1171 1170
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 void TabStripModel::ForgetOpenersAndGroupsReferencing( 1237 void TabStripModel::ForgetOpenersAndGroupsReferencing(
1239 const WebContents* tab) { 1238 const WebContents* tab) {
1240 for (WebContentsDataVector::const_iterator i = contents_data_.begin(); 1239 for (WebContentsDataVector::const_iterator i = contents_data_.begin();
1241 i != contents_data_.end(); ++i) { 1240 i != contents_data_.end(); ++i) {
1242 if ((*i)->group == tab) 1241 if ((*i)->group == tab)
1243 (*i)->group = NULL; 1242 (*i)->group = NULL;
1244 if ((*i)->opener == tab) 1243 if ((*i)->opener == tab)
1245 (*i)->opener = NULL; 1244 (*i)->opener = NULL;
1246 } 1245 }
1247 } 1246 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/tabs/tab_strip_model.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698