OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 COMPONENTS_SEARCH_ENGINES_SEARCH_ENGINE_DATA_TYPE_CONTROLLER_H__ | 5 #ifndef COMPONENTS_SEARCH_ENGINES_SEARCH_ENGINE_DATA_TYPE_CONTROLLER_H__ |
6 #define COMPONENTS_SEARCH_ENGINES_SEARCH_ENGINE_DATA_TYPE_CONTROLLER_H__ | 6 #define COMPONENTS_SEARCH_ENGINES_SEARCH_ENGINE_DATA_TYPE_CONTROLLER_H__ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "components/search_engines/template_url_service.h" | 12 #include "components/search_engines/template_url_service.h" |
13 #include "components/sync/driver/non_ui_data_type_controller.h" | 13 #include "components/sync/driver/async_directory_type_controller.h" |
14 | 14 |
15 namespace browser_sync { | 15 namespace browser_sync { |
16 | 16 |
17 // Controller for the SEARCH_ENGINES sync data type. This class tells sync | 17 // Controller for the SEARCH_ENGINES sync data type. This class tells sync |
18 // how to load the model for this data type, and the superclasses manage | 18 // how to load the model for this data type, and the superclasses manage |
19 // controlling the rest of the state of the datatype with regards to sync. | 19 // controlling the rest of the state of the datatype with regards to sync. |
20 class SearchEngineDataTypeController : public syncer::NonUIDataTypeController { | 20 class SearchEngineDataTypeController |
| 21 : public syncer::AsyncDirectoryTypeController { |
21 public: | 22 public: |
22 // |dump_stack| is called when an unrecoverable error occurs. | 23 // |dump_stack| is called when an unrecoverable error occurs. |
23 SearchEngineDataTypeController(const base::Closure& dump_stack, | 24 SearchEngineDataTypeController(const base::Closure& dump_stack, |
24 syncer::SyncClient* sync_client, | 25 syncer::SyncClient* sync_client, |
25 TemplateURLService* template_url_service); | 26 TemplateURLService* template_url_service); |
26 ~SearchEngineDataTypeController() override; | 27 ~SearchEngineDataTypeController() override; |
27 | 28 |
28 TemplateURLService::Subscription* GetSubscriptionForTesting(); | 29 TemplateURLService::Subscription* GetSubscriptionForTesting(); |
29 | 30 |
30 private: | 31 private: |
31 // NonUIDataTypeController: | 32 // AsyncDirectoryTypeController: |
32 bool StartModels() override; | 33 bool StartModels() override; |
33 void StopModels() override; | 34 void StopModels() override; |
34 | 35 |
35 void OnTemplateURLServiceLoaded(); | 36 void OnTemplateURLServiceLoaded(); |
36 | 37 |
37 // A pointer to the template URL service that this data type will use. | 38 // A pointer to the template URL service that this data type will use. |
38 TemplateURLService* template_url_service_; | 39 TemplateURLService* template_url_service_; |
39 | 40 |
40 // A subscription to the OnLoadedCallback so it can be cleared if necessary. | 41 // A subscription to the OnLoadedCallback so it can be cleared if necessary. |
41 std::unique_ptr<TemplateURLService::Subscription> template_url_subscription_; | 42 std::unique_ptr<TemplateURLService::Subscription> template_url_subscription_; |
42 | 43 |
43 DISALLOW_COPY_AND_ASSIGN(SearchEngineDataTypeController); | 44 DISALLOW_COPY_AND_ASSIGN(SearchEngineDataTypeController); |
44 }; | 45 }; |
45 | 46 |
46 } // namespace browser_sync | 47 } // namespace browser_sync |
47 | 48 |
48 #endif // COMPONENTS_SEARCH_ENGINES_SEARCH_ENGINE_DATA_TYPE_CONTROLLER_H__ | 49 #endif // COMPONENTS_SEARCH_ENGINES_SEARCH_ENGINE_DATA_TYPE_CONTROLLER_H__ |
OLD | NEW |