Chromium Code Reviews| Index: content/browser/indexed_db/indexed_db_database_error.h |
| diff --git a/content/browser/indexed_db/indexed_db_database_error.h b/content/browser/indexed_db/indexed_db_database_error.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b2206bf014ba6a4544645fb7e10c1297f15fc7d5 |
| --- /dev/null |
| +++ b/content/browser/indexed_db/indexed_db_database_error.h |
| @@ -0,0 +1,42 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_ERROR_H_ |
| +#define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_ERROR_H_ |
| + |
| +#include "base/logging.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/string16.h" |
| +#include "third_party/WebKit/Source/Platform/chromium/public/WebIDBDatabaseError.h" |
| + |
| +namespace content { |
| + |
| +class IndexedDBDatabaseError : public base::RefCounted<IndexedDBDatabaseError> { |
| + public: |
| + static scoped_refptr<IndexedDBDatabaseError> Create(unsigned short code, |
| + const string16& message) { |
| + // TODO(jsbell): Assert that this is a valid WebIDBDatabaseException code. |
| + return make_scoped_refptr(new IndexedDBDatabaseError(code, message)); |
| + } |
| + static scoped_refptr<IndexedDBDatabaseError> Create( |
| + const WebKit::WebIDBDatabaseError& other) { |
| + return make_scoped_refptr( |
| + new IndexedDBDatabaseError(other.code(), other.message())); |
| + } |
| + |
| + 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.
|
| + const string16& message() const { return message_; } |
| + |
| + private: |
| + IndexedDBDatabaseError(unsigned short code, const string16& message) |
| + : code_(code), message_(message) {} |
| + ~IndexedDBDatabaseError() {} |
| + friend class base::RefCounted<IndexedDBDatabaseError>; |
| + const unsigned short code_; |
| + const string16 message_; |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_ERROR_H_ |