| 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 #ifndef CHROMEOS_DBUS_FAKE_NFC_ADAPTER_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_FAKE_NFC_ADAPTER_CLIENT_H_ | 
| 6 #define CHROMEOS_DBUS_FAKE_NFC_ADAPTER_CLIENT_H_ | 6 #define CHROMEOS_DBUS_FAKE_NFC_ADAPTER_CLIENT_H_ | 
| 7 | 7 | 
| 8 #include <string> | 8 #include <string> | 
| 9 | 9 | 
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 23   static const char kAdapterPath0[]; | 23   static const char kAdapterPath0[]; | 
| 24   static const char kAdapterPath1[]; | 24   static const char kAdapterPath1[]; | 
| 25 | 25 | 
| 26   // Properties structure that provides fake behavior for D-Bus calls. | 26   // Properties structure that provides fake behavior for D-Bus calls. | 
| 27   struct Properties : public NfcAdapterClient::Properties { | 27   struct Properties : public NfcAdapterClient::Properties { | 
| 28     explicit Properties(const PropertyChangedCallback& callback); | 28     explicit Properties(const PropertyChangedCallback& callback); | 
| 29     virtual ~Properties(); | 29     virtual ~Properties(); | 
| 30 | 30 | 
| 31     // dbus::PropertySet overrides. | 31     // dbus::PropertySet overrides. | 
| 32     virtual void Get(dbus::PropertyBase* property, | 32     virtual void Get(dbus::PropertyBase* property, | 
| 33                      dbus::PropertySet::GetCallback callback) OVERRIDE; | 33                      dbus::PropertySet::GetCallback callback) override; | 
| 34     virtual void GetAll() OVERRIDE; | 34     virtual void GetAll() override; | 
| 35     virtual void Set(dbus::PropertyBase* property, | 35     virtual void Set(dbus::PropertyBase* property, | 
| 36                      dbus::PropertySet::SetCallback callback) OVERRIDE; | 36                      dbus::PropertySet::SetCallback callback) override; | 
| 37   }; | 37   }; | 
| 38 | 38 | 
| 39   FakeNfcAdapterClient(); | 39   FakeNfcAdapterClient(); | 
| 40   virtual ~FakeNfcAdapterClient(); | 40   virtual ~FakeNfcAdapterClient(); | 
| 41 | 41 | 
| 42   // NfcAdapterClient overrides. | 42   // NfcAdapterClient overrides. | 
| 43   virtual void Init(dbus::Bus* bus) OVERRIDE; | 43   virtual void Init(dbus::Bus* bus) override; | 
| 44   virtual void AddObserver(Observer* observer) OVERRIDE; | 44   virtual void AddObserver(Observer* observer) override; | 
| 45   virtual void RemoveObserver(Observer* observer) OVERRIDE; | 45   virtual void RemoveObserver(Observer* observer) override; | 
| 46   virtual std::vector<dbus::ObjectPath> GetAdapters() OVERRIDE; | 46   virtual std::vector<dbus::ObjectPath> GetAdapters() override; | 
| 47   virtual Properties* GetProperties( | 47   virtual Properties* GetProperties( | 
| 48       const dbus::ObjectPath& object_path) OVERRIDE; | 48       const dbus::ObjectPath& object_path) override; | 
| 49   virtual void StartPollLoop( | 49   virtual void StartPollLoop( | 
| 50       const dbus::ObjectPath& object_path, | 50       const dbus::ObjectPath& object_path, | 
| 51       const std::string& mode, | 51       const std::string& mode, | 
| 52       const base::Closure& callback, | 52       const base::Closure& callback, | 
| 53       const nfc_client_helpers::ErrorCallback& error_callback) OVERRIDE; | 53       const nfc_client_helpers::ErrorCallback& error_callback) override; | 
| 54   virtual void StopPollLoop( | 54   virtual void StopPollLoop( | 
| 55       const dbus::ObjectPath& object_path, | 55       const dbus::ObjectPath& object_path, | 
| 56       const base::Closure& callback, | 56       const base::Closure& callback, | 
| 57       const nfc_client_helpers::ErrorCallback& error_callback) OVERRIDE; | 57       const nfc_client_helpers::ErrorCallback& error_callback) override; | 
| 58 | 58 | 
| 59   // Sets the adapter as |present|. Used for testing. | 59   // Sets the adapter as |present|. Used for testing. | 
| 60   void SetAdapterPresent(bool present); | 60   void SetAdapterPresent(bool present); | 
| 61   void SetSecondAdapterPresent(bool present); | 61   void SetSecondAdapterPresent(bool present); | 
| 62 | 62 | 
| 63   // Tells the FakeNfcAdapterClient to add the device or tag with the given path | 63   // Tells the FakeNfcAdapterClient to add the device or tag with the given path | 
| 64   // to its corresponding list for |kAdapterPath0|, if it is not already in | 64   // to its corresponding list for |kAdapterPath0|, if it is not already in | 
| 65   // the list and promptly triggers a property changed signal. This method will | 65   // the list and promptly triggers a property changed signal. This method will | 
| 66   // also fail, if the polling property of the adapter is false and will set it | 66   // also fail, if the polling property of the adapter is false and will set it | 
| 67   // to false on success. | 67   // to false on success. | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 108   // If true, device pairing will be simulated on the next call to | 108   // If true, device pairing will be simulated on the next call to | 
| 109   // StartPollLoop. Otherwise, tag pairing will be simulated. | 109   // StartPollLoop. Otherwise, tag pairing will be simulated. | 
| 110   bool device_pairing_; | 110   bool device_pairing_; | 
| 111 | 111 | 
| 112   DISALLOW_COPY_AND_ASSIGN(FakeNfcAdapterClient); | 112   DISALLOW_COPY_AND_ASSIGN(FakeNfcAdapterClient); | 
| 113 }; | 113 }; | 
| 114 | 114 | 
| 115 }  // namespace chromeos | 115 }  // namespace chromeos | 
| 116 | 116 | 
| 117 #endif  // CHROMEOS_DBUS_FAKE_NFC_ADAPTER_CLIENT_H_ | 117 #endif  // CHROMEOS_DBUS_FAKE_NFC_ADAPTER_CLIENT_H_ | 
| OLD | NEW | 
|---|