1 // Copyright 2015 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.
5 #ifndef IOS_CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_BACKEND_FACTORY_H_
6 #define IOS_CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_BACKEND_FACTORY_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "components/keyed_service/ios/refcounted_browser_state_keyed_service_factory.h"
14 struct DefaultSingletonTraits
;
17 class ShortcutsBackend
;
21 class ChromeBrowserState
;
23 // Singleton that owns all ShortcutsBackends and associates them with
24 // ios::ChromeBrowserState.
25 class ShortcutsBackendFactory
26 : public RefcountedBrowserStateKeyedServiceFactory
{
28 static scoped_refptr
<ShortcutsBackend
> GetForBrowserState(
29 ios::ChromeBrowserState
* browser_state
);
30 static scoped_refptr
<ShortcutsBackend
> GetForBrowserStateIfExists(
31 ios::ChromeBrowserState
* browser_state
);
32 static ShortcutsBackendFactory
* GetInstance();
35 friend struct base::DefaultSingletonTraits
<ShortcutsBackendFactory
>;
37 ShortcutsBackendFactory();
38 ~ShortcutsBackendFactory() override
;
40 // BrowserStateKeyedServiceFactory implementation.
41 scoped_refptr
<RefcountedKeyedService
> BuildServiceInstanceFor(
42 web::BrowserState
* context
) const override
;
43 bool ServiceIsNULLWhileTesting() const override
;
45 DISALLOW_COPY_AND_ASSIGN(ShortcutsBackendFactory
);
50 #endif // IOS_CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_BACKEND_FACTORY_H_