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_PASSWORD_MANAGER_SYNC_BROWSER_PASSWORD_DATA_TYPE_CONTROLLER_H
__ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_PASSWORD_DATA_TYPE_CONTROLLER_H
__ |
6 #define COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_PASSWORD_DATA_TYPE_CONTROLLER_H
__ | 6 #define COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_PASSWORD_DATA_TYPE_CONTROLLER_H
__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "components/sync/driver/non_ui_data_type_controller.h" | 11 #include "components/sync/driver/async_directory_type_controller.h" |
12 #include "components/sync/driver/sync_service_observer.h" | 12 #include "components/sync/driver/sync_service_observer.h" |
13 | 13 |
14 namespace password_manager { | 14 namespace password_manager { |
15 class PasswordStore; | 15 class PasswordStore; |
16 } | 16 } |
17 | 17 |
18 namespace syncer { | 18 namespace syncer { |
19 class SyncClient; | 19 class SyncClient; |
20 } | 20 } |
21 | 21 |
22 namespace browser_sync { | 22 namespace browser_sync { |
23 | 23 |
24 // A class that manages the startup and shutdown of password sync. | 24 // A class that manages the startup and shutdown of password sync. |
25 class PasswordDataTypeController : public syncer::NonUIDataTypeController, | 25 class PasswordDataTypeController : public syncer::AsyncDirectoryTypeController, |
26 public syncer::SyncServiceObserver { | 26 public syncer::SyncServiceObserver { |
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 PasswordDataTypeController( | 29 PasswordDataTypeController( |
30 const base::Closure& dump_stack, | 30 const base::Closure& dump_stack, |
31 syncer::SyncClient* sync_client, | 31 syncer::SyncClient* sync_client, |
32 const base::Closure& state_changed_callback, | 32 const base::Closure& state_changed_callback, |
33 const scoped_refptr<password_manager::PasswordStore>& password_store); | 33 const scoped_refptr<password_manager::PasswordStore>& password_store); |
34 ~PasswordDataTypeController() override; | 34 ~PasswordDataTypeController() override; |
35 | 35 |
36 protected: | 36 protected: |
37 // NonUIDataTypeController interface. | 37 // AsyncDirectoryTypeController interface. |
38 bool PostTaskOnModelThread(const tracked_objects::Location& from_here, | 38 bool PostTaskOnModelThread(const tracked_objects::Location& from_here, |
39 const base::Closure& task) override; | 39 const base::Closure& task) override; |
40 bool StartModels() override; | 40 bool StartModels() override; |
41 void StopModels() override; | 41 void StopModels() override; |
42 | 42 |
43 // syncer::SyncServiceObserver: | 43 // syncer::SyncServiceObserver: |
44 void OnStateChanged() override; | 44 void OnStateChanged() override; |
45 | 45 |
46 private: | 46 private: |
47 syncer::SyncClient* const sync_client_; | 47 syncer::SyncClient* const sync_client_; |
48 const base::Closure state_changed_callback_; | 48 const base::Closure state_changed_callback_; |
49 scoped_refptr<password_manager::PasswordStore> password_store_; | 49 scoped_refptr<password_manager::PasswordStore> password_store_; |
50 | 50 |
51 DISALLOW_COPY_AND_ASSIGN(PasswordDataTypeController); | 51 DISALLOW_COPY_AND_ASSIGN(PasswordDataTypeController); |
52 }; | 52 }; |
53 | 53 |
54 } // namespace browser_sync | 54 } // namespace browser_sync |
55 | 55 |
56 #endif // COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_PASSWORD_DATA_TYPE_CONTROLLE
R_H__ | 56 #endif // COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_PASSWORD_DATA_TYPE_CONTROLLE
R_H__ |
OLD | NEW |