OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_BASE_H_ | 5 #ifndef COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_BASE_H_ |
6 #define COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_BASE_H_ | 6 #define COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_BASE_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 : public base::RefCountedDeleteOnMessageLoop<WebDataServiceBase> { | 29 : public base::RefCountedDeleteOnMessageLoop<WebDataServiceBase> { |
30 public: | 30 public: |
31 // All requests return an opaque handle of the following type. | 31 // All requests return an opaque handle of the following type. |
32 typedef int Handle; | 32 typedef int Handle; |
33 | 33 |
34 // Users of this class may provide a callback to handle errors | 34 // Users of this class may provide a callback to handle errors |
35 // (e.g. by showing a UI). The callback is called only on error, and | 35 // (e.g. by showing a UI). The callback is called only on error, and |
36 // takes a single parameter, the sql::InitStatus value from trying | 36 // takes a single parameter, the sql::InitStatus value from trying |
37 // to open the database. | 37 // to open the database. |
38 // TODO(joi): Should we combine this with WebDatabaseService::InitCallback? | 38 // TODO(joi): Should we combine this with WebDatabaseService::InitCallback? |
39 typedef base::Callback<void(sql::InitStatus)> ProfileErrorCallback; | 39 typedef base::Callback<void(sql::InitStatus, const std::string&)> |
| 40 ProfileErrorCallback; |
40 | 41 |
41 typedef base::Closure DBLoadedCallback; | 42 typedef base::Closure DBLoadedCallback; |
42 | 43 |
43 // |callback| will only be invoked on error, and only if | 44 // |callback| will only be invoked on error, and only if |
44 // |callback.is_null()| evaluates to false. | 45 // |callback.is_null()| evaluates to false. |
45 // | 46 // |
46 // The ownership of |wdbs| is shared, with the primary owner being the | 47 // The ownership of |wdbs| is shared, with the primary owner being the |
47 // WebDataServiceWrapper, and secondary owners being subclasses of | 48 // WebDataServiceWrapper, and secondary owners being subclasses of |
48 // WebDataServiceBase, which receive |wdbs| upon construction. The | 49 // WebDataServiceBase, which receive |wdbs| upon construction. The |
49 // WebDataServiceWrapper handles the initializing and shutting down and of | 50 // WebDataServiceWrapper handles the initializing and shutting down and of |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // Our database service. | 94 // Our database service. |
94 scoped_refptr<WebDatabaseService> wdbs_; | 95 scoped_refptr<WebDatabaseService> wdbs_; |
95 | 96 |
96 private: | 97 private: |
97 ProfileErrorCallback profile_error_callback_; | 98 ProfileErrorCallback profile_error_callback_; |
98 | 99 |
99 DISALLOW_COPY_AND_ASSIGN(WebDataServiceBase); | 100 DISALLOW_COPY_AND_ASSIGN(WebDataServiceBase); |
100 }; | 101 }; |
101 | 102 |
102 #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_BASE_H_ | 103 #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_BASE_H_ |
OLD | NEW |