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/ui/webui/chromeos/nfc_debug_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/nfc_debug_ui.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 175 } |
176 | 176 |
177 // content::WebUIMessageHandler implementation for this page. | 177 // content::WebUIMessageHandler implementation for this page. |
178 class NfcDebugMessageHandler : public content::WebUIMessageHandler, | 178 class NfcDebugMessageHandler : public content::WebUIMessageHandler, |
179 public NfcAdapter::Observer, | 179 public NfcAdapter::Observer, |
180 public NfcNdefTagTechnology::Observer, | 180 public NfcNdefTagTechnology::Observer, |
181 public NfcPeer::Observer, | 181 public NfcPeer::Observer, |
182 public NfcTag::Observer { | 182 public NfcTag::Observer { |
183 public: | 183 public: |
184 NfcDebugMessageHandler(); | 184 NfcDebugMessageHandler(); |
185 virtual ~NfcDebugMessageHandler(); | 185 ~NfcDebugMessageHandler() override; |
186 | 186 |
187 // WebUIMessageHandler implementation. | 187 // WebUIMessageHandler implementation. |
188 virtual void RegisterMessages() override; | 188 void RegisterMessages() override; |
189 | 189 |
190 // NfcAdapter::Observer overrides. | 190 // NfcAdapter::Observer overrides. |
191 virtual void AdapterPresentChanged( | 191 void AdapterPresentChanged(NfcAdapter* adapter, bool present) override; |
192 NfcAdapter* adapter, | 192 void AdapterPoweredChanged(NfcAdapter* adapter, bool powered) override; |
193 bool present) override; | 193 void AdapterPollingChanged(NfcAdapter* adapter, bool polling) override; |
194 virtual void AdapterPoweredChanged( | 194 void TagFound(NfcAdapter* adapter, NfcTag* tag) override; |
195 NfcAdapter* adapter, | 195 void TagLost(NfcAdapter* adapter, NfcTag* tag) override; |
196 bool powered) override; | 196 void PeerFound(NfcAdapter* adaper, NfcPeer* peer) override; |
197 virtual void AdapterPollingChanged( | 197 void PeerLost(NfcAdapter* adapter, NfcPeer* peer) override; |
198 NfcAdapter* adapter, | |
199 bool polling) override; | |
200 virtual void TagFound(NfcAdapter* adapter, NfcTag* tag) override; | |
201 virtual void TagLost(NfcAdapter*adapter, NfcTag* tag) override; | |
202 virtual void PeerFound(NfcAdapter* adaper, NfcPeer* peer) override; | |
203 virtual void PeerLost(NfcAdapter* adapter, NfcPeer* peer) override; | |
204 | 198 |
205 // NfcNdefTagTechnology::Observer override. | 199 // NfcNdefTagTechnology::Observer override. |
206 virtual void RecordReceived( | 200 void RecordReceived(NfcTag* tag, const NfcNdefRecord* record) override; |
207 NfcTag* tag, | |
208 const NfcNdefRecord* record) override; | |
209 | 201 |
210 // NfcPeer::Observer override. | 202 // NfcPeer::Observer override. |
211 virtual void RecordReceived( | 203 void RecordReceived(NfcPeer* peer, const NfcNdefRecord* record) override; |
212 NfcPeer* peer, | |
213 const NfcNdefRecord* record) override; | |
214 | 204 |
215 // NfcTag::Observer override. | 205 // NfcTag::Observer override. |
216 virtual void TagReady(NfcTag* tag) override; | 206 void TagReady(NfcTag* tag) override; |
217 | 207 |
218 private: | 208 private: |
219 // Called by the UI when the page loads. This method requests information | 209 // Called by the UI when the page loads. This method requests information |
220 // about NFC availability on the current platform and requests the underlying | 210 // about NFC availability on the current platform and requests the underlying |
221 // Adapter object. The UI is notified once the information is available. | 211 // Adapter object. The UI is notified once the information is available. |
222 void Initialize(const base::ListValue* args); | 212 void Initialize(const base::ListValue* args); |
223 | 213 |
224 // Called by the UI to toggle the adapter power. |args| will contain one | 214 // Called by the UI to toggle the adapter power. |args| will contain one |
225 // boolean that indicates whether the power should be set to ON or OFF. | 215 // boolean that indicates whether the power should be set to ON or OFF. |
226 void SetAdapterPower(const base::ListValue* args); | 216 void SetAdapterPower(const base::ListValue* args); |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 html_source->SetDefaultResource(IDR_NFC_DEBUG_HTML); | 732 html_source->SetDefaultResource(IDR_NFC_DEBUG_HTML); |
743 | 733 |
744 Profile* profile = Profile::FromWebUI(web_ui); | 734 Profile* profile = Profile::FromWebUI(web_ui); |
745 content::WebUIDataSource::Add(profile, html_source); | 735 content::WebUIDataSource::Add(profile, html_source); |
746 } | 736 } |
747 | 737 |
748 NfcDebugUI::~NfcDebugUI() { | 738 NfcDebugUI::~NfcDebugUI() { |
749 } | 739 } |
750 | 740 |
751 } // namespace chromeos | 741 } // namespace chromeos |
OLD | NEW |