Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ios / chrome / browser / autocomplete / shortcuts_backend_factory.h
blob68fda57a6d71d8353ebd5590d65a0e7d793765a9
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"
12 namespace base {
13 template <typename T>
14 struct DefaultSingletonTraits;
15 } // namespace base
17 class ShortcutsBackend;
19 namespace ios {
21 class ChromeBrowserState;
23 // Singleton that owns all ShortcutsBackends and associates them with
24 // ios::ChromeBrowserState.
25 class ShortcutsBackendFactory
26 : public RefcountedBrowserStateKeyedServiceFactory {
27 public:
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();
34 private:
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);
48 } // namespace ios
50 #endif // IOS_CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_BACKEND_FACTORY_H_