| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_HISTORY_CORE_BROWSER_TYPED_URL_DATA_TYPE_CONTROLLER_H__ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_TYPED_URL_DATA_TYPE_CONTROLLER_H__ |
| 6 #define COMPONENTS_HISTORY_CORE_BROWSER_TYPED_URL_DATA_TYPE_CONTROLLER_H__ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_TYPED_URL_DATA_TYPE_CONTROLLER_H__ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/task/cancelable_task_tracker.h" | 12 #include "base/task/cancelable_task_tracker.h" |
| 13 #include "components/prefs/pref_change_registrar.h" | 13 #include "components/prefs/pref_change_registrar.h" |
| 14 #include "components/sync/driver/non_ui_data_type_controller.h" | 14 #include "components/sync/driver/async_directory_type_controller.h" |
| 15 #include "components/sync/driver/sync_api_component_factory.h" | 15 #include "components/sync/driver/sync_api_component_factory.h" |
| 16 | 16 |
| 17 namespace browser_sync { | 17 namespace browser_sync { |
| 18 | 18 |
| 19 // A class that manages the startup and shutdown of typed_url sync. | 19 // A class that manages the startup and shutdown of typed_url sync. |
| 20 class TypedUrlDataTypeController : public syncer::NonUIDataTypeController { | 20 class TypedUrlDataTypeController : public syncer::AsyncDirectoryTypeController { |
| 21 public: | 21 public: |
| 22 // |dump_stack| is called when an unrecoverable error occurs. | 22 // |dump_stack| is called when an unrecoverable error occurs. |
| 23 TypedUrlDataTypeController(const base::Closure& dump_stack, | 23 TypedUrlDataTypeController(const base::Closure& dump_stack, |
| 24 syncer::SyncClient* sync_client, | 24 syncer::SyncClient* sync_client, |
| 25 const char* history_disabled_pref_name); | 25 const char* history_disabled_pref_name); |
| 26 ~TypedUrlDataTypeController() override; | 26 ~TypedUrlDataTypeController() override; |
| 27 | 27 |
| 28 // NonUIDataTypeController implementation. | 28 // AsyncDirectoryTypeController implementation. |
| 29 bool ReadyForStart() const override; | 29 bool ReadyForStart() const override; |
| 30 | 30 |
| 31 protected: | 31 protected: |
| 32 // NonUIDataTypeController implementation. | 32 // AsyncDirectoryTypeController implementation. |
| 33 bool PostTaskOnModelThread(const tracked_objects::Location& from_here, | 33 bool PostTaskOnModelThread(const tracked_objects::Location& from_here, |
| 34 const base::Closure& task) override; | 34 const base::Closure& task) override; |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 void OnSavingBrowserHistoryDisabledChanged(); | 37 void OnSavingBrowserHistoryDisabledChanged(); |
| 38 | 38 |
| 39 // Name of the pref that indicates whether saving history is disabled. | 39 // Name of the pref that indicates whether saving history is disabled. |
| 40 const char* history_disabled_pref_name_; | 40 const char* history_disabled_pref_name_; |
| 41 | 41 |
| 42 PrefChangeRegistrar pref_registrar_; | 42 PrefChangeRegistrar pref_registrar_; |
| 43 | 43 |
| 44 // Helper object to make sure we don't leave tasks running on the history | 44 // Helper object to make sure we don't leave tasks running on the history |
| 45 // thread. | 45 // thread. |
| 46 base::CancelableTaskTracker task_tracker_; | 46 base::CancelableTaskTracker task_tracker_; |
| 47 | 47 |
| 48 syncer::SyncClient* const sync_client_; | 48 syncer::SyncClient* const sync_client_; |
| 49 | 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(TypedUrlDataTypeController); | 50 DISALLOW_COPY_AND_ASSIGN(TypedUrlDataTypeController); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 } // namespace browser_sync | 53 } // namespace browser_sync |
| 54 | 54 |
| 55 #endif // COMPONENTS_HISTORY_CORE_BROWSER_TYPED_URL_DATA_TYPE_CONTROLLER_H__ | 55 #endif // COMPONENTS_HISTORY_CORE_BROWSER_TYPED_URL_DATA_TYPE_CONTROLLER_H__ |
| OLD | NEW |