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