| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef IOS_CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_BACKEND_FACTORY_H_ | 5 #ifndef IOS_CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_BACKEND_FACTORY_H_ |
| 6 #define IOS_CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_BACKEND_FACTORY_H_ | 6 #define IOS_CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_BACKEND_FACTORY_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "components/keyed_service/ios/refcounted_browser_state_keyed_service_fa
ctory.h" | 10 #include "components/keyed_service/ios/refcounted_browser_state_keyed_service_fa
ctory.h" |
| 11 | 11 |
| 12 namespace base { |
| 12 template <typename T> | 13 template <typename T> |
| 13 struct DefaultSingletonTraits; | 14 struct DefaultSingletonTraits; |
| 15 } // namespace base |
| 16 |
| 14 class ShortcutsBackend; | 17 class ShortcutsBackend; |
| 15 | 18 |
| 16 namespace ios { | 19 namespace ios { |
| 17 | 20 |
| 18 class ChromeBrowserState; | 21 class ChromeBrowserState; |
| 19 | 22 |
| 20 // Singleton that owns all ShortcutsBackends and associates them with | 23 // Singleton that owns all ShortcutsBackends and associates them with |
| 21 // ios::ChromeBrowserState. | 24 // ios::ChromeBrowserState. |
| 22 class ShortcutsBackendFactory | 25 class ShortcutsBackendFactory |
| 23 : public RefcountedBrowserStateKeyedServiceFactory { | 26 : public RefcountedBrowserStateKeyedServiceFactory { |
| 24 public: | 27 public: |
| 25 static scoped_refptr<ShortcutsBackend> GetForBrowserState( | 28 static scoped_refptr<ShortcutsBackend> GetForBrowserState( |
| 26 ios::ChromeBrowserState* browser_state); | 29 ios::ChromeBrowserState* browser_state); |
| 27 static scoped_refptr<ShortcutsBackend> GetForBrowserStateIfExists( | 30 static scoped_refptr<ShortcutsBackend> GetForBrowserStateIfExists( |
| 28 ios::ChromeBrowserState* browser_state); | 31 ios::ChromeBrowserState* browser_state); |
| 29 static ShortcutsBackendFactory* GetInstance(); | 32 static ShortcutsBackendFactory* GetInstance(); |
| 30 | 33 |
| 31 private: | 34 private: |
| 32 friend struct DefaultSingletonTraits<ShortcutsBackendFactory>; | 35 friend struct base::DefaultSingletonTraits<ShortcutsBackendFactory>; |
| 33 | 36 |
| 34 ShortcutsBackendFactory(); | 37 ShortcutsBackendFactory(); |
| 35 ~ShortcutsBackendFactory() override; | 38 ~ShortcutsBackendFactory() override; |
| 36 | 39 |
| 37 // BrowserStateKeyedServiceFactory implementation. | 40 // BrowserStateKeyedServiceFactory implementation. |
| 38 scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor( | 41 scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor( |
| 39 web::BrowserState* context) const override; | 42 web::BrowserState* context) const override; |
| 40 bool ServiceIsNULLWhileTesting() const override; | 43 bool ServiceIsNULLWhileTesting() const override; |
| 41 | 44 |
| 42 DISALLOW_COPY_AND_ASSIGN(ShortcutsBackendFactory); | 45 DISALLOW_COPY_AND_ASSIGN(ShortcutsBackendFactory); |
| 43 }; | 46 }; |
| 44 | 47 |
| 45 } // namespace ios | 48 } // namespace ios |
| 46 | 49 |
| 47 #endif // IOS_CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_BACKEND_FACTORY_H_ | 50 #endif // IOS_CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_BACKEND_FACTORY_H_ |
| OLD | NEW |