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

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: Fix component build & gn build 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 WebDataServices
36 // so that they can be associated with a context.
37 class WEBDATA_SERVICES_EXPORT WebDataServiceWrapper : public KeyedService {
38 public:
39 // ErrorType indicates which service encountered an error loading its data.
40 enum ErrorType {
41 ERROR_LOADING_AUTOFILL,
42 ERROR_LOADING_KEYWORD,
43 ERROR_LOADING_TOKEN,
44 ERROR_LOADING_PASSWORD,
45 };
46
47 // Shows an error message if a loading error occurs.
48 using ShowErrorCallback = void (*)(ErrorType, sql::InitStatus);
49
50 WebDataServiceWrapper(const base::FilePath& profile_path,
51 const std::string& application_locale,
52 const scoped_refptr<base::MessageLoopProxy>& ui_thread,
53 const scoped_refptr<base::MessageLoopProxy>& db_thread,
54 ShowErrorCallback show_error_callback);
55 ~WebDataServiceWrapper() override;
56
57 // For testing.
58 WebDataServiceWrapper();
59
60 // KeyedService:
61 void Shutdown() override;
62
63 // Create the various types of service instances. These methods are virtual
64 // for testing purpose.
65 virtual scoped_refptr<autofill::AutofillWebDataService> GetAutofillWebData();
66 virtual scoped_refptr<KeywordWebDataService> GetKeywordWebData();
67 virtual scoped_refptr<TokenWebData> GetTokenWebData();
68 #if defined(OS_WIN)
69 virtual scoped_refptr<PasswordWebDataService> GetPasswordWebData();
70 #endif
71
72 private:
73 scoped_refptr<WebDatabaseService> web_database_;
74
75 scoped_refptr<autofill::AutofillWebDataService> autofill_web_data_;
76 scoped_refptr<KeywordWebDataService> keyword_web_data_;
77 scoped_refptr<TokenWebData> token_web_data_;
78
79 #if defined(OS_WIN)
80 scoped_refptr<PasswordWebDataService> password_web_data_;
81 #endif
82
83 DISALLOW_COPY_AND_ASSIGN(WebDataServiceWrapper);
84 };
85
86 #endif // COMPONENTS_WEBDATA_SERVICES_WEB_DATA_SERVICE_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698