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

Side by Side Diff: components/webdata_services/web_data_service_wrapper.h

Issue 777863002: Introduce new component webdata_services (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary DEPS on //ui, sort dependencies Created 6 years 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
OLDNEW
(Empty)
1 // Copyright 2014 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 COMPONENTS_WEBDATA_SERVICES_WEB_DATA_SERVICE_WRAPPER_H_
6 #define COMPONENTS_WEBDATA_SERVICES_WEB_DATA_SERVICE_WRAPPER_H_
7
8 #include <string>
9
10 #include "base/callback_forward.h"
11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "components/keyed_service/core/keyed_service.h"
14 #include "components/webdata_services/webdata_services_export.h"
15 #include "sql/init_status.h"
16
17 class KeywordWebDataService;
18 class TokenWebData;
19 class WebDatabaseService;
20
21 #if defined(OS_WIN)
22 class PasswordWebDataService;
23 #endif
24
25 namespace autofill {
26 class AutofillWebDataBackend;
27 class AutofillWebDataService;
28 } // namespace autofill
29
30 namespace base {
31 class FilePath;
32 class MessageLoopProxy;
33 } // namespace base
34
35 // WebDataServiceWrapper is a KeyedService that owns multiple WebDataService
Peter Kasting 2014/12/05 21:47:56 Nit: multiple WebDataServices
sdefresne 2014/12/08 10:54:42 Done.
36 // so that they can be associated with a context.
37 class WEBDATA_SERVICES_EXPORT WebDataServiceWrapper : public KeyedService {
38 public:
39 // ErrorType indicates which web-data service encountered an error
Peter Kasting 2014/12/05 21:47:56 Nit: Remove "web-data"
sdefresne 2014/12/08 10:54:42 Done.
40 // loading its data.
41 enum ErrorType {
42 ERROR_DB_AUTOFILL_WEB_DATA,
Peter Kasting 2014/12/05 21:47:56 Nit: I wonder if "ERROR_LOADING_AUTOFILL" or the l
sdefresne 2014/12/08 10:54:42 Done.
sdefresne 2014/12/08 10:54:42 Done.
43 ERROR_DB_KEYWORD_WEB_DATA,
44 ERROR_DB_TOKEN_WEB_DATA,
45 ERROR_DB_PASSWORD_WEB_DATA,
46 };
47
48 // Presents an error message corresponding to the inability of loading
49 // some of the web-data service data.
Peter Kasting 2014/12/05 21:47:56 Nit: How about: "Shows an error message if a loadi
sdefresne 2014/12/08 10:54:42 Done.
50 using ShowErrorCallback = void (*)(ErrorType, sql::InitStatus);
51
52 WebDataServiceWrapper(const base::FilePath& profile_path,
53 const std::string& application_locale,
54 const scoped_refptr<base::MessageLoopProxy>& ui_thread,
55 const scoped_refptr<base::MessageLoopProxy>& db_thread,
56 ShowErrorCallback show_error_callback);
57 ~WebDataServiceWrapper() override;
58
59 // For testing.
60 WebDataServiceWrapper();
61
62 // KeyedService:
63 void Shutdown() override;
64
65 // Returns an autofill::AutofillWebDataService web-data service instance.
66 // (virtual for testing)
Peter Kasting 2014/12/05 21:47:56 Nit: I would remove this parenthetical note and th
sdefresne 2014/12/08 10:54:42 Done.
67 virtual scoped_refptr<autofill::AutofillWebDataService> GetAutofillWebData();
68
69 // Returns a KeywordWebDataService web-data service instance.
70 // (virtual for testing)
71 virtual scoped_refptr<KeywordWebDataService> GetKeywordWebData();
72
73 // Returns a TokenWebData web-data service instance.
74 // (virtual for testing)
75 virtual scoped_refptr<TokenWebData> GetTokenWebData();
76
77 #if defined(OS_WIN)
78 // Returns a PasswordWebDataService web-data service instance.
79 // (virtual for testing)
80 virtual scoped_refptr<PasswordWebDataService> GetPasswordWebData();
81 #endif
82
83 private:
84 scoped_refptr<WebDatabaseService> web_database_;
85
86 scoped_refptr<autofill::AutofillWebDataService> autofill_web_data_;
87 scoped_refptr<KeywordWebDataService> keyword_web_data_;
88 scoped_refptr<TokenWebData> token_web_data_;
89
90 #if defined(OS_WIN)
91 scoped_refptr<PasswordWebDataService> password_web_data_;
92 #endif
93
94 DISALLOW_COPY_AND_ASSIGN(WebDataServiceWrapper);
95 };
96
97 #endif // COMPONENTS_WEBDATA_SERVICES_WEB_DATA_SERVICE_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698