OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // Chromium settings and storage represent user-selected preferences and | 5 // Chromium settings and storage represent user-selected preferences and |
6 // information and MUST not be extracted, overwritten or modified except | 6 // information and MUST not be extracted, overwritten or modified except |
7 // through Chromium defined APIs. | 7 // through Chromium defined APIs. |
8 | 8 |
9 #ifndef COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_SERVICE_H_ | 9 #ifndef COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_SERVICE_H_ |
10 #define COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_SERVICE_H_ | 10 #define COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_SERVICE_H_ |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "components/webdata/common/web_data_service_base.h" | 18 #include "components/webdata/common/web_data_service_base.h" |
19 #include "components/webdata/common/web_database.h" | 19 #include "components/webdata/common/web_database.h" |
| 20 #include "components/webdata/common/webdata_export.h" |
20 | 21 |
21 class WebDataServiceBackend; | 22 class WebDataServiceBackend; |
22 class WebDataRequestManager; | 23 class WebDataRequestManager; |
23 | 24 |
24 namespace content { | 25 namespace content { |
25 class BrowserContext; | 26 class BrowserContext; |
26 } | 27 } |
27 | 28 |
28 namespace tracked_objects { | 29 namespace tracked_objects { |
29 class Location; | 30 class Location; |
30 } | 31 } |
31 | 32 |
32 class WDTypedResult; | 33 class WDTypedResult; |
33 class WebDataServiceConsumer; | 34 class WebDataServiceConsumer; |
34 | 35 |
35 | 36 |
36 //////////////////////////////////////////////////////////////////////////////// | 37 //////////////////////////////////////////////////////////////////////////////// |
37 // | 38 // |
38 // WebDatabaseService defines the interface to a generic data repository | 39 // WebDatabaseService defines the interface to a generic data repository |
39 // responsible for controlling access to the web database (metadata associated | 40 // responsible for controlling access to the web database (metadata associated |
40 // with web pages). | 41 // with web pages). |
41 // | 42 // |
42 //////////////////////////////////////////////////////////////////////////////// | 43 //////////////////////////////////////////////////////////////////////////////// |
43 | 44 |
44 class WebDatabaseService | 45 class WEBDATA_EXPORT WebDatabaseService |
45 : public base::RefCountedThreadSafe< | 46 : public base::RefCountedThreadSafe< |
46 WebDatabaseService, | 47 WebDatabaseService, |
47 content::BrowserThread::DeleteOnUIThread> { | 48 content::BrowserThread::DeleteOnUIThread> { |
48 public: | 49 public: |
49 typedef base::Callback<scoped_ptr<WDTypedResult>(WebDatabase*)> ReadTask; | 50 typedef base::Callback<scoped_ptr<WDTypedResult>(WebDatabase*)> ReadTask; |
50 typedef base::Callback<WebDatabase::State(WebDatabase*)> WriteTask; | 51 typedef base::Callback<WebDatabase::State(WebDatabase*)> WriteTask; |
51 typedef base::Callback<void(sql::InitStatus)> InitCallback; | 52 typedef base::Callback<void(sql::InitStatus)> InitCallback; |
52 | 53 |
53 // Takes the path to the WebDatabase file. | 54 // Takes the path to the WebDatabase file. |
54 explicit WebDatabaseService(const base::FilePath& path); | 55 explicit WebDatabaseService(const base::FilePath& path); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 87 |
87 // Cancel an existing request for a task on the DB thread. | 88 // Cancel an existing request for a task on the DB thread. |
88 // TODO(caitkp): Think about moving the definition of the Handle type to | 89 // TODO(caitkp): Think about moving the definition of the Handle type to |
89 // somewhere else. | 90 // somewhere else. |
90 virtual void CancelRequest(WebDataServiceBase::Handle h); | 91 virtual void CancelRequest(WebDataServiceBase::Handle h); |
91 | 92 |
92 private: | 93 private: |
93 friend struct content::BrowserThread::DeleteOnThread< | 94 friend struct content::BrowserThread::DeleteOnThread< |
94 content::BrowserThread::UI>; | 95 content::BrowserThread::UI>; |
95 friend class base::DeleteHelper<WebDatabaseService>; | 96 friend class base::DeleteHelper<WebDatabaseService>; |
| 97 // We have to friend RCTS<> so WIN shared-lib build is happy (crbug/112250). |
| 98 friend class base::RefCountedThreadSafe<WebDatabaseService, |
| 99 content::BrowserThread::DeleteOnUIThread>; |
96 | 100 |
97 virtual ~WebDatabaseService(); | 101 virtual ~WebDatabaseService(); |
98 | 102 |
99 base::FilePath path_; | 103 base::FilePath path_; |
100 | 104 |
101 // The primary owner is |WebDatabaseService| but is refcounted because | 105 // The primary owner is |WebDatabaseService| but is refcounted because |
102 // PostTask on DB thread may outlive us. | 106 // PostTask on DB thread may outlive us. |
103 scoped_refptr<WebDataServiceBackend> wds_backend_; | 107 scoped_refptr<WebDataServiceBackend> wds_backend_; |
104 }; | 108 }; |
105 | 109 |
106 #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_SERVICE_H_ | 110 #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_SERVICE_H_ |
OLD | NEW |