Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: chrome/browser/sync/glue/password_data_type_controller.h

Issue 6811003: [Sync] Make generic non-frontend thread datatype controller. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Copy paste :( Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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);
35 virtual ~PasswordDataTypeController(); 24 virtual ~PasswordDataTypeController();
36 25
37 // DataTypeController implementation 26 // 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; 27 virtual syncable::ModelType type() const;
45
46 virtual browser_sync::ModelSafeGroup model_safe_group() const; 28 virtual browser_sync::ModelSafeGroup model_safe_group() const;
47 29
48 virtual std::string name() const; 30 protected:
49 31 // NonFrontendDataTypeController interface.
50 virtual State state() const; 32 virtual bool StartModels();
51 33 virtual bool StartAssociationAsync();
52 // UnrecoverableHandler implementation 34 virtual void CreateSyncComponents();
53 virtual void OnUnrecoverableError(const tracked_objects::Location& from_here, 35 virtual bool StopAssociationAsync();
54 const std::string& message); 36 virtual void RecordUnrecoverableError(
37 const tracked_objects::Location& from_here,
38 const std::string& message);
39 virtual void RecordAssociationTime(base::TimeDelta time);
40 virtual void RecordStartFailure(StartResult result);
55 41
56 private: 42 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__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698