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

Side by Side Diff: third_party/WebKit/Source/modules/nfc/NFCError.cpp

Issue 1708543002: [webnfc] Implement push() method in blink nfc module. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@onionsoup_webnfc
Patch Set: Move dependency from content_browsertests to layouttest_support_content Created 4 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "modules/nfc/NFCError.h"
6
7 #include "core/dom/DOMException.h"
8 #include "core/dom/ExceptionCode.h"
9
10 using device::nfc::blink::NFCErrorType;
11
12 namespace blink {
13
14 DOMException* NFCError::take(ScriptPromiseResolver*, const NFCErrorType& errorTy pe)
15 {
16 switch (errorType) {
17 case NFCErrorType::SECURITY:
18 return DOMException::create(SecurityError, "NFC operation not allowed.") ;
19 case NFCErrorType::NOT_SUPPORTED:
20 case NFCErrorType::DEVICE_DISABLED:
21 return DOMException::create(NotSupportedError, "NFC operation not suppor ted.");
22 case NFCErrorType::NOT_FOUND:
23 return DOMException::create(NotFoundError, "Invalid NFC watch Id was pro vided.");
24 case NFCErrorType::INVALID_MESSAGE:
25 return DOMException::create(SyntaxError, "Invalid NFC message was provid ed.");
26 case NFCErrorType::OPERATION_CANCELLED:
27 return DOMException::create(AbortError, "The NFC operation was cancelled .");
28 case NFCErrorType::TIMER_EXPIRED:
29 return DOMException::create(TimeoutError, "NFC operation has timed-out." );
30 case NFCErrorType::CANNOT_CANCEL:
31 return DOMException::create(NoModificationAllowedError, "NFC operation c annot be canceled.");
32 case NFCErrorType::IO_ERROR:
33 return DOMException::create(NetworkError, "NFC data transfer error has o ccurred.");
34 }
35 NOTREACHED();
36 return DOMException::create(UnknownError, "An unknown NFC error has occurred .");
37 }
38
39 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/nfc/NFCError.h ('k') | third_party/WebKit/public/blink_headers.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698