| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/api/braille_display_private/braille_controll
er_brlapi.h" | 5 #include "chrome/browser/extensions/api/braille_display_private/braille_controll
er_brlapi.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cerrno> | 10 #include <cerrno> |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 void BrailleControllerImpl::DispatchKeyEvent(std::unique_ptr<KeyEvent> event) { | 296 void BrailleControllerImpl::DispatchKeyEvent(std::unique_ptr<KeyEvent> event) { |
| 297 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 297 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| 298 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 298 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 299 base::Bind( | 299 base::Bind( |
| 300 &BrailleControllerImpl::DispatchKeyEvent, | 300 &BrailleControllerImpl::DispatchKeyEvent, |
| 301 base::Unretained(this), | 301 base::Unretained(this), |
| 302 base::Passed(&event))); | 302 base::Passed(&event))); |
| 303 return; | 303 return; |
| 304 } | 304 } |
| 305 VLOG(1) << "Dispatching key event: " << *event->ToValue(); | 305 VLOG(1) << "Dispatching key event: " << *event->ToValue(); |
| 306 FOR_EACH_OBSERVER(BrailleObserver, observers_, OnBrailleKeyEvent(*event)); | 306 for (auto& observer : observers_) |
| 307 observer.OnBrailleKeyEvent(*event); |
| 307 } | 308 } |
| 308 | 309 |
| 309 void BrailleControllerImpl::DispatchOnDisplayStateChanged( | 310 void BrailleControllerImpl::DispatchOnDisplayStateChanged( |
| 310 std::unique_ptr<DisplayState> new_state) { | 311 std::unique_ptr<DisplayState> new_state) { |
| 311 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 312 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| 312 if (!BrowserThread::PostTask( | 313 if (!BrowserThread::PostTask( |
| 313 BrowserThread::UI, FROM_HERE, | 314 BrowserThread::UI, FROM_HERE, |
| 314 base::Bind(&BrailleControllerImpl::DispatchOnDisplayStateChanged, | 315 base::Bind(&BrailleControllerImpl::DispatchOnDisplayStateChanged, |
| 315 base::Unretained(this), | 316 base::Unretained(this), |
| 316 base::Passed(&new_state)))) { | 317 base::Passed(&new_state)))) { |
| 317 NOTREACHED(); | 318 NOTREACHED(); |
| 318 } | 319 } |
| 319 return; | 320 return; |
| 320 } | 321 } |
| 321 FOR_EACH_OBSERVER(BrailleObserver, observers_, | 322 for (auto& observer : observers_) |
| 322 OnBrailleDisplayStateChanged(*new_state)); | 323 observer.OnBrailleDisplayStateChanged(*new_state); |
| 323 } | 324 } |
| 324 | 325 |
| 325 } // namespace braille_display_private | 326 } // namespace braille_display_private |
| 326 } // namespace api | 327 } // namespace api |
| 327 } // namespace extensions | 328 } // namespace extensions |
| OLD | NEW |