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

Side by Side Diff: chrome/browser/extensions/pending_enables.cc

Issue 1236363002: ExtensionSyncService cleanup: process uninstalls in one step (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 5 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
OLDNEW
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 "components/sync_driver/sync_prefs.h" 9 #include "components/sync_driver/sync_prefs.h"
10 10
(...skipping 18 matching lines...) Expand all
29 void PendingEnables::Remove(const std::string& extension_id) { 29 void PendingEnables::Remove(const std::string& extension_id) {
30 if (IsWaitingForSync()) 30 if (IsWaitingForSync())
31 ids_.erase(extension_id); 31 ids_.erase(extension_id);
32 } 32 }
33 33
34 void PendingEnables::OnSyncStarted(ExtensionService* service) { 34 void PendingEnables::OnSyncStarted(ExtensionService* service) {
35 for (std::set<std::string>::const_iterator it = ids_.begin(); 35 for (std::set<std::string>::const_iterator it = ids_.begin();
36 it != ids_.end(); ++it) { 36 it != ids_.end(); ++it) {
37 const Extension* extension = service->GetExtensionById(*it, true); 37 const Extension* extension = service->GetExtensionById(*it, true);
38 if (extension) 38 if (extension)
39 sync_bundle_->PushSyncChangeIfNeeded(*extension); 39 sync_bundle_->PushSyncAddOrUpdate(*extension);
40 } 40 }
41 ids_.clear(); 41 ids_.clear();
42 } 42 }
43 43
44 bool PendingEnables::Contains(const std::string& extension_id) const { 44 bool PendingEnables::Contains(const std::string& extension_id) const {
45 return ids_.find(extension_id) != ids_.end(); 45 return ids_.find(extension_id) != ids_.end();
46 } 46 }
47 47
48 bool PendingEnables::IsSyncEnabled() { 48 bool PendingEnables::IsSyncEnabled() {
49 if (is_sync_enabled_for_test_) 49 if (is_sync_enabled_for_test_)
50 return true; 50 return true;
51 return sync_prefs_ && 51 return sync_prefs_ &&
52 sync_prefs_->HasSyncSetupCompleted() && 52 sync_prefs_->HasSyncSetupCompleted() &&
53 sync_prefs_->GetPreferredDataTypes(syncer::ModelTypeSet(enable_type_)) 53 sync_prefs_->GetPreferredDataTypes(syncer::ModelTypeSet(enable_type_))
54 .Has(enable_type_); 54 .Has(enable_type_);
55 } 55 }
56 56
57 bool PendingEnables::IsWaitingForSync() { 57 bool PendingEnables::IsWaitingForSync() {
58 return IsSyncEnabled() && !sync_bundle_->IsSyncing(); 58 return IsSyncEnabled() && !sync_bundle_->IsSyncing();
59 } 59 }
60 60
61 } // namespace extensions 61 } // namespace extensions
62 62
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_sync_service.cc ('k') | chrome/browser/extensions/sync_bundle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698