1 // Copyright 2018 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 IOS_WEB_VIEW_INTERNAL_PASSWORDS_WEB_VIEW_PASSWORD_MANAGER_LOG_ROUTER_FACTORY_H_
6 #define IOS_WEB_VIEW_INTERNAL_PASSWORDS_WEB_VIEW_PASSWORD_MANAGER_LOG_ROUTER_FACTORY_H_
7 
8 #include "base/macros.h"
9 #include "base/no_destructor.h"
10 #include "components/keyed_service/ios/browser_state_keyed_service_factory.h"
11 
12 namespace autofill {
13 class LogRouter;
14 }
15 
16 namespace ios_web_view {
17 class WebViewBrowserState;
18 
19 // Singleton that owns all PasswordStores and associates them with
20 // WebViewBrowserState.
21 class WebViewPasswordManagerLogRouterFactory
22     : public BrowserStateKeyedServiceFactory {
23  public:
24   static autofill::LogRouter* GetForBrowserState(
25       WebViewBrowserState* browser_state);
26 
27   static WebViewPasswordManagerLogRouterFactory* GetInstance();
28 
29  private:
30   friend class base::NoDestructor<WebViewPasswordManagerLogRouterFactory>;
31 
32   WebViewPasswordManagerLogRouterFactory();
33   ~WebViewPasswordManagerLogRouterFactory() override;
34 
35   // BrowserStateKeyedServiceFactory:
36   std::unique_ptr<KeyedService> BuildServiceInstanceFor(
37       web::BrowserState* context) const override;
38 
39   DISALLOW_COPY_AND_ASSIGN(WebViewPasswordManagerLogRouterFactory);
40 };
41 
42 }  // namespace ios_web_view
43 
44 #endif  // IOS_WEB_VIEW_INTERNAL_PASSWORDS_WEB_VIEW_PASSWORD_MANAGER_LOG_ROUTER_FACTORY_H_
45