| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "ash/common/wm/window_state.h" | 7 #include "ash/common/wm/window_state.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/sticky_keys/sticky_keys_controller.h" | 9 #include "ash/sticky_keys/sticky_keys_controller.h" |
| 10 #include "ash/sticky_keys/sticky_keys_overlay.h" | 10 #include "ash/sticky_keys/sticky_keys_overlay.h" |
| (...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1876 public: | 1876 public: |
| 1877 EventBuffer() {} | 1877 EventBuffer() {} |
| 1878 ~EventBuffer() override {} | 1878 ~EventBuffer() override {} |
| 1879 | 1879 |
| 1880 void PopEvents(std::vector<std::unique_ptr<ui::Event>>* events) { | 1880 void PopEvents(std::vector<std::unique_ptr<ui::Event>>* events) { |
| 1881 events->clear(); | 1881 events->clear(); |
| 1882 events->swap(events_); | 1882 events->swap(events_); |
| 1883 } | 1883 } |
| 1884 | 1884 |
| 1885 private: | 1885 private: |
| 1886 // ui::EventProcessor overrides: | 1886 // ui::EventSink overrides: |
| 1887 ui::EventDispatchDetails OnEventFromSource(ui::Event* event) override { | 1887 ui::EventDispatchDetails OnEventFromSource(ui::Event* event) override { |
| 1888 events_.push_back(ui::Event::Clone(*event)); | 1888 events_.push_back(ui::Event::Clone(*event)); |
| 1889 return ui::EventDispatchDetails(); | 1889 return ui::EventDispatchDetails(); |
| 1890 } | 1890 } |
| 1891 | 1891 |
| 1892 std::vector<std::unique_ptr<ui::Event>> events_; | 1892 std::vector<std::unique_ptr<ui::Event>> events_; |
| 1893 | 1893 |
| 1894 DISALLOW_COPY_AND_ASSIGN(EventBuffer); | 1894 DISALLOW_COPY_AND_ASSIGN(EventBuffer); |
| 1895 }; | 1895 }; |
| 1896 | 1896 |
| 1897 // Trivial EventSource that does nothing but send events. | 1897 // Trivial EventSource that does nothing but send events. |
| 1898 class TestEventSource : public ui::EventSource { | 1898 class TestEventSource : public ui::EventSource { |
| 1899 public: | 1899 public: |
| 1900 explicit TestEventSource(ui::EventProcessor* processor) | 1900 explicit TestEventSource(ui::EventProcessor* processor) |
| 1901 : processor_(processor) {} | 1901 : processor_(processor) {} |
| 1902 ui::EventProcessor* GetEventProcessor() override { return processor_; } | 1902 ui::EventSink* GetEventSink() override { return processor_; } |
| 1903 ui::EventDispatchDetails Send(ui::Event* event) { | 1903 ui::EventDispatchDetails Send(ui::Event* event) { |
| 1904 return SendEventToProcessor(event); | 1904 return SendEventToSink(event); |
| 1905 } | 1905 } |
| 1906 | 1906 |
| 1907 private: | 1907 private: |
| 1908 ui::EventProcessor* processor_; | 1908 ui::EventProcessor* processor_; |
| 1909 }; | 1909 }; |
| 1910 | 1910 |
| 1911 // Tests of event rewriting that depend on the Ash window manager. | 1911 // Tests of event rewriting that depend on the Ash window manager. |
| 1912 class EventRewriterAshTest : public ash::test::AshTestBase { | 1912 class EventRewriterAshTest : public ash::test::AshTestBase { |
| 1913 public: | 1913 public: |
| 1914 EventRewriterAshTest() | 1914 EventRewriterAshTest() |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2599 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN)); | 2599 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN)); |
| 2600 EXPECT_TRUE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN)); | 2600 EXPECT_TRUE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN)); |
| 2601 | 2601 |
| 2602 // Turn off AltGr and Mod3. | 2602 // Turn off AltGr and Mod3. |
| 2603 sticky_keys_controller_->SetModifiersEnabled(false, false); | 2603 sticky_keys_controller_->SetModifiersEnabled(false, false); |
| 2604 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN)); | 2604 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN)); |
| 2605 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN)); | 2605 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN)); |
| 2606 } | 2606 } |
| 2607 | 2607 |
| 2608 } // namespace chromeos | 2608 } // namespace chromeos |
| OLD | NEW |