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

Side by Side Diff: chrome/browser/sync/glue/extension_model_associator.cc

Issue 7461098: Reland 87645 with clang fixes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/sync/glue/extension_model_associator.h" 5 #include "chrome/browser/sync/glue/extension_model_associator.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/tracked.h" 8 #include "base/tracked.h"
9 #include "chrome/browser/extensions/extension_sync_data.h" 9 #include "chrome/browser/extensions/extension_sync_data.h"
10 #include "chrome/browser/sync/engine/syncapi.h" 10 #include "chrome/browser/sync/engine/syncapi.h"
(...skipping 14 matching lines...) Expand all
25 user_share_(user_share) { 25 user_share_(user_share) {
26 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 26 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
27 DCHECK(extension_service_); 27 DCHECK(extension_service_);
28 DCHECK(user_share_); 28 DCHECK(user_share_);
29 } 29 }
30 30
31 ExtensionModelAssociator::~ExtensionModelAssociator() { 31 ExtensionModelAssociator::~ExtensionModelAssociator() {
32 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 32 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
33 } 33 }
34 34
35 bool ExtensionModelAssociator::AssociateModels() { 35 bool ExtensionModelAssociator::AssociateModels(SyncError* error) {
36 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 36 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
37 ExtensionDataMap extension_data_map; 37 ExtensionDataMap extension_data_map;
38 if (!SlurpExtensionData( 38 if (!SlurpExtensionData(
39 traits_, *extension_service_, user_share_, &extension_data_map)) { 39 traits_, *extension_service_, user_share_, &extension_data_map)) {
40 error->Reset(FROM_HERE, "Failed to get extension data.", model_type());
40 return false; 41 return false;
41 } 42 }
42 if (!FlushExtensionData( 43 if (!FlushExtensionData(
43 traits_, extension_data_map, extension_service_, user_share_)) { 44 traits_, extension_data_map, extension_service_, user_share_)) {
45 error->Reset(FROM_HERE, "Failed to flush extension data.", model_type());
44 return false; 46 return false;
45 } 47 }
46 48
47 return true; 49 return true;
48 } 50 }
49 51
50 bool ExtensionModelAssociator::DisassociateModels() { 52 bool ExtensionModelAssociator::DisassociateModels(SyncError* error) {
51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 53 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
52 // Nothing to do. 54 // Nothing to do.
53 return true; 55 return true;
54 } 56 }
55 57
56 bool ExtensionModelAssociator::SyncModelHasUserCreatedNodes(bool* has_nodes) { 58 bool ExtensionModelAssociator::SyncModelHasUserCreatedNodes(bool* has_nodes) {
57 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 59 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
58 return RootNodeHasChildren(traits_.root_node_tag, user_share_, has_nodes); 60 return RootNodeHasChildren(traits_.root_node_tag, user_share_, has_nodes);
59 } 61 }
60 62
61 void ExtensionModelAssociator::AbortAssociation() { 63 void ExtensionModelAssociator::AbortAssociation() {
62 // No implementation needed, this associator runs on the main 64 // No implementation needed, this associator runs on the main
63 // thread. 65 // thread.
64 } 66 }
65 67
66 bool ExtensionModelAssociator::CryptoReadyIfNecessary() { 68 bool ExtensionModelAssociator::CryptoReadyIfNecessary() {
67 // We only access the cryptographer while holding a transaction. 69 // We only access the cryptographer while holding a transaction.
68 sync_api::ReadTransaction trans(FROM_HERE, user_share_); 70 sync_api::ReadTransaction trans(FROM_HERE, user_share_);
69 const syncable::ModelTypeSet& encrypted_types = 71 const syncable::ModelTypeSet& encrypted_types =
70 sync_api::GetEncryptedTypes(&trans); 72 sync_api::GetEncryptedTypes(&trans);
71 return encrypted_types.count(traits_.model_type) == 0 || 73 return encrypted_types.count(traits_.model_type) == 0 ||
72 trans.GetCryptographer()->is_ready(); 74 trans.GetCryptographer()->is_ready();
73 } 75 }
74 76
75 } // namespace browser_sync 77 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/extension_model_associator.h ('k') | chrome/browser/sync/glue/frontend_data_type_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698