| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/synaptics_library.h" | 5 #include "chrome/browser/chromeos/synaptics_library.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "chrome/browser/chrome_thread.h" | 8 #include "chrome/browser/chrome_thread.h" |
| 9 #include "chrome/browser/chromeos/cros_library.h" | 9 #include "chrome/browser/chromeos/cros_library.h" |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 value = 1; | 29 value = 1; |
| 30 if (value > 10) | 30 if (value > 10) |
| 31 value = 10; | 31 value = 10; |
| 32 SetParameter(param, value); | 32 SetParameter(param, value); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void SynapticsLibrary::SetParameter(SynapticsParameter param, int value) { | 35 void SynapticsLibrary::SetParameter(SynapticsParameter param, int value) { |
| 36 if (CrosLibrary::loaded()) { | 36 if (CrosLibrary::loaded()) { |
| 37 // This calls SetSynapticsParameter in the cros library which is | 37 // This calls SetSynapticsParameter in the cros library which is |
| 38 // potentially time consuming. So we run this on the FILE thread. | 38 // potentially time consuming. So we run this on the FILE thread. |
| 39 MessageLoop* loop = ChromeThread::GetMessageLoop(ChromeThread::FILE); | 39 ChromeThread::PostTask( |
| 40 if (loop) { | 40 ChromeThread::FILE, FROM_HERE, |
| 41 loop->PostTask(FROM_HERE, NewRunnableFunction( | 41 NewRunnableFunction(&SetSynapticsParameter, param, value)); |
| 42 &SetSynapticsParameter, param, value)); | |
| 43 } | |
| 44 } | 42 } |
| 45 } | 43 } |
| 46 | 44 |
| 47 } // namespace chromeos | 45 } // namespace chromeos |
| OLD | NEW |