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/non_ui_data_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 history { | 17 namespace history { |
18 class HistoryBackend; | 18 class HistoryBackend; |
19 } | 19 } |
20 | 20 |
21 namespace browser_sync { | 21 namespace browser_sync { |
22 | 22 |
23 class ControlTask; | 23 class ControlTask; |
24 | 24 |
25 // A class that manages the startup and shutdown of typed_url sync. | 25 // A class that manages the startup and shutdown of typed_url sync. |
26 class TypedUrlDataTypeController : public syncer::NonUIDataTypeController { | 26 class TypedUrlDataTypeController : public sync_driver::NonUIDataTypeController { |
27 public: | 27 public: |
28 // |dump_stack| is called when an unrecoverable error occurs. | 28 // |dump_stack| is called when an unrecoverable error occurs. |
29 TypedUrlDataTypeController(const base::Closure& dump_stack, | 29 TypedUrlDataTypeController(const base::Closure& dump_stack, |
30 syncer::SyncClient* sync_client, | 30 sync_driver::SyncClient* sync_client, |
31 const char* history_disabled_pref_name); | 31 const char* history_disabled_pref_name); |
32 ~TypedUrlDataTypeController() override; | 32 ~TypedUrlDataTypeController() override; |
33 | 33 |
34 // NonUIDataTypeController implementation | 34 // NonUIDataTypeController implementation |
35 syncer::ModelSafeGroup model_safe_group() const override; | 35 syncer::ModelSafeGroup model_safe_group() const override; |
36 bool ReadyForStart() const override; | 36 bool ReadyForStart() const override; |
37 | 37 |
38 protected: | 38 protected: |
39 // NonUIDataTypeController interface. | 39 // NonUIDataTypeController interface. |
40 bool PostTaskOnBackendThread(const tracked_objects::Location& from_here, | 40 bool PostTaskOnBackendThread(const tracked_objects::Location& from_here, |
41 const base::Closure& task) override; | 41 const base::Closure& task) override; |
42 | 42 |
43 private: | 43 private: |
44 void OnSavingBrowserHistoryDisabledChanged(); | 44 void OnSavingBrowserHistoryDisabledChanged(); |
45 | 45 |
46 // Name of the pref that indicates whether saving history is disabled. | 46 // Name of the pref that indicates whether saving history is disabled. |
47 const char* history_disabled_pref_name_; | 47 const char* history_disabled_pref_name_; |
48 | 48 |
49 PrefChangeRegistrar pref_registrar_; | 49 PrefChangeRegistrar pref_registrar_; |
50 | 50 |
51 // Helper object to make sure we don't leave tasks running on the history | 51 // Helper object to make sure we don't leave tasks running on the history |
52 // thread. | 52 // thread. |
53 base::CancelableTaskTracker task_tracker_; | 53 base::CancelableTaskTracker task_tracker_; |
54 | 54 |
55 syncer::SyncClient* const sync_client_; | 55 sync_driver::SyncClient* const sync_client_; |
56 | 56 |
57 DISALLOW_COPY_AND_ASSIGN(TypedUrlDataTypeController); | 57 DISALLOW_COPY_AND_ASSIGN(TypedUrlDataTypeController); |
58 }; | 58 }; |
59 | 59 |
60 } // namespace browser_sync | 60 } // namespace browser_sync |
61 | 61 |
62 #endif // COMPONENTS_HISTORY_CORE_BROWSER_TYPED_URL_DATA_TYPE_CONTROLLER_H__ | 62 #endif // COMPONENTS_HISTORY_CORE_BROWSER_TYPED_URL_DATA_TYPE_CONTROLLER_H__ |
OLD | NEW |