| OLD | NEW |
| 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 <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 | 268 |
| 269 // TabStripModelObserver implementation: | 269 // TabStripModelObserver implementation: |
| 270 virtual void TabInsertedAt(WebContents* contents, | 270 virtual void TabInsertedAt(WebContents* contents, |
| 271 int index, | 271 int index, |
| 272 bool foreground) OVERRIDE { | 272 bool foreground) OVERRIDE { |
| 273 empty_ = false; | 273 empty_ = false; |
| 274 State s(contents, index, INSERT); | 274 State s(contents, index, INSERT); |
| 275 s.foreground = foreground; | 275 s.foreground = foreground; |
| 276 states_.push_back(s); | 276 states_.push_back(s); |
| 277 } | 277 } |
| 278 virtual void ActiveTabChanged(TabContents* old_contents, | 278 virtual void ActiveTabChanged(WebContents* old_contents, |
| 279 TabContents* new_contents, | 279 WebContents* new_contents, |
| 280 int index, | 280 int index, |
| 281 bool user_gesture) OVERRIDE { | 281 bool user_gesture) OVERRIDE { |
| 282 State s( | 282 State s(new_contents, index, ACTIVATE); |
| 283 new_contents ? new_contents->web_contents() : NULL, index, ACTIVATE); | 283 s.src_contents = old_contents; |
| 284 s.src_contents = old_contents ? old_contents->web_contents() : NULL; | |
| 285 s.user_gesture = user_gesture; | 284 s.user_gesture = user_gesture; |
| 286 states_.push_back(s); | 285 states_.push_back(s); |
| 287 } | 286 } |
| 288 virtual void TabSelectionChanged( | 287 virtual void TabSelectionChanged( |
| 289 TabStripModel* tab_strip_model, | 288 TabStripModel* tab_strip_model, |
| 290 const TabStripSelectionModel& old_model) OVERRIDE { | 289 const TabStripSelectionModel& old_model) OVERRIDE { |
| 291 State s(model()->GetActiveWebContents(), model()->active_index(), SELECT); | 290 State s(model()->GetActiveWebContents(), model()->active_index(), SELECT); |
| 292 s.src_contents = model()->GetWebContentsAt(old_model.active()); | 291 s.src_contents = model()->GetWebContentsAt(old_model.active()); |
| 293 s.src_index = old_model.active(); | 292 s.src_index = old_model.active(); |
| 294 states_.push_back(s); | 293 states_.push_back(s); |
| (...skipping 2114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2409 strip.ActivateTabAt(1, true); | 2408 strip.ActivateTabAt(1, true); |
| 2410 ASSERT_EQ(1, observer.GetStateCount()); | 2409 ASSERT_EQ(1, observer.GetStateCount()); |
| 2411 State s(contents2, 1, MockTabStripModelObserver::SELECT); | 2410 State s(contents2, 1, MockTabStripModelObserver::SELECT); |
| 2412 s.src_contents = contents2; | 2411 s.src_contents = contents2; |
| 2413 s.src_index = 1; | 2412 s.src_index = 1; |
| 2414 s.user_gesture = false; | 2413 s.user_gesture = false; |
| 2415 EXPECT_TRUE(observer.StateEquals(0, s)); | 2414 EXPECT_TRUE(observer.StateEquals(0, s)); |
| 2416 strip.RemoveObserver(&observer); | 2415 strip.RemoveObserver(&observer); |
| 2417 strip.CloseAllTabs(); | 2416 strip.CloseAllTabs(); |
| 2418 } | 2417 } |
| OLD | NEW |