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

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

Issue 65983002: Revert 231221 - "Remove enabled/disabled state from extension and app sync." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 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/extension_sync_service.h" 5 #include "chrome/browser/extensions/extension_sync_service.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 375
376 // Extension from sync was uninstalled by the user as external extensions. 376 // Extension from sync was uninstalled by the user as external extensions.
377 // Honor user choice and skip installation/enabling. 377 // Honor user choice and skip installation/enabling.
378 if (extension_service_->IsExternalExtensionUninstalled(id)) { 378 if (extension_service_->IsExternalExtensionUninstalled(id)) {
379 LOG(WARNING) << "Extension with id " << id 379 LOG(WARNING) << "Extension with id " << id
380 << " from sync was uninstalled as external extension"; 380 << " from sync was uninstalled as external extension";
381 return true; 381 return true;
382 } 382 }
383 383
384 // Set user settings. 384 // Set user settings.
385 // If the extension has been disabled from sync, it may not have
386 // been installed yet, so we don't know if the disable reason was a
387 // permissions increase. That will be updated once CheckPermissionsIncrease
388 // is called for it.
389 if (extension_sync_data.enabled())
390 extension_service_->EnableExtension(id);
391 else if (!IsPendingEnable(id))
392 extension_service_->DisableExtension(
393 id, Extension::DISABLE_UNKNOWN_FROM_SYNC);
385 394
386 // We need to cache some version information here because setting the 395 // We need to cache some version information here because setting the
387 // incognito flag invalidates the |extension| pointer (it reloads the 396 // incognito flag invalidates the |extension| pointer (it reloads the
388 // extension). 397 // extension).
389 bool extension_installed = (extension != NULL); 398 bool extension_installed = (extension != NULL);
390 int result = extension ? 399 int result = extension ?
391 extension->version()->CompareTo(extension_sync_data.version()) : 0; 400 extension->version()->CompareTo(extension_sync_data.version()) : 0;
392 extension_util::SetIsIncognitoEnabled( 401 extension_util::SetIsIncognitoEnabled(
393 id, extension_service_, extension_sync_data.incognito_enabled()); 402 id, extension_service_, extension_sync_data.incognito_enabled());
394 extension = NULL; // No longer safe to use. 403 extension = NULL; // No longer safe to use.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 app_sync_bundle_.SyncChangeIfNeeded(extension); 443 app_sync_bundle_.SyncChangeIfNeeded(extension);
435 else if (extension_service_->is_ready() && !flare_.is_null()) 444 else if (extension_service_->is_ready() && !flare_.is_null())
436 flare_.Run(syncer::APPS); 445 flare_.Run(syncer::APPS);
437 } else if (extensions::sync_helper::IsSyncableExtension(&extension)) { 446 } else if (extensions::sync_helper::IsSyncableExtension(&extension)) {
438 if (extension_sync_bundle_.IsSyncing()) 447 if (extension_sync_bundle_.IsSyncing())
439 extension_sync_bundle_.SyncChangeIfNeeded(extension); 448 extension_sync_bundle_.SyncChangeIfNeeded(extension);
440 else if (extension_service_->is_ready() && !flare_.is_null()) 449 else if (extension_service_->is_ready() && !flare_.is_null())
441 flare_.Run(syncer::EXTENSIONS); 450 flare_.Run(syncer::EXTENSIONS);
442 } 451 }
443 } 452 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service_unittest.cc ('k') | chrome/browser/sync/test/integration/apps_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698