| 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 "ash/focus_cycler.h" | 5 #include "ash/focus_cycler.h" |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/shelf/shelf.h" | 8 #include "ash/shelf/shelf.h" |
| 9 #include "ash/shelf/shelf_widget.h" | 9 #include "ash/shelf/shelf_widget.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 class PanedWidgetDelegate : public views::WidgetDelegate { | 37 class PanedWidgetDelegate : public views::WidgetDelegate { |
| 38 public: | 38 public: |
| 39 PanedWidgetDelegate(views::Widget* widget) : widget_(widget) {} | 39 PanedWidgetDelegate(views::Widget* widget) : widget_(widget) {} |
| 40 | 40 |
| 41 void SetAccessiblePanes(const std::vector<views::View*>& panes) { | 41 void SetAccessiblePanes(const std::vector<views::View*>& panes) { |
| 42 accessible_panes_ = panes; | 42 accessible_panes_ = panes; |
| 43 } | 43 } |
| 44 | 44 |
| 45 // views::WidgetDelegate. | 45 // views::WidgetDelegate. |
| 46 virtual void GetAccessiblePanes(std::vector<views::View*>* panes) OVERRIDE { | 46 virtual void GetAccessiblePanes(std::vector<views::View*>* panes) override { |
| 47 std::copy(accessible_panes_.begin(), | 47 std::copy(accessible_panes_.begin(), |
| 48 accessible_panes_.end(), | 48 accessible_panes_.end(), |
| 49 std::back_inserter(*panes)); | 49 std::back_inserter(*panes)); |
| 50 } | 50 } |
| 51 virtual views::Widget* GetWidget() OVERRIDE { | 51 virtual views::Widget* GetWidget() override { |
| 52 return widget_; | 52 return widget_; |
| 53 }; | 53 }; |
| 54 virtual const views::Widget* GetWidget() const OVERRIDE { | 54 virtual const views::Widget* GetWidget() const override { |
| 55 return widget_; | 55 return widget_; |
| 56 } | 56 } |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 views::Widget* widget_; | 59 views::Widget* widget_; |
| 60 std::vector<views::View*> accessible_panes_; | 60 std::vector<views::View*> accessible_panes_; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 } // namespace | 63 } // namespace |
| 64 | 64 |
| 65 class FocusCyclerTest : public AshTestBase { | 65 class FocusCyclerTest : public AshTestBase { |
| 66 public: | 66 public: |
| 67 FocusCyclerTest() {} | 67 FocusCyclerTest() {} |
| 68 | 68 |
| 69 virtual void SetUp() OVERRIDE { | 69 virtual void SetUp() override { |
| 70 AshTestBase::SetUp(); | 70 AshTestBase::SetUp(); |
| 71 | 71 |
| 72 focus_cycler_.reset(new FocusCycler()); | 72 focus_cycler_.reset(new FocusCycler()); |
| 73 | 73 |
| 74 ASSERT_TRUE(Shelf::ForPrimaryDisplay()); | 74 ASSERT_TRUE(Shelf::ForPrimaryDisplay()); |
| 75 } | 75 } |
| 76 | 76 |
| 77 virtual void TearDown() OVERRIDE { | 77 virtual void TearDown() override { |
| 78 if (tray_) { | 78 if (tray_) { |
| 79 GetStatusAreaWidgetDelegate(tray_->GetWidget())-> | 79 GetStatusAreaWidgetDelegate(tray_->GetWidget())-> |
| 80 SetFocusCyclerForTesting(NULL); | 80 SetFocusCyclerForTesting(NULL); |
| 81 tray_.reset(); | 81 tray_.reset(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 shelf_widget()->SetFocusCycler(NULL); | 84 shelf_widget()->SetFocusCycler(NULL); |
| 85 | 85 |
| 86 focus_cycler_.reset(); | 86 focus_cycler_.reset(); |
| 87 | 87 |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 // should do the same thing. | 398 // should do the same thing. |
| 399 focus_cycler()->RotateFocus(FocusCycler::BACKWARD); | 399 focus_cycler()->RotateFocus(FocusCycler::BACKWARD); |
| 400 EXPECT_TRUE(shelf_widget()->IsActive()); | 400 EXPECT_TRUE(shelf_widget()->IsActive()); |
| 401 event_generator.PressKey(ui::VKEY_ESCAPE, 0); | 401 event_generator.PressKey(ui::VKEY_ESCAPE, 0); |
| 402 EXPECT_TRUE(wm::IsActiveWindow(browser_window)); | 402 EXPECT_TRUE(wm::IsActiveWindow(browser_window)); |
| 403 EXPECT_EQ(focus_manager->GetFocusedView(), view1); | 403 EXPECT_EQ(focus_manager->GetFocusedView(), view1); |
| 404 } | 404 } |
| 405 | 405 |
| 406 } // namespace test | 406 } // namespace test |
| 407 } // namespace ash | 407 } // namespace ash |
| OLD | NEW |