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

Unified Diff: chrome/browser/extensions/pending_enables.cc

Issue 1240573012: Extension syncing: Introduce a NeedsSync pref (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ext_sync_uninstall
Patch Set: (b); hackfix sync_integration_tests 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/pending_enables.cc
diff --git a/chrome/browser/extensions/pending_enables.cc b/chrome/browser/extensions/pending_enables.cc
deleted file mode 100644
index b8d1aa1759abbcbc730a957332e6e0ff1bf41d57..0000000000000000000000000000000000000000
--- a/chrome/browser/extensions/pending_enables.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/extensions/pending_enables.h"
-
-#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/sync_bundle.h"
-#include "components/sync_driver/sync_prefs.h"
-
-namespace extensions {
-
-PendingEnables::PendingEnables(scoped_ptr<sync_driver::SyncPrefs> sync_prefs,
- SyncBundle* sync_bundle,
- syncer::ModelType enable_type)
- : sync_prefs_(sync_prefs.Pass()),
- sync_bundle_(sync_bundle),
- enable_type_(enable_type),
- is_sync_enabled_for_test_(false) {}
-
-PendingEnables::~PendingEnables() {
-}
-
-void PendingEnables::Add(const std::string& extension_id) {
- if (IsWaitingForSync())
- ids_.insert(extension_id);
-}
-
-void PendingEnables::Remove(const std::string& extension_id) {
- if (IsWaitingForSync())
- ids_.erase(extension_id);
-}
-
-void PendingEnables::OnSyncStarted(ExtensionService* service) {
- for (std::set<std::string>::const_iterator it = ids_.begin();
- it != ids_.end(); ++it) {
- const Extension* extension = service->GetExtensionById(*it, true);
- if (extension)
- sync_bundle_->PushSyncAddOrUpdate(*extension);
- }
- ids_.clear();
-}
-
-bool PendingEnables::Contains(const std::string& extension_id) const {
- return ids_.find(extension_id) != ids_.end();
-}
-
-bool PendingEnables::IsSyncEnabled() {
- if (is_sync_enabled_for_test_)
- return true;
- return sync_prefs_ &&
- sync_prefs_->HasSyncSetupCompleted() &&
- sync_prefs_->GetPreferredDataTypes(syncer::ModelTypeSet(enable_type_))
- .Has(enable_type_);
-}
-
-bool PendingEnables::IsWaitingForSync() {
- return IsSyncEnabled() && !sync_bundle_->IsSyncing();
-}
-
-} // namespace extensions
-

Powered by Google App Engine
This is Rietveld 408576698