Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(779)

Unified Diff: chrome/browser/chromeos/cros/synaptics_library.cc

Issue 3076029: Allow chrome for cros to be started with a username / password (Closed)
Patch Set: Only declare StubLogin on cros builds Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/cros/synaptics_library.h ('k') | chrome/browser/chromeos/cros/syslogs_library.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/cros/synaptics_library.cc
diff --git a/chrome/browser/chromeos/cros/synaptics_library.cc b/chrome/browser/chromeos/cros/synaptics_library.cc
index 462be764edb4abc2a801009fba985ddd9116776c..c7413df12553211a021213ff6854c27726e5dc47 100644
--- a/chrome/browser/chromeos/cros/synaptics_library.cc
+++ b/chrome/browser/chromeos/cros/synaptics_library.cc
@@ -9,29 +9,61 @@
#include "chrome/browser/chromeos/cros/cros_library.h"
namespace chromeos {
+// This class handles the interaction with the ChromeOS synaptics library APIs.
+// Users can get an instance of this library class like this:
+// SynapticsLibrary::Get()
+// For a list of SynapticsPrameters, see chromeos_synaptics.h
+// in third_party/cros or /usr/include/cros
+class SynapticsLibraryImpl : public SynapticsLibrary {
+ public:
+ SynapticsLibraryImpl() {}
+ virtual ~SynapticsLibraryImpl() {}
-void SynapticsLibraryImpl::SetBoolParameter(SynapticsParameter param,
- bool value) {
- SetParameter(param, value ? 1 : 0);
-}
+ void SetBoolParameter(SynapticsParameter param, bool value) {
+ SetParameter(param, value ? 1 : 0);
+ }
-void SynapticsLibraryImpl::SetRangeParameter(SynapticsParameter param,
- int value) {
- if (value < 1)
- value = 1;
- if (value > 10)
- value = 10;
- SetParameter(param, value);
-}
+ void SetRangeParameter(SynapticsParameter param, int value) {
+ if (value < 1)
+ value = 1;
+ if (value > 10)
+ value = 10;
+ SetParameter(param, value);
+ }
-void SynapticsLibraryImpl::SetParameter(SynapticsParameter param, int value) {
- if (CrosLibrary::Get()->EnsureLoaded()) {
- // This calls SetSynapticsParameter in the cros library which is
- // potentially time consuming. So we run this on the FILE thread.
- ChromeThread::PostTask(
- ChromeThread::FILE, FROM_HERE,
- NewRunnableFunction(&SetSynapticsParameter, param, value));
+ private:
+ // This helper methods calls into the libcros library to set the parameter.
+ // This call is run on the FILE thread.
+ void SetParameter(SynapticsParameter param, int value) {
+ if (CrosLibrary::Get()->EnsureLoaded()) {
+ // This calls SetSynapticsParameter in the cros library which is
+ // potentially time consuming. So we run this on the FILE thread.
+ ChromeThread::PostTask(
+ ChromeThread::FILE, FROM_HERE,
+ NewRunnableFunction(&SetSynapticsParameter, param, value));
+ }
}
+
+ DISALLOW_COPY_AND_ASSIGN(SynapticsLibraryImpl);
+};
+
+class SynapticsLibraryStubImpl : public SynapticsLibrary {
+ public:
+ SynapticsLibraryStubImpl() {}
+ virtual ~SynapticsLibraryStubImpl() {}
+ void SetBoolParameter(SynapticsParameter param, bool value) {}
+ void SetRangeParameter(SynapticsParameter param, int value) {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SynapticsLibraryStubImpl);
+};
+
+// static
+SynapticsLibrary* SynapticsLibrary::GetImpl(bool stub) {
+ if (stub)
+ return new SynapticsLibraryStubImpl();
+ else
+ return new SynapticsLibraryImpl();
}
} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/cros/synaptics_library.h ('k') | chrome/browser/chromeos/cros/syslogs_library.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698