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

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

Issue 2388673002: Revert of [Sync] Move //components/sync to the syncer namespace. (patchset #5 id:40001 of https://co (Closed)
Patch Set: 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 syncer::SyncClient* sync_client) 19 sync_driver::SyncClient* sync_client)
20 : syncer::FrontendDataTypeController(syncer::BOOKMARKS, 20 : FrontendDataTypeController(syncer::BOOKMARKS, dump_stack, sync_client),
21 dump_stack,
22 sync_client),
23 history_service_observer_(this), 21 history_service_observer_(this),
24 bookmark_model_observer_(this) {} 22 bookmark_model_observer_(this) {}
25 23
26 BookmarkDataTypeController::~BookmarkDataTypeController() {} 24 BookmarkDataTypeController::~BookmarkDataTypeController() {}
27 25
28 bool BookmarkDataTypeController::StartModels() { 26 bool BookmarkDataTypeController::StartModels() {
29 DCHECK(CalledOnValidThread()); 27 DCHECK(CalledOnValidThread());
30 if (!DependentsLoaded()) { 28 if (!DependentsLoaded()) {
31 BookmarkModel* bookmark_model = sync_client_->GetBookmarkModel(); 29 BookmarkModel* bookmark_model = sync_client_->GetBookmarkModel();
32 bookmark_model_observer_.Add(bookmark_model); 30 bookmark_model_observer_.Add(bookmark_model);
33 history::HistoryService* history_service = 31 history::HistoryService* history_service =
34 sync_client_->GetHistoryService(); 32 sync_client_->GetHistoryService();
35 history_service_observer_.Add(history_service); 33 history_service_observer_.Add(history_service);
36 return false; 34 return false;
37 } 35 }
38 return true; 36 return true;
39 } 37 }
40 38
41 void BookmarkDataTypeController::CleanUpState() { 39 void BookmarkDataTypeController::CleanUpState() {
42 DCHECK(CalledOnValidThread()); 40 DCHECK(CalledOnValidThread());
43 history_service_observer_.RemoveAll(); 41 history_service_observer_.RemoveAll();
44 bookmark_model_observer_.RemoveAll(); 42 bookmark_model_observer_.RemoveAll();
45 } 43 }
46 44
47 void BookmarkDataTypeController::CreateSyncComponents() { 45 void BookmarkDataTypeController::CreateSyncComponents() {
48 DCHECK(CalledOnValidThread()); 46 DCHECK(CalledOnValidThread());
49 syncer::SyncApiComponentFactory::SyncComponents sync_components = 47 sync_driver::SyncApiComponentFactory::SyncComponents sync_components =
50 sync_client_->GetSyncApiComponentFactory()->CreateBookmarkSyncComponents( 48 sync_client_->GetSyncApiComponentFactory()->CreateBookmarkSyncComponents(
51 sync_client_->GetSyncService(), CreateErrorHandler()); 49 sync_client_->GetSyncService(), CreateErrorHandler());
52 set_model_associator(sync_components.model_associator); 50 set_model_associator(sync_components.model_associator);
53 set_change_processor(sync_components.change_processor); 51 set_change_processor(sync_components.change_processor);
54 } 52 }
55 53
56 void BookmarkDataTypeController::BookmarkModelChanged() { 54 void BookmarkDataTypeController::BookmarkModelChanged() {
57 } 55 }
58 56
59 void BookmarkDataTypeController::BookmarkModelLoaded(BookmarkModel* model, 57 void BookmarkDataTypeController::BookmarkModelLoaded(BookmarkModel* model,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 bookmark_model_observer_.RemoveAll(); 100 bookmark_model_observer_.RemoveAll();
103 OnModelLoaded(); 101 OnModelLoaded();
104 } 102 }
105 103
106 void BookmarkDataTypeController::HistoryServiceBeingDeleted( 104 void BookmarkDataTypeController::HistoryServiceBeingDeleted(
107 history::HistoryService* history_service) { 105 history::HistoryService* history_service) {
108 CleanUpState(); 106 CleanUpState();
109 } 107 }
110 108
111 } // namespace sync_bookmarks 109 } // namespace sync_bookmarks
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698