OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/pending_enables.h" | 5 #include "chrome/browser/extensions/pending_enables.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
8 #include "chrome/browser/extensions/sync_bundle.h" | 8 #include "chrome/browser/extensions/sync_bundle.h" |
9 #include "chrome/browser/sync/sync_prefs.h" | 9 #include "components/sync_driver/sync_prefs.h" |
10 | 10 |
11 namespace extensions { | 11 namespace extensions { |
12 | 12 |
13 PendingEnables::PendingEnables(scoped_ptr<browser_sync::SyncPrefs> sync_prefs, | 13 PendingEnables::PendingEnables(scoped_ptr<sync_driver::SyncPrefs> sync_prefs, |
14 SyncBundle* sync_bundle, | 14 SyncBundle* sync_bundle, |
15 syncer::ModelType enable_type) | 15 syncer::ModelType enable_type) |
16 : sync_prefs_(sync_prefs.Pass()), | 16 : sync_prefs_(sync_prefs.Pass()), |
17 sync_bundle_(sync_bundle), | 17 sync_bundle_(sync_bundle), |
18 enable_type_(enable_type), | 18 enable_type_(enable_type), |
19 is_sync_enabled_for_test_(false) { | 19 is_sync_enabled_for_test_(false) {} |
20 } | |
21 | 20 |
22 PendingEnables::~PendingEnables() { | 21 PendingEnables::~PendingEnables() { |
23 } | 22 } |
24 | 23 |
25 void PendingEnables::OnExtensionEnabled(const std::string& extension_id) { | 24 void PendingEnables::OnExtensionEnabled(const std::string& extension_id) { |
26 if (IsWaitingForSync()) | 25 if (IsWaitingForSync()) |
27 ids_.insert(extension_id); | 26 ids_.insert(extension_id); |
28 } | 27 } |
29 | 28 |
30 void PendingEnables::OnExtensionDisabled(const std::string& extension_id) { | 29 void PendingEnables::OnExtensionDisabled(const std::string& extension_id) { |
(...skipping 23 matching lines...) Expand all Loading... |
54 sync_prefs_->GetPreferredDataTypes(syncer::ModelTypeSet(enable_type_)) | 53 sync_prefs_->GetPreferredDataTypes(syncer::ModelTypeSet(enable_type_)) |
55 .Has(enable_type_); | 54 .Has(enable_type_); |
56 } | 55 } |
57 | 56 |
58 bool PendingEnables::IsWaitingForSync() { | 57 bool PendingEnables::IsWaitingForSync() { |
59 return IsSyncEnabled() && !sync_bundle_->IsSyncing(); | 58 return IsSyncEnabled() && !sync_bundle_->IsSyncing(); |
60 } | 59 } |
61 | 60 |
62 } // namespace extensions | 61 } // namespace extensions |
63 | 62 |
OLD | NEW |