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

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: Use new createBaseCallback helper instead of custom callback class. Created 4 years, 7 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 "config.h"
8 #include "core/dom/DOMException.h"
9 #include "core/dom/ExceptionCode.h"
10
11 using device::wtf::NFCErrorType;
12
13 namespace blink {
14
15 DOMException* NFCError::take(ScriptPromiseResolver*, const NFCErrorType& errorTy pe)
16 {
17 switch (errorType) {
18 case NFCErrorType::SECURITY:
19 return DOMException::create(SecurityError, "NFC operation not allowed.") ;
20 case NFCErrorType::NOT_SUPPORTED:
21 case NFCErrorType::DEVICE_DISABLED:
22 return DOMException::create(NotSupportedError, "NFC operation not suppor ted.");
23 case NFCErrorType::NOT_FOUND:
24 return DOMException::create(NotFoundError, "Invalid NFC watch Id was pro vided.");
25 case NFCErrorType::INVALID_MESSAGE:
26 return DOMException::create(SyntaxError, "Invalid NFC message was provid ed.");
27 case NFCErrorType::OPERATION_CANCELLED:
28 return DOMException::create(AbortError, "The NFC operation was cancelled .");
29 case NFCErrorType::TIMER_EXPIRED:
30 return DOMException::create(TimeoutError, "NFC operation has timed-out." );
31 case NFCErrorType::CANNOT_CANCEL:
32 return DOMException::create(NoModificationAllowedError, "NFC operation c annot be canceled.");
33 case NFCErrorType::IO_ERROR:
34 return DOMException::create(NetworkError, "NFC data transfer error has o ccurred.");
35 }
36 ASSERT_NOT_REACHED();
37 return DOMException::create(UnknownError, "An unknown NFC error has occurred .");
38 }
39
40 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698