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"
13 struct DefaultSingletonTraits
;
14 class ShortcutsBackend
;
18 class ChromeBrowserState
;
20 // Singleton that owns all ShortcutsBackends and associates them with
21 // ios::ChromeBrowserState.
22 class ShortcutsBackendFactory
23 : public RefcountedBrowserStateKeyedServiceFactory
{
25 static scoped_refptr
<ShortcutsBackend
> GetForBrowserState(
26 ios::ChromeBrowserState
* browser_state
);
27 static scoped_refptr
<ShortcutsBackend
> GetForBrowserStateIfExists(
28 ios::ChromeBrowserState
* browser_state
);
29 static ShortcutsBackendFactory
* GetInstance();
32 friend struct DefaultSingletonTraits
<ShortcutsBackendFactory
>;
34 ShortcutsBackendFactory();
35 ~ShortcutsBackendFactory() override
;
37 // BrowserStateKeyedServiceFactory implementation.
38 scoped_refptr
<RefcountedKeyedService
> BuildServiceInstanceFor(
39 web::BrowserState
* context
) const override
;
40 bool ServiceIsNULLWhileTesting() const override
;
42 DISALLOW_COPY_AND_ASSIGN(ShortcutsBackendFactory
);
47 #endif // IOS_CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_BACKEND_FACTORY_H_