Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(648)

Side by Side Diff: chrome/browser/webdata/web_database_service.h

Issue 12695015: Split Autofill webdata (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Convert all Autofill/Sync clients of WDS to using AutofillWDS Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 CHROME_BROWSER_WEBDATA_WEB_DATABASE_SERVICE_H_ 9 #ifndef CHROME_BROWSER_WEBDATA_WEB_DATABASE_SERVICE_H_
10 #define CHROME_BROWSER_WEBDATA_WEB_DATABASE_SERVICE_H_ 10 #define CHROME_BROWSER_WEBDATA_WEB_DATABASE_SERVICE_H_
(...skipping 23 matching lines...) Expand all
34 34
35 35
36 //////////////////////////////////////////////////////////////////////////////// 36 ////////////////////////////////////////////////////////////////////////////////
37 // 37 //
38 // WebDatabaseService defines the interface to a generic data repository 38 // WebDatabaseService defines the interface to a generic data repository
39 // responsible for controlling access to the web database (metadata associated 39 // responsible for controlling access to the web database (metadata associated
40 // with web pages). 40 // with web pages).
41 // 41 //
42 //////////////////////////////////////////////////////////////////////////////// 42 ////////////////////////////////////////////////////////////////////////////////
43 43
44 class WebDatabaseService { 44 class WebDatabaseService : public base::RefCountedThreadSafe<WebDatabaseService,
45 content::BrowserThread::DeleteOnUIThread> {
Jói 2013/03/20 23:09:10 nit: Indentation of the template parameters; would
Cait (Slow) 2013/03/21 23:23:27 Done.
45 public: 46 public:
46 typedef base::Callback<scoped_ptr<WDTypedResult>(WebDatabase*)> ReadTask; 47 typedef base::Callback<scoped_ptr<WDTypedResult>(WebDatabase*)> ReadTask;
47 typedef base::Callback<WebDatabase::State(WebDatabase*)> WriteTask; 48 typedef base::Callback<WebDatabase::State(WebDatabase*)> WriteTask;
48 typedef base::Callback<void(sql::InitStatus)> InitCallback; 49 typedef base::Callback<void(sql::InitStatus)> InitCallback;
49 50
50 // Takes the path to the WebDatabase file. 51 // Takes the path to the WebDatabase file.
51 explicit WebDatabaseService(const base::FilePath& path); 52 explicit WebDatabaseService(const base::FilePath& path);
52 53
53 virtual ~WebDatabaseService();
54
55 // Adds |table| as a WebDatabaseTable that will participate in 54 // Adds |table| as a WebDatabaseTable that will participate in
56 // managing the database, transferring ownership. All calls to this 55 // managing the database, transferring ownership. All calls to this
57 // method must be made before |LoadDatabase| is called. 56 // method must be made before |LoadDatabase| is called.
58 virtual void AddTable(scoped_ptr<WebDatabaseTable> table); 57 virtual void AddTable(scoped_ptr<WebDatabaseTable> table);
59 58
60 // Initializes the web database service. Takes a callback which will return 59 // Initializes the web database service. Takes a callback which will return
61 // the status of the DB after the init. 60 // the status of the DB after the init.
62 virtual void LoadDatabase(const InitCallback& callback); 61 virtual void LoadDatabase(const InitCallback& callback);
63 62
64 // Unloads the database without actually shutting down the service. This can 63 // Unloads the database without actually shutting down the service. This can
(...skipping 17 matching lines...) Expand all
82 const tracked_objects::Location& from_here, 81 const tracked_objects::Location& from_here,
83 const ReadTask& task, 82 const ReadTask& task,
84 WebDataServiceConsumer* consumer); 83 WebDataServiceConsumer* consumer);
85 84
86 // Cancel an existing request for a task on the DB thread. 85 // Cancel an existing request for a task on the DB thread.
87 // TODO(caitkp): Think about moving the definition of the Handle type to 86 // TODO(caitkp): Think about moving the definition of the Handle type to
88 // somewhere else. 87 // somewhere else.
89 virtual void CancelRequest(WebDataServiceBase::Handle h); 88 virtual void CancelRequest(WebDataServiceBase::Handle h);
90 89
91 private: 90 private:
91 friend struct content::BrowserThread::DeleteOnThread<
92 content::BrowserThread::UI>;
93 friend class base::DeleteHelper<WebDatabaseService>;
94
95 virtual ~WebDatabaseService();
96
92 base::FilePath path_; 97 base::FilePath path_;
93 98
94 // The primary owner is |WebDatabaseService| but is refcounted because 99 // The primary owner is |WebDatabaseService| but is refcounted because
95 // PostTask on DB thread may outlive us. 100 // PostTask on DB thread may outlive us.
96 scoped_refptr<WebDataServiceBackend> wds_backend_; 101 scoped_refptr<WebDataServiceBackend> wds_backend_;
97 }; 102 };
98 103
99 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_SERVICE_H_ 104 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698