OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 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 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_ERROR_H_ | |
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_ERROR_H_ | |
7 | |
8 #include "base/logging.h" | |
9 #include "base/memory/ref_counted.h" | |
10 #include "base/string16.h" | |
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebIDBDatabaseError .h" | |
12 | |
13 namespace content { | |
14 | |
15 class IndexedDBDatabaseError : public base::RefCounted<IndexedDBDatabaseError> { | |
16 public: | |
17 static scoped_refptr<IndexedDBDatabaseError> Create(unsigned short code, | |
18 const string16& message) { | |
19 // TODO(jsbell): Assert that this is a valid WebIDBDatabaseException code. | |
20 return make_scoped_refptr(new IndexedDBDatabaseError(code, message)); | |
21 } | |
22 static scoped_refptr<IndexedDBDatabaseError> Create( | |
23 const WebKit::WebIDBDatabaseError& other) { | |
24 return make_scoped_refptr( | |
25 new IndexedDBDatabaseError(other.code(), other.message())); | |
26 } | |
27 | |
28 unsigned short code() const { return code_; } | |
jamesr
2013/05/22 18:59:44
this should probably be an explicitly sized type i
jsbell
2013/05/22 22:21:14
Done.
| |
29 const string16& message() const { return message_; } | |
30 | |
31 private: | |
32 IndexedDBDatabaseError(unsigned short code, const string16& message) | |
33 : code_(code), message_(message) {} | |
34 ~IndexedDBDatabaseError() {} | |
35 friend class base::RefCounted<IndexedDBDatabaseError>; | |
36 const unsigned short code_; | |
37 const string16 message_; | |
38 }; | |
39 | |
40 } // namespace content | |
41 | |
42 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_ERROR_H_ | |
OLD | NEW |