| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SESSION_DATA_TYPE_CONTROLLER_H_ | |
| 6 #define CHROME_BROWSER_SYNC_GLUE_SESSION_DATA_TYPE_CONTROLLER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/scoped_ptr.h" | |
| 13 #include "chrome/browser/sync/glue/data_type_controller.h" | |
| 14 | |
| 15 class ProfileSyncFactory; | |
| 16 class ProfileSyncService; | |
| 17 | |
| 18 namespace browser_sync { | |
| 19 | |
| 20 class AssociatorInterface; | |
| 21 class ChangeProcessor; | |
| 22 | |
| 23 class SessionDataTypeController : public DataTypeController { | |
| 24 public: | |
| 25 SessionDataTypeController( | |
| 26 ProfileSyncFactory* profile_sync_factory, | |
| 27 ProfileSyncService* sync_service); | |
| 28 virtual ~SessionDataTypeController(); | |
| 29 | |
| 30 // DataTypeController implementation. | |
| 31 virtual void Start(StartCallback* start_callback); | |
| 32 | |
| 33 virtual void Stop(); | |
| 34 | |
| 35 virtual bool enabled() { | |
| 36 return true; | |
| 37 } | |
| 38 | |
| 39 virtual syncable::ModelType type() { | |
| 40 return syncable::SESSIONS; | |
| 41 } | |
| 42 | |
| 43 virtual browser_sync::ModelSafeGroup model_safe_group() { | |
| 44 return browser_sync::GROUP_UI; | |
| 45 } | |
| 46 | |
| 47 virtual const char* name() const { | |
| 48 // For logging only. | |
| 49 return "session"; | |
| 50 } | |
| 51 | |
| 52 virtual State state() { | |
| 53 return state_; | |
| 54 } | |
| 55 | |
| 56 // UnrecoverableErrorHandler interface. | |
| 57 virtual void OnUnrecoverableError( | |
| 58 const tracked_objects::Location& from_here, | |
| 59 const std::string& message); | |
| 60 | |
| 61 SessionModelAssociator* GetModelAssociator(); | |
| 62 | |
| 63 private: | |
| 64 // Helper method to run the stashed start callback with a given result. | |
| 65 void FinishStart(StartResult result); | |
| 66 | |
| 67 // Cleans up state and calls callback when start fails. | |
| 68 void StartFailed(StartResult result); | |
| 69 | |
| 70 ProfileSyncFactory* profile_sync_factory_; | |
| 71 ProfileSyncService* sync_service_; | |
| 72 | |
| 73 State state_; | |
| 74 | |
| 75 scoped_ptr<StartCallback> start_callback_; | |
| 76 scoped_ptr<AssociatorInterface> model_associator_; | |
| 77 scoped_ptr<ChangeProcessor> change_processor_; | |
| 78 | |
| 79 DISALLOW_COPY_AND_ASSIGN(SessionDataTypeController); | |
| 80 }; | |
| 81 | |
| 82 } // namespace browser_sync | |
| 83 | |
| 84 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_DATA_TYPE_CONTROLLER_H_ | |
| 85 | |
| OLD | NEW |