Chromium Code Reviews| 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/views/ash/tab_scrubber.h" | 5 #include "chrome/browser/ui/views/ash/tab_scrubber.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "ash/display/event_transformation_handler.h" | 9 #include "ash/display/event_transformation_handler.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 TabStrip* tab_strip = GetTabStrip(browser); | 191 TabStrip* tab_strip = GetTabStrip(browser); |
| 192 for (int i = 0; i < num_tabs; ++i) | 192 for (int i = 0; i < num_tabs; ++i) |
| 193 AddBlankTabAndShow(browser); | 193 AddBlankTabAndShow(browser); |
| 194 ASSERT_EQ(num_tabs + 1, browser->tab_strip_model()->count()); | 194 ASSERT_EQ(num_tabs + 1, browser->tab_strip_model()->count()); |
| 195 ASSERT_EQ(num_tabs, browser->tab_strip_model()->active_index()); | 195 ASSERT_EQ(num_tabs, browser->tab_strip_model()->active_index()); |
| 196 tab_strip->StopAnimating(true); | 196 tab_strip->StopAnimating(true); |
| 197 ASSERT_FALSE(tab_strip->IsAnimating()); | 197 ASSERT_FALSE(tab_strip->IsAnimating()); |
| 198 } | 198 } |
| 199 | 199 |
| 200 // TabStripModelObserver overrides. | 200 // TabStripModelObserver overrides. |
| 201 void TabInsertedAt(content::WebContents* contents, | |
|
Patrick Monette
2016/09/19 21:11:34
Some cleanup while I'm here. Those already have an
| |
| 202 int index, | |
| 203 bool foreground) override {} | |
| 204 void TabClosingAt(TabStripModel* tab_strip_model, | |
| 205 content::WebContents* contents, | |
| 206 int index) override {} | |
| 207 void TabDetachedAt(content::WebContents* contents, int index) override {} | |
| 208 void TabDeactivated(content::WebContents* contents) override {} | |
| 209 void ActiveTabChanged(content::WebContents* old_contents, | 201 void ActiveTabChanged(content::WebContents* old_contents, |
| 210 content::WebContents* new_contents, | 202 content::WebContents* new_contents, |
| 211 int index, | 203 int index, |
| 212 int reason) override { | 204 int reason) override { |
| 213 activation_order_.push_back(index); | 205 activation_order_.push_back(index); |
| 214 if (index == target_index_) | 206 if (index == target_index_) |
| 215 quit_closure_.Run(); | 207 quit_closure_.Run(); |
| 216 } | 208 } |
| 217 | 209 |
| 218 void TabSelectionChanged(TabStripModel* tab_strip_model, | |
| 219 const ui::ListSelectionModel& old_model) override {} | |
| 220 void TabMoved(content::WebContents* contents, | |
| 221 int from_index, | |
| 222 int to_index) override {} | |
| 223 void TabChangedAt(content::WebContents* contents, | |
| 224 int index, | |
| 225 TabChangeType change_type) override {} | |
| 226 void TabReplacedAt(TabStripModel* tab_strip_model, | |
| 227 content::WebContents* old_contents, | |
| 228 content::WebContents* new_contents, | |
| 229 int index) override {} | |
| 230 void TabPinnedStateChanged(content::WebContents* contents, | |
| 231 int index) override {} | |
| 232 void TabBlockedStateChanged(content::WebContents* contents, | |
| 233 int index) override {} | |
| 234 void TabStripEmpty() override {} | |
| 235 | |
| 236 // History of tab activation. Scrub() resets it. | 210 // History of tab activation. Scrub() resets it. |
| 237 std::vector<int> activation_order_; | 211 std::vector<int> activation_order_; |
| 238 | 212 |
| 239 private: | 213 private: |
| 240 void RunUntilTabActive(Browser* browser, int target) { | 214 void RunUntilTabActive(Browser* browser, int target) { |
| 241 base::RunLoop run_loop; | 215 base::RunLoop run_loop; |
| 242 quit_closure_ = content::GetQuitTaskForRunLoop(&run_loop); | 216 quit_closure_ = content::GetQuitTaskForRunLoop(&run_loop); |
| 243 browser->tab_strip_model()->AddObserver(this); | 217 browser->tab_strip_model()->AddObserver(this); |
| 244 target_index_ = target; | 218 target_index_ = target; |
| 245 content::RunThisRunLoop(&run_loop); | 219 content::RunThisRunLoop(&run_loop); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 494 | 468 |
| 495 SendScrubEvent(browser(), 1); | 469 SendScrubEvent(browser(), 1); |
| 496 EXPECT_TRUE(TabScrubber::GetInstance()->IsActivationPending()); | 470 EXPECT_TRUE(TabScrubber::GetInstance()->IsActivationPending()); |
| 497 browser()->tab_strip_model()->ToggleSelectionAt(0); | 471 browser()->tab_strip_model()->ToggleSelectionAt(0); |
| 498 browser()->tab_strip_model()->ToggleSelectionAt(2); | 472 browser()->tab_strip_model()->ToggleSelectionAt(2); |
| 499 browser()->tab_strip_model()->MoveSelectedTabsTo(2); | 473 browser()->tab_strip_model()->MoveSelectedTabsTo(2); |
| 500 EXPECT_EQ(0, TabScrubber::GetInstance()->highlighted_tab()); | 474 EXPECT_EQ(0, TabScrubber::GetInstance()->highlighted_tab()); |
| 501 } | 475 } |
| 502 | 476 |
| 503 #endif // defined(OS_CHROMEOS) | 477 #endif // defined(OS_CHROMEOS) |
| OLD | NEW |