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

Side by Side Diff: third_party/WebKit/Source/core/fileapi/FileError.cpp

Issue 2068053002: Rename Blink constants generated from IDL files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 const char quotaExceededErrorMessage[] = "The operation failed because it would cause the application to exceed its storage quota."; 48 const char quotaExceededErrorMessage[] = "The operation failed because it would cause the application to exceed its storage quota.";
49 const char securityErrorMessage[] = "It was determined that certain files are un safe for access within a Web application, or that too many calls are being made on file resources."; 49 const char securityErrorMessage[] = "It was determined that certain files are un safe for access within a Web application, or that too many calls are being made on file resources.";
50 const char syntaxErrorMessage[] = "An invalid or unsupported argument was given, like an invalid line ending specifier."; 50 const char syntaxErrorMessage[] = "An invalid or unsupported argument was given, like an invalid line ending specifier.";
51 const char typeMismatchErrorMessage[] = "The path supplied exists, but was not a n entry of requested type."; 51 const char typeMismatchErrorMessage[] = "The path supplied exists, but was not a n entry of requested type.";
52 52
53 namespace { 53 namespace {
54 54
55 ExceptionCode errorCodeToExceptionCode(ErrorCode code) 55 ExceptionCode errorCodeToExceptionCode(ErrorCode code)
56 { 56 {
57 switch (code) { 57 switch (code) {
58 case OK: 58 case kOK:
59 return 0; 59 return 0;
60 case NOT_FOUND_ERR: 60 case kNotFoundErr:
61 return NotFoundError; 61 return NotFoundError;
62 case SECURITY_ERR: 62 case kSecurityErr:
63 return SecurityError; 63 return SecurityError;
64 case ABORT_ERR: 64 case kAbortErr:
65 return AbortError; 65 return AbortError;
66 case NOT_READABLE_ERR: 66 case kNotReadableErr:
67 return NotReadableError; 67 return NotReadableError;
68 case ENCODING_ERR: 68 case kEncodingErr:
69 return EncodingError; 69 return EncodingError;
70 case NO_MODIFICATION_ALLOWED_ERR: 70 case kNoModificationAllowedErr:
71 return NoModificationAllowedError; 71 return NoModificationAllowedError;
72 case INVALID_STATE_ERR: 72 case kInvalidStateErr:
73 return InvalidStateError; 73 return InvalidStateError;
74 case SYNTAX_ERR: 74 case kSyntaxErr:
75 return SyntaxError; 75 return SyntaxError;
76 case INVALID_MODIFICATION_ERR: 76 case kInvalidModificationErr:
77 return InvalidModificationError; 77 return InvalidModificationError;
78 case QUOTA_EXCEEDED_ERR: 78 case kQuotaExceededErr:
79 return QuotaExceededError; 79 return QuotaExceededError;
80 case TYPE_MISMATCH_ERR: 80 case kTypeMismatchErr:
81 return TypeMismatchError; 81 return TypeMismatchError;
82 case PATH_EXISTS_ERR: 82 case kPathExistsErr:
83 return PathExistsError; 83 return PathExistsError;
84 default: 84 default:
85 ASSERT_NOT_REACHED(); 85 ASSERT_NOT_REACHED();
86 return code; 86 return code;
87 } 87 }
88 } 88 }
89 89
90 const char* errorCodeToMessage(ErrorCode code) 90 const char* errorCodeToMessage(ErrorCode code)
91 { 91 {
92 // Note that some of these do not set message. If message is 0 then the defa ult message is used. 92 // Note that some of these do not set message. If message is 0 then the defa ult message is used.
93 switch (code) { 93 switch (code) {
94 case OK: 94 case kOK:
95 return 0; 95 return 0;
96 case SECURITY_ERR: 96 case kSecurityErr:
97 return securityErrorMessage; 97 return securityErrorMessage;
98 case NOT_FOUND_ERR: 98 case kNotFoundErr:
99 return notFoundErrorMessage; 99 return notFoundErrorMessage;
100 case ABORT_ERR: 100 case kAbortErr:
101 return abortErrorMessage; 101 return abortErrorMessage;
102 case NOT_READABLE_ERR: 102 case kNotReadableErr:
103 return notReadableErrorMessage; 103 return notReadableErrorMessage;
104 case ENCODING_ERR: 104 case kEncodingErr:
105 return encodingErrorMessage; 105 return encodingErrorMessage;
106 case NO_MODIFICATION_ALLOWED_ERR: 106 case kNoModificationAllowedErr:
107 return noModificationAllowedErrorMessage; 107 return noModificationAllowedErrorMessage;
108 case INVALID_STATE_ERR: 108 case kInvalidStateErr:
109 return invalidStateErrorMessage; 109 return invalidStateErrorMessage;
110 case SYNTAX_ERR: 110 case kSyntaxErr:
111 return syntaxErrorMessage; 111 return syntaxErrorMessage;
112 case INVALID_MODIFICATION_ERR: 112 case kInvalidModificationErr:
113 return 0; 113 return 0;
114 case QUOTA_EXCEEDED_ERR: 114 case kQuotaExceededErr:
115 return quotaExceededErrorMessage; 115 return quotaExceededErrorMessage;
116 case TYPE_MISMATCH_ERR: 116 case kTypeMismatchErr:
117 return 0; 117 return 0;
118 case PATH_EXISTS_ERR: 118 case kPathExistsErr:
119 return pathExistsErrorMessage; 119 return pathExistsErrorMessage;
120 default: 120 default:
121 ASSERT_NOT_REACHED(); 121 ASSERT_NOT_REACHED();
122 return 0; 122 return 0;
123 } 123 }
124 } 124 }
125 125
126 } // namespace 126 } // namespace
127 127
128 void throwDOMException(ExceptionState& exceptionState, ErrorCode code) 128 void throwDOMException(ExceptionState& exceptionState, ErrorCode code)
129 { 129 {
130 if (code == OK) 130 if (code == kOK)
131 return; 131 return;
132 132
133 // SecurityError is special-cased, as we want to route those exceptions thro ugh ExceptionState::throwSecurityError. 133 // SecurityError is special-cased, as we want to route those exceptions thro ugh ExceptionState::throwSecurityError.
134 if (code == SECURITY_ERR) { 134 if (code == kSecurityErr) {
135 exceptionState.throwSecurityError(securityErrorMessage); 135 exceptionState.throwSecurityError(securityErrorMessage);
136 return; 136 return;
137 } 137 }
138 138
139 exceptionState.throwDOMException(errorCodeToExceptionCode(code), errorCodeTo Message(code)); 139 exceptionState.throwDOMException(errorCodeToExceptionCode(code), errorCodeTo Message(code));
140 } 140 }
141 141
142 DOMException* createDOMException(ErrorCode code) 142 DOMException* createDOMException(ErrorCode code)
143 { 143 {
144 DCHECK_NE(code, OK); 144 DCHECK_NE(code, kOK);
145 return DOMException::create(errorCodeToExceptionCode(code), errorCodeToMessa ge(code)); 145 return DOMException::create(errorCodeToExceptionCode(code), errorCodeToMessa ge(code));
146 } 146 }
147 147
148 } // namespace FileError 148 } // namespace FileError
149 149
150 } // namespace blink 150 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fileapi/FileError.h ('k') | third_party/WebKit/Source/core/fileapi/FileReader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698