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 CHROME_BROWSER_SYNC_GLUE_FRONTEND_DATA_TYPE_CONTROLLER_H__ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_FRONTEND_DATA_TYPE_CONTROLLER_H__ |
6 #define CHROME_BROWSER_SYNC_GLUE_FRONTEND_DATA_TYPE_CONTROLLER_H__ | 6 #define CHROME_BROWSER_SYNC_GLUE_FRONTEND_DATA_TYPE_CONTROLLER_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 public: | 46 public: |
47 FrontendDataTypeController( | 47 FrontendDataTypeController( |
48 scoped_refptr<base::MessageLoopProxy> ui_thread, | 48 scoped_refptr<base::MessageLoopProxy> ui_thread, |
49 const base::Closure& error_callback, | 49 const base::Closure& error_callback, |
50 ProfileSyncComponentsFactory* profile_sync_factory, | 50 ProfileSyncComponentsFactory* profile_sync_factory, |
51 Profile* profile, | 51 Profile* profile, |
52 ProfileSyncService* sync_service); | 52 ProfileSyncService* sync_service); |
53 | 53 |
54 // DataTypeController interface. | 54 // DataTypeController interface. |
55 virtual void LoadModels( | 55 virtual void LoadModels( |
56 const ModelLoadCallback& model_load_callback) OVERRIDE; | 56 const ModelLoadCallback& model_load_callback) override; |
57 virtual void StartAssociating(const StartCallback& start_callback) OVERRIDE; | 57 virtual void StartAssociating(const StartCallback& start_callback) override; |
58 virtual void Stop() OVERRIDE; | 58 virtual void Stop() override; |
59 virtual syncer::ModelType type() const = 0; | 59 virtual syncer::ModelType type() const = 0; |
60 virtual syncer::ModelSafeGroup model_safe_group() const OVERRIDE; | 60 virtual syncer::ModelSafeGroup model_safe_group() const override; |
61 virtual std::string name() const OVERRIDE; | 61 virtual std::string name() const override; |
62 virtual State state() const OVERRIDE; | 62 virtual State state() const override; |
63 | 63 |
64 // DataTypeErrorHandler interface. | 64 // DataTypeErrorHandler interface. |
65 virtual void OnSingleDataTypeUnrecoverableError( | 65 virtual void OnSingleDataTypeUnrecoverableError( |
66 const syncer::SyncError& error) OVERRIDE; | 66 const syncer::SyncError& error) override; |
67 | 67 |
68 protected: | 68 protected: |
69 friend class FrontendDataTypeControllerMock; | 69 friend class FrontendDataTypeControllerMock; |
70 | 70 |
71 // For testing only. | 71 // For testing only. |
72 FrontendDataTypeController(); | 72 FrontendDataTypeController(); |
73 virtual ~FrontendDataTypeController(); | 73 virtual ~FrontendDataTypeController(); |
74 | 74 |
75 // Kick off any dependent services that need to be running before we can | 75 // Kick off any dependent services that need to be running before we can |
76 // associate models. The default implementation is a no-op. | 76 // associate models. The default implementation is a no-op. |
77 // Return value: | 77 // Return value: |
78 // True - if models are ready and association can proceed. | 78 // True - if models are ready and association can proceed. |
79 // False - if models are not ready. Associate() should be called when the | 79 // False - if models are not ready. Associate() should be called when the |
80 // models are ready. Refer to Start(_) implementation. | 80 // models are ready. Refer to Start(_) implementation. |
81 virtual bool StartModels(); | 81 virtual bool StartModels(); |
82 | 82 |
83 // Datatype specific creation of sync components. | 83 // Datatype specific creation of sync components. |
84 virtual void CreateSyncComponents() = 0; | 84 virtual void CreateSyncComponents() = 0; |
85 | 85 |
86 // DataTypeController interface. | 86 // DataTypeController interface. |
87 virtual void OnModelLoaded() OVERRIDE; | 87 virtual void OnModelLoaded() override; |
88 | 88 |
89 // Perform any DataType controller specific state cleanup before stopping | 89 // Perform any DataType controller specific state cleanup before stopping |
90 // the datatype controller. The default implementation is a no-op. | 90 // the datatype controller. The default implementation is a no-op. |
91 virtual void CleanUpState(); | 91 virtual void CleanUpState(); |
92 | 92 |
93 // Helper method for cleaning up state and running the start callback. | 93 // Helper method for cleaning up state and running the start callback. |
94 virtual void StartDone( | 94 virtual void StartDone( |
95 ConfigureResult start_result, | 95 ConfigureResult start_result, |
96 const syncer::SyncMergeResult& local_merge_result, | 96 const syncer::SyncMergeResult& local_merge_result, |
97 const syncer::SyncMergeResult& syncer_merge_result); | 97 const syncer::SyncMergeResult& syncer_merge_result); |
98 | 98 |
99 // Record association time. | 99 // Record association time. |
100 virtual void RecordAssociationTime(base::TimeDelta time); | 100 virtual void RecordAssociationTime(base::TimeDelta time); |
101 // Record causes of start failure. | 101 // Record causes of start failure. |
102 virtual void RecordStartFailure(ConfigureResult result); | 102 virtual void RecordStartFailure(ConfigureResult result); |
103 | 103 |
104 virtual sync_driver::AssociatorInterface* model_associator() const; | 104 virtual sync_driver::AssociatorInterface* model_associator() const; |
105 virtual void set_model_associator( | 105 virtual void set_model_associator( |
106 sync_driver::AssociatorInterface* associator); | 106 sync_driver::AssociatorInterface* associator); |
107 virtual sync_driver::ChangeProcessor* GetChangeProcessor() const OVERRIDE; | 107 virtual sync_driver::ChangeProcessor* GetChangeProcessor() const override; |
108 virtual void set_change_processor(sync_driver::ChangeProcessor* processor); | 108 virtual void set_change_processor(sync_driver::ChangeProcessor* processor); |
109 | 109 |
110 // Handles the reporting of unrecoverable error. It records stuff in | 110 // Handles the reporting of unrecoverable error. It records stuff in |
111 // UMA and reports to breakpad. | 111 // UMA and reports to breakpad. |
112 // Virtual for testing purpose. | 112 // Virtual for testing purpose. |
113 virtual void RecordUnrecoverableError( | 113 virtual void RecordUnrecoverableError( |
114 const tracked_objects::Location& from_here, | 114 const tracked_objects::Location& from_here, |
115 const std::string& message); | 115 const std::string& message); |
116 | 116 |
117 ProfileSyncComponentsFactory* const profile_sync_factory_; | 117 ProfileSyncComponentsFactory* const profile_sync_factory_; |
(...skipping 23 matching lines...) Expand all Loading... |
141 // Clean up our state and state variables. Called in response | 141 // Clean up our state and state variables. Called in response |
142 // to a failure or abort or stop. | 142 // to a failure or abort or stop. |
143 void CleanUp(); | 143 void CleanUp(); |
144 | 144 |
145 DISALLOW_COPY_AND_ASSIGN(FrontendDataTypeController); | 145 DISALLOW_COPY_AND_ASSIGN(FrontendDataTypeController); |
146 }; | 146 }; |
147 | 147 |
148 } // namespace browser_sync | 148 } // namespace browser_sync |
149 | 149 |
150 #endif // CHROME_BROWSER_SYNC_GLUE_FRONTEND_DATA_TYPE_CONTROLLER_H__ | 150 #endif // CHROME_BROWSER_SYNC_GLUE_FRONTEND_DATA_TYPE_CONTROLLER_H__ |
OLD | NEW |