OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_SYNC_GLUE_PASSWORD_DATA_TYPE_CONTROLLER_H__ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_PASSWORD_DATA_TYPE_CONTROLLER_H__ |
6 #define CHROME_BROWSER_SYNC_GLUE_PASSWORD_DATA_TYPE_CONTROLLER_H__ | 6 #define CHROME_BROWSER_SYNC_GLUE_PASSWORD_DATA_TYPE_CONTROLLER_H__ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | |
12 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
13 #include "base/synchronization/waitable_event.h" | 12 #include "chrome/browser/sync/glue/non_frontend_data_type_controller.h" |
14 #include "chrome/browser/sync/profile_sync_service.h" | |
15 #include "chrome/browser/sync/glue/data_type_controller.h" | |
16 | 13 |
17 class PasswordStore; | 14 class PasswordStore; |
18 class Profile; | |
19 class ProfileSyncFactory; | |
20 class ProfileSyncService; | |
21 | 15 |
22 namespace browser_sync { | 16 namespace browser_sync { |
23 | 17 |
24 class AssociatorInterface; | |
25 class ChangeProcessor; | |
26 class ControlTask; | |
27 | |
28 // A class that manages the startup and shutdown of password sync. | 18 // A class that manages the startup and shutdown of password sync. |
29 class PasswordDataTypeController : public DataTypeController { | 19 class PasswordDataTypeController : public NonFrontendDataTypeController { |
30 public: | 20 public: |
31 PasswordDataTypeController( | 21 PasswordDataTypeController( |
32 ProfileSyncFactory* profile_sync_factory, | 22 ProfileSyncFactory* profile_sync_factory, |
33 Profile* profile, | 23 Profile* profile, |
34 ProfileSyncService* sync_service); | 24 ProfileSyncService* sync_service); |
35 virtual ~PasswordDataTypeController(); | 25 virtual ~PasswordDataTypeController(); |
36 | 26 |
37 // DataTypeController implementation | 27 // NonFrontendDataTypeController implementation |
38 virtual void Start(StartCallback* start_callback); | |
39 | |
40 virtual void Stop(); | |
41 | |
42 virtual bool enabled(); | |
43 | |
44 virtual syncable::ModelType type() const; | 28 virtual syncable::ModelType type() const; |
45 | |
46 virtual browser_sync::ModelSafeGroup model_safe_group() const; | 29 virtual browser_sync::ModelSafeGroup model_safe_group() const; |
47 | 30 |
48 virtual std::string name() const; | 31 private: |
32 // NonFrontendDataTypeController interface. | |
tim (not reviewing)
2011/04/07 22:04:25
although I myself have once or twice enjoyed pulli
Nicolas Zea
2011/04/08 16:53:42
They're protected on the NonFrontendDataTypeContro
| |
33 virtual bool StartModels(); | |
34 virtual bool KickOffAssociation(); | |
35 virtual void CreateSyncComponents(); | |
36 virtual bool KickOffDestroy(); | |
37 virtual void RecordUnrecoverableError( | |
38 const tracked_objects::Location& from_here, | |
39 const std::string& message); | |
40 virtual void RecordAssociationTime(base::TimeDelta time); | |
41 virtual void RecordStartFailure(StartResult result); | |
49 | 42 |
50 virtual State state() const; | |
51 | |
52 // UnrecoverableHandler implementation | |
53 virtual void OnUnrecoverableError(const tracked_objects::Location& from_here, | |
54 const std::string& message); | |
55 | |
56 private: | |
57 void StartImpl(); | |
58 void StartDone(StartResult result, State state); | |
59 void StartDoneImpl(StartResult result, State state); | |
60 void StopImpl(); | |
61 void StartFailed(StartResult result); | |
62 void OnUnrecoverableErrorImpl(const tracked_objects::Location& from_here, | |
63 const std::string& message); | |
64 | |
65 void set_state(State state) { | |
66 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
67 state_ = state; | |
68 } | |
69 | |
70 ProfileSyncFactory* profile_sync_factory_; | |
71 Profile* profile_; | |
72 ProfileSyncService* sync_service_; | |
73 State state_; | |
74 | |
75 scoped_ptr<AssociatorInterface> model_associator_; | |
76 scoped_ptr<ChangeProcessor> change_processor_; | |
77 scoped_ptr<StartCallback> start_callback_; | |
78 scoped_refptr<PasswordStore> password_store_; | 43 scoped_refptr<PasswordStore> password_store_; |
79 | 44 |
80 base::Lock abort_association_lock_; | |
81 bool abort_association_; | |
82 base::WaitableEvent abort_association_complete_; | |
83 | |
84 // Barrier to ensure that the datatype has been stopped on the DB thread | |
85 // from the UI thread. | |
86 base::WaitableEvent datatype_stopped_; | |
87 | |
88 DISALLOW_COPY_AND_ASSIGN(PasswordDataTypeController); | 45 DISALLOW_COPY_AND_ASSIGN(PasswordDataTypeController); |
89 }; | 46 }; |
90 | 47 |
91 } // namespace browser_sync | 48 } // namespace browser_sync |
92 | 49 |
93 #endif // CHROME_BROWSER_SYNC_GLUE_PASSWORD_DATA_TYPE_CONTROLLER_H__ | 50 #endif // CHROME_BROWSER_SYNC_GLUE_PASSWORD_DATA_TYPE_CONTROLLER_H__ |
OLD | NEW |