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

Side by Side Diff: components/sync_bookmarks/bookmark_data_type_controller.cc

Issue 2376123003: [Sync] Move //components/sync to the syncer namespace. (Closed)
Patch Set: Rebase. Created 4 years, 2 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
OLDNEW
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 #include "components/sync_bookmarks/bookmark_data_type_controller.h" 5 #include "components/sync_bookmarks/bookmark_data_type_controller.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "components/bookmarks/browser/bookmark_model.h" 8 #include "components/bookmarks/browser/bookmark_model.h"
9 #include "components/history/core/browser/history_service.h" 9 #include "components/history/core/browser/history_service.h"
10 #include "components/sync/driver/sync_api_component_factory.h" 10 #include "components/sync/driver/sync_api_component_factory.h"
11 #include "components/sync/driver/sync_client.h" 11 #include "components/sync/driver/sync_client.h"
12 12
13 using bookmarks::BookmarkModel; 13 using bookmarks::BookmarkModel;
14 14
15 namespace sync_bookmarks { 15 namespace sync_bookmarks {
16 16
17 BookmarkDataTypeController::BookmarkDataTypeController( 17 BookmarkDataTypeController::BookmarkDataTypeController(
18 const base::Closure& dump_stack, 18 const base::Closure& dump_stack,
19 sync_driver::SyncClient* sync_client) 19 syncer::SyncClient* sync_client)
20 : FrontendDataTypeController(syncer::BOOKMARKS, dump_stack, sync_client), 20 : syncer::FrontendDataTypeController(syncer::BOOKMARKS,
21 dump_stack,
22 sync_client),
21 history_service_observer_(this), 23 history_service_observer_(this),
22 bookmark_model_observer_(this) {} 24 bookmark_model_observer_(this) {}
23 25
24 BookmarkDataTypeController::~BookmarkDataTypeController() {} 26 BookmarkDataTypeController::~BookmarkDataTypeController() {}
25 27
26 bool BookmarkDataTypeController::StartModels() { 28 bool BookmarkDataTypeController::StartModels() {
27 DCHECK(CalledOnValidThread()); 29 DCHECK(CalledOnValidThread());
28 if (!DependentsLoaded()) { 30 if (!DependentsLoaded()) {
29 BookmarkModel* bookmark_model = sync_client_->GetBookmarkModel(); 31 BookmarkModel* bookmark_model = sync_client_->GetBookmarkModel();
30 bookmark_model_observer_.Add(bookmark_model); 32 bookmark_model_observer_.Add(bookmark_model);
31 history::HistoryService* history_service = 33 history::HistoryService* history_service =
32 sync_client_->GetHistoryService(); 34 sync_client_->GetHistoryService();
33 history_service_observer_.Add(history_service); 35 history_service_observer_.Add(history_service);
34 return false; 36 return false;
35 } 37 }
36 return true; 38 return true;
37 } 39 }
38 40
39 void BookmarkDataTypeController::CleanUpState() { 41 void BookmarkDataTypeController::CleanUpState() {
40 DCHECK(CalledOnValidThread()); 42 DCHECK(CalledOnValidThread());
41 history_service_observer_.RemoveAll(); 43 history_service_observer_.RemoveAll();
42 bookmark_model_observer_.RemoveAll(); 44 bookmark_model_observer_.RemoveAll();
43 } 45 }
44 46
45 void BookmarkDataTypeController::CreateSyncComponents() { 47 void BookmarkDataTypeController::CreateSyncComponents() {
46 DCHECK(CalledOnValidThread()); 48 DCHECK(CalledOnValidThread());
47 sync_driver::SyncApiComponentFactory::SyncComponents sync_components = 49 syncer::SyncApiComponentFactory::SyncComponents sync_components =
48 sync_client_->GetSyncApiComponentFactory()->CreateBookmarkSyncComponents( 50 sync_client_->GetSyncApiComponentFactory()->CreateBookmarkSyncComponents(
49 sync_client_->GetSyncService(), CreateErrorHandler()); 51 sync_client_->GetSyncService(), CreateErrorHandler());
50 set_model_associator(sync_components.model_associator); 52 set_model_associator(sync_components.model_associator);
51 set_change_processor(sync_components.change_processor); 53 set_change_processor(sync_components.change_processor);
52 } 54 }
53 55
54 void BookmarkDataTypeController::BookmarkModelChanged() { 56 void BookmarkDataTypeController::BookmarkModelChanged() {
55 } 57 }
56 58
57 void BookmarkDataTypeController::BookmarkModelLoaded(BookmarkModel* model, 59 void BookmarkDataTypeController::BookmarkModelLoaded(BookmarkModel* model,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 bookmark_model_observer_.RemoveAll(); 102 bookmark_model_observer_.RemoveAll();
101 OnModelLoaded(); 103 OnModelLoaded();
102 } 104 }
103 105
104 void BookmarkDataTypeController::HistoryServiceBeingDeleted( 106 void BookmarkDataTypeController::HistoryServiceBeingDeleted(
105 history::HistoryService* history_service) { 107 history::HistoryService* history_service) {
106 CleanUpState(); 108 CleanUpState();
107 } 109 }
108 110
109 } // namespace sync_bookmarks 111 } // namespace sync_bookmarks
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698