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_BOOKMARK_DATA_TYPE_CONTROLLER_H__ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_BOOKMARK_DATA_TYPE_CONTROLLER_H__ |
6 #define CHROME_BROWSER_SYNC_GLUE_BOOKMARK_DATA_TYPE_CONTROLLER_H__ | 6 #define CHROME_BROWSER_SYNC_GLUE_BOOKMARK_DATA_TYPE_CONTROLLER_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "chrome/browser/sync/glue/frontend_data_type_controller.h" | 11 #include "chrome/browser/sync/glue/frontend_data_type_controller.h" |
12 #include "components/bookmarks/browser/base_bookmark_model_observer.h" | 12 #include "components/bookmarks/browser/base_bookmark_model_observer.h" |
13 #include "components/history/core/browser/history_service_observer.h" | |
13 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
sdefresne
2014/09/23 08:45:09
Remove those two includes, they should no longer b
nshaik
2014/10/29 08:43:39
Done.
| |
14 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
15 | 16 |
16 namespace browser_sync { | 17 namespace browser_sync { |
17 | 18 |
18 // A class that manages the startup and shutdown of bookmark sync. | 19 // A class that manages the startup and shutdown of bookmark sync. |
19 class BookmarkDataTypeController : public FrontendDataTypeController, | 20 class BookmarkDataTypeController : public FrontendDataTypeController, |
20 public content::NotificationObserver, | 21 public BaseBookmarkModelObserver, |
21 public BaseBookmarkModelObserver { | 22 public history::HistoryServiceObserver { |
22 public: | 23 public: |
23 BookmarkDataTypeController(ProfileSyncComponentsFactory* profile_sync_factory, | 24 BookmarkDataTypeController(ProfileSyncComponentsFactory* profile_sync_factory, |
24 Profile* profile, | 25 Profile* profile, |
25 ProfileSyncService* sync_service); | 26 ProfileSyncService* sync_service); |
26 | 27 |
27 // FrontendDataTypeController interface. | 28 // FrontendDataTypeController interface. |
28 virtual syncer::ModelType type() const OVERRIDE; | 29 virtual syncer::ModelType type() const OVERRIDE; |
29 | 30 |
30 // content::NotificationObserver interface. | 31 // Is called when |service| is loaded. |
sdefresne
2014/10/20 13:15:42
// history::HistoryServiceObserver:
| |
31 virtual void Observe(int type, | 32 virtual void HistoryServiceLoaded(HistoryService* service) OVERRIDE; |
sdefresne
2014/10/20 13:15:42
OVERRIDE -> override
| |
32 const content::NotificationSource& source, | |
33 const content::NotificationDetails& details) OVERRIDE; | |
34 | 33 |
35 private: | 34 private: |
36 virtual ~BookmarkDataTypeController(); | 35 virtual ~BookmarkDataTypeController(); |
37 | 36 |
38 // FrontendDataTypeController interface. | 37 // FrontendDataTypeController interface. |
39 virtual bool StartModels() OVERRIDE; | 38 virtual bool StartModels() OVERRIDE; |
40 virtual void CleanUpState() OVERRIDE; | 39 virtual void CleanUpState() OVERRIDE; |
41 virtual void CreateSyncComponents() OVERRIDE; | 40 virtual void CreateSyncComponents() OVERRIDE; |
42 | 41 |
43 // BaseBookmarkModelObserver interface. | 42 // BaseBookmarkModelObserver interface. |
44 virtual void BookmarkModelChanged() OVERRIDE; | 43 virtual void BookmarkModelChanged() OVERRIDE; |
45 virtual void BookmarkModelLoaded(BookmarkModel* model, | 44 virtual void BookmarkModelLoaded(BookmarkModel* model, |
46 bool ids_reassigned) OVERRIDE; | 45 bool ids_reassigned) OVERRIDE; |
47 virtual void BookmarkModelBeingDeleted(BookmarkModel* model) OVERRIDE; | 46 virtual void BookmarkModelBeingDeleted(BookmarkModel* model) OVERRIDE; |
48 | 47 |
49 // Helper that returns true iff both the bookmark model and the history | 48 // Helper that returns true iff both the bookmark model and the history |
50 // service have finished loading. | 49 // service have finished loading. |
51 bool DependentsLoaded(); | 50 bool DependentsLoaded(); |
52 | 51 |
53 content::NotificationRegistrar registrar_; | |
54 | |
55 BookmarkModel* bookmark_model_; | 52 BookmarkModel* bookmark_model_; |
56 | 53 |
57 // Have we installed ourselves as a BookmarkModel observer? | 54 // Have we installed ourselves as a BookmarkModel observer? |
58 bool installed_bookmark_observer_; | 55 bool installed_bookmark_observer_; |
59 | 56 |
60 DISALLOW_COPY_AND_ASSIGN(BookmarkDataTypeController); | 57 DISALLOW_COPY_AND_ASSIGN(BookmarkDataTypeController); |
61 }; | 58 }; |
62 | 59 |
63 } // namespace browser_sync | 60 } // namespace browser_sync |
64 | 61 |
65 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_DATA_TYPE_CONTROLLER_H__ | 62 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_DATA_TYPE_CONTROLLER_H__ |
OLD | NEW |