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/basictypes.h" | |
9 #include "base/logging.h" | |
10 #include "base/memory/ref_counted.h" | |
11 #include "base/string16.h" | |
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebIDBDatabaseError
.h" | |
13 | |
14 namespace content { | |
15 | |
16 class IndexedDBDatabaseError : public base::RefCounted<IndexedDBDatabaseError> { | |
17 public: | |
18 static scoped_refptr<IndexedDBDatabaseError> Create(uint16 code, | |
19 const string16& message) { | |
20 // TODO(jsbell): Assert that this is a valid WebIDBDatabaseException code. | |
21 return make_scoped_refptr(new IndexedDBDatabaseError(code, message)); | |
22 } | |
23 static scoped_refptr<IndexedDBDatabaseError> Create( | |
24 const WebKit::WebIDBDatabaseError& other) { | |
25 return make_scoped_refptr( | |
26 new IndexedDBDatabaseError(other.code(), other.message())); | |
27 } | |
28 | |
29 uint16 code() const { return code_; } | |
30 const string16& message() const { return message_; } | |
31 | |
32 private: | |
33 IndexedDBDatabaseError(uint16 code, const string16& message) | |
34 : code_(code), message_(message) {} | |
35 ~IndexedDBDatabaseError() {} | |
36 friend class base::RefCounted<IndexedDBDatabaseError>; | |
37 const uint16 code_; | |
38 const string16 message_; | |
39 }; | |
40 | |
41 } // namespace content | |
42 | |
43 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_ERROR_H_ | |
OLD | NEW |