| 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 "chrome/browser/chromeos/events/event_rewriter_controller.h" | 5 #include "chrome/browser/chromeos/events/event_rewriter_controller.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ui/aura/env.h" | 8 #include "ui/aura/env.h" |
| 9 #include "ui/aura/window_tree_host.h" | 9 #include "ui/aura/window_tree_host.h" |
| 10 #include "ui/events/event_source.h" | 10 #include "ui/events/event_source.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 window_iter != windows.end(); | 27 window_iter != windows.end(); |
| 28 ++window_iter) { | 28 ++window_iter) { |
| 29 (*window_iter)->GetHost()->GetEventSource()->RemoveEventRewriter( | 29 (*window_iter)->GetHost()->GetEventSource()->RemoveEventRewriter( |
| 30 *rewriter_iter); | 30 *rewriter_iter); |
| 31 } | 31 } |
| 32 } | 32 } |
| 33 rewriters_.clear(); | 33 rewriters_.clear(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void EventRewriterController::AddEventRewriter( | 36 void EventRewriterController::AddEventRewriter( |
| 37 scoped_ptr<ui::EventRewriter> rewriter) { | 37 std::unique_ptr<ui::EventRewriter> rewriter) { |
| 38 DCHECK(!initialized_); | 38 DCHECK(!initialized_); |
| 39 rewriters_.push_back(rewriter.release()); | 39 rewriters_.push_back(rewriter.release()); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void EventRewriterController::Init() { | 42 void EventRewriterController::Init() { |
| 43 DCHECK(!initialized_); | 43 DCHECK(!initialized_); |
| 44 initialized_ = true; | 44 initialized_ = true; |
| 45 // Add the rewriters to each existing root window EventSource. | 45 // Add the rewriters to each existing root window EventSource. |
| 46 aura::Window::Windows windows = ash::Shell::GetAllRootWindows(); | 46 aura::Window::Windows windows = ash::Shell::GetAllRootWindows(); |
| 47 for (aura::Window::Windows::iterator it = windows.begin(); | 47 for (aura::Window::Windows::iterator it = windows.begin(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 58 | 58 |
| 59 void EventRewriterController::AddToEventSource(ui::EventSource* source) { | 59 void EventRewriterController::AddToEventSource(ui::EventSource* source) { |
| 60 DCHECK(source); | 60 DCHECK(source); |
| 61 for (EventRewriters::iterator it = rewriters_.begin(); it != rewriters_.end(); | 61 for (EventRewriters::iterator it = rewriters_.begin(); it != rewriters_.end(); |
| 62 ++it) { | 62 ++it) { |
| 63 source->AddEventRewriter(*it); | 63 source->AddEventRewriter(*it); |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 } // namespace chromeos | 67 } // namespace chromeos |
| OLD | NEW |