OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_SERVICES_WEB_DATA_SERVICE_WRAPPER_H_ | 5 #ifndef COMPONENTS_WEBDATA_SERVICES_WEB_DATA_SERVICE_WRAPPER_H_ |
6 #define COMPONENTS_WEBDATA_SERVICES_WEB_DATA_SERVICE_WRAPPER_H_ | 6 #define COMPONENTS_WEBDATA_SERVICES_WEB_DATA_SERVICE_WRAPPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class PasswordWebDataService; | 22 class PasswordWebDataService; |
23 #endif | 23 #endif |
24 | 24 |
25 namespace autofill { | 25 namespace autofill { |
26 class AutofillWebDataBackend; | 26 class AutofillWebDataBackend; |
27 class AutofillWebDataService; | 27 class AutofillWebDataService; |
28 } // namespace autofill | 28 } // namespace autofill |
29 | 29 |
30 namespace base { | 30 namespace base { |
31 class FilePath; | 31 class FilePath; |
32 class MessageLoopProxy; | 32 class SingleThreadTaskRunner; |
33 } // namespace base | 33 } // namespace base |
34 | 34 |
35 // WebDataServiceWrapper is a KeyedService that owns multiple WebDataServices | 35 // WebDataServiceWrapper is a KeyedService that owns multiple WebDataServices |
36 // so that they can be associated with a context. | 36 // so that they can be associated with a context. |
37 class WebDataServiceWrapper : public KeyedService { | 37 class WebDataServiceWrapper : public KeyedService { |
38 public: | 38 public: |
39 // ErrorType indicates which service encountered an error loading its data. | 39 // ErrorType indicates which service encountered an error loading its data. |
40 enum ErrorType { | 40 enum ErrorType { |
41 ERROR_LOADING_AUTOFILL, | 41 ERROR_LOADING_AUTOFILL, |
42 ERROR_LOADING_KEYWORD, | 42 ERROR_LOADING_KEYWORD, |
43 ERROR_LOADING_TOKEN, | 43 ERROR_LOADING_TOKEN, |
44 ERROR_LOADING_PASSWORD, | 44 ERROR_LOADING_PASSWORD, |
45 }; | 45 }; |
46 | 46 |
47 // Shows an error message if a loading error occurs. | 47 // Shows an error message if a loading error occurs. |
48 using ShowErrorCallback = void (*)(ErrorType, sql::InitStatus); | 48 using ShowErrorCallback = void (*)(ErrorType, sql::InitStatus); |
49 | 49 |
50 // Constructor for WebDataServiceWrapper that initializes the different | 50 // Constructor for WebDataServiceWrapper that initializes the different |
51 // WebDataServices and starts the synchronization services using |flare|. | 51 // WebDataServices and starts the synchronization services using |flare|. |
52 // Since |flare| will be copied and called multiple times, it cannot bind | 52 // Since |flare| will be copied and called multiple times, it cannot bind |
53 // values using base::Owned nor base::Passed; it should only bind simple or | 53 // values using base::Owned nor base::Passed; it should only bind simple or |
54 // refcounted types. | 54 // refcounted types. |
55 WebDataServiceWrapper(const base::FilePath& context_path, | 55 WebDataServiceWrapper( |
56 const std::string& application_locale, | 56 const base::FilePath& context_path, |
57 const scoped_refptr<base::MessageLoopProxy>& ui_thread, | 57 const std::string& application_locale, |
58 const scoped_refptr<base::MessageLoopProxy>& db_thread, | 58 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread, |
59 const syncer::SyncableService::StartSyncFlare& flare, | 59 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, |
60 ShowErrorCallback show_error_callback); | 60 const syncer::SyncableService::StartSyncFlare& flare, |
| 61 ShowErrorCallback show_error_callback); |
61 ~WebDataServiceWrapper() override; | 62 ~WebDataServiceWrapper() override; |
62 | 63 |
63 // For testing. | 64 // For testing. |
64 WebDataServiceWrapper(); | 65 WebDataServiceWrapper(); |
65 | 66 |
66 // KeyedService: | 67 // KeyedService: |
67 void Shutdown() override; | 68 void Shutdown() override; |
68 | 69 |
69 // Create the various types of service instances. These methods are virtual | 70 // Create the various types of service instances. These methods are virtual |
70 // for testing purpose. | 71 // for testing purpose. |
(...skipping 12 matching lines...) Expand all Loading... |
83 scoped_refptr<TokenWebData> token_web_data_; | 84 scoped_refptr<TokenWebData> token_web_data_; |
84 | 85 |
85 #if defined(OS_WIN) | 86 #if defined(OS_WIN) |
86 scoped_refptr<PasswordWebDataService> password_web_data_; | 87 scoped_refptr<PasswordWebDataService> password_web_data_; |
87 #endif | 88 #endif |
88 | 89 |
89 DISALLOW_COPY_AND_ASSIGN(WebDataServiceWrapper); | 90 DISALLOW_COPY_AND_ASSIGN(WebDataServiceWrapper); |
90 }; | 91 }; |
91 | 92 |
92 #endif // COMPONENTS_WEBDATA_SERVICES_WEB_DATA_SERVICE_WRAPPER_H_ | 93 #endif // COMPONENTS_WEBDATA_SERVICES_WEB_DATA_SERVICE_WRAPPER_H_ |
OLD | NEW |