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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 if (index == target_index_) | 206 if (index == target_index_) |
207 quit_closure_.Run(); | 207 quit_closure_.Run(); |
208 } | 208 } |
209 | 209 |
210 // History of tab activation. Scrub() resets it. | 210 // History of tab activation. Scrub() resets it. |
211 std::vector<int> activation_order_; | 211 std::vector<int> activation_order_; |
212 | 212 |
213 private: | 213 private: |
214 void RunUntilTabActive(Browser* browser, int target) { | 214 void RunUntilTabActive(Browser* browser, int target) { |
215 base::RunLoop run_loop; | 215 base::RunLoop run_loop; |
216 quit_closure_ = content::GetQuitTaskForRunLoop(&run_loop); | 216 quit_closure_ = content::GetDeferredQuitTaskForRunLoop(&run_loop); |
217 browser->tab_strip_model()->AddObserver(this); | 217 browser->tab_strip_model()->AddObserver(this); |
218 target_index_ = target; | 218 target_index_ = target; |
219 content::RunThisRunLoop(&run_loop); | 219 content::RunThisRunLoop(&run_loop); |
220 browser->tab_strip_model()->RemoveObserver(this); | 220 browser->tab_strip_model()->RemoveObserver(this); |
221 target_index_ = -1; | 221 target_index_ = -1; |
222 } | 222 } |
223 | 223 |
224 base::Closure quit_closure_; | 224 base::Closure quit_closure_; |
225 int target_index_; | 225 int target_index_; |
226 | 226 |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 | 468 |
469 SendScrubEvent(browser(), 1); | 469 SendScrubEvent(browser(), 1); |
470 EXPECT_TRUE(TabScrubber::GetInstance()->IsActivationPending()); | 470 EXPECT_TRUE(TabScrubber::GetInstance()->IsActivationPending()); |
471 browser()->tab_strip_model()->ToggleSelectionAt(0); | 471 browser()->tab_strip_model()->ToggleSelectionAt(0); |
472 browser()->tab_strip_model()->ToggleSelectionAt(2); | 472 browser()->tab_strip_model()->ToggleSelectionAt(2); |
473 browser()->tab_strip_model()->MoveSelectedTabsTo(2); | 473 browser()->tab_strip_model()->MoveSelectedTabsTo(2); |
474 EXPECT_EQ(0, TabScrubber::GetInstance()->highlighted_tab()); | 474 EXPECT_EQ(0, TabScrubber::GetInstance()->highlighted_tab()); |
475 } | 475 } |
476 | 476 |
477 #endif // defined(OS_CHROMEOS) | 477 #endif // defined(OS_CHROMEOS) |
OLD | NEW |