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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: components/webdata_services/web_data_service_wrapper.h
diff --git a/components/webdata_services/web_data_service_wrapper.h b/components/webdata_services/web_data_service_wrapper.h
new file mode 100644
index 0000000000000000000000000000000000000000..8a7c1255f1765e7cc2d1e9d06716ebc4494077f3
--- /dev/null
+++ b/components/webdata_services/web_data_service_wrapper.h
@@ -0,0 +1,97 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_WEBDATA_SERVICES_WEB_DATA_SERVICE_WRAPPER_H_
+#define COMPONENTS_WEBDATA_SERVICES_WEB_DATA_SERVICE_WRAPPER_H_
+
+#include <string>
+
+#include "base/callback_forward.h"
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "components/keyed_service/core/keyed_service.h"
+#include "components/webdata_services/webdata_services_export.h"
+#include "sql/init_status.h"
+
+class KeywordWebDataService;
+class TokenWebData;
+class WebDatabaseService;
+
+#if defined(OS_WIN)
+class PasswordWebDataService;
+#endif
+
+namespace autofill {
+class AutofillWebDataBackend;
+class AutofillWebDataService;
+} // namespace autofill
+
+namespace base {
+class FilePath;
+class MessageLoopProxy;
+} // namespace base
+
+// 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.
+// so that they can be associated with a context.
+class WEBDATA_SERVICES_EXPORT WebDataServiceWrapper : public KeyedService {
+ public:
+ // 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.
+ // loading its data.
+ enum ErrorType {
+ 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.
+ ERROR_DB_KEYWORD_WEB_DATA,
+ ERROR_DB_TOKEN_WEB_DATA,
+ ERROR_DB_PASSWORD_WEB_DATA,
+ };
+
+ // Presents an error message corresponding to the inability of loading
+ // 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.
+ using ShowErrorCallback = void (*)(ErrorType, sql::InitStatus);
+
+ WebDataServiceWrapper(const base::FilePath& profile_path,
+ const std::string& application_locale,
+ const scoped_refptr<base::MessageLoopProxy>& ui_thread,
+ const scoped_refptr<base::MessageLoopProxy>& db_thread,
+ ShowErrorCallback show_error_callback);
+ ~WebDataServiceWrapper() override;
+
+ // For testing.
+ WebDataServiceWrapper();
+
+ // KeyedService:
+ void Shutdown() override;
+
+ // Returns an autofill::AutofillWebDataService web-data service instance.
+ // (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.
+ virtual scoped_refptr<autofill::AutofillWebDataService> GetAutofillWebData();
+
+ // Returns a KeywordWebDataService web-data service instance.
+ // (virtual for testing)
+ virtual scoped_refptr<KeywordWebDataService> GetKeywordWebData();
+
+ // Returns a TokenWebData web-data service instance.
+ // (virtual for testing)
+ virtual scoped_refptr<TokenWebData> GetTokenWebData();
+
+#if defined(OS_WIN)
+ // Returns a PasswordWebDataService web-data service instance.
+ // (virtual for testing)
+ virtual scoped_refptr<PasswordWebDataService> GetPasswordWebData();
+#endif
+
+ private:
+ scoped_refptr<WebDatabaseService> web_database_;
+
+ scoped_refptr<autofill::AutofillWebDataService> autofill_web_data_;
+ scoped_refptr<KeywordWebDataService> keyword_web_data_;
+ scoped_refptr<TokenWebData> token_web_data_;
+
+#if defined(OS_WIN)
+ scoped_refptr<PasswordWebDataService> password_web_data_;
+#endif
+
+ DISALLOW_COPY_AND_ASSIGN(WebDataServiceWrapper);
+};
+
+#endif // COMPONENTS_WEBDATA_SERVICES_WEB_DATA_SERVICE_WRAPPER_H_

Powered by Google App Engine
This is Rietveld 408576698