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

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

Issue 92173003: Proper initialization for known_disabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: +DCHECK Created 7 years 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
« no previous file with comments | « chrome/browser/extensions/extension_prefs_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <set> 9 #include <set>
10 10
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 if (!FeatureSwitch::prompt_for_external_extensions()->IsEnabled()) 1425 if (!FeatureSwitch::prompt_for_external_extensions()->IsEnabled())
1426 return false; 1426 return false;
1427 1427
1428 return (Manifest::IsExternalLocation(extension->location()) && 1428 return (Manifest::IsExternalLocation(extension->location()) &&
1429 !extension_prefs_->IsExternalExtensionAcknowledged(extension->id()) && 1429 !extension_prefs_->IsExternalExtensionAcknowledged(extension->id()) &&
1430 !(extension_prefs_->GetDisableReasons(extension->id()) & 1430 !(extension_prefs_->GetDisableReasons(extension->id()) &
1431 Extension::DISABLE_SIDELOAD_WIPEOUT)); 1431 Extension::DISABLE_SIDELOAD_WIPEOUT));
1432 } 1432 }
1433 1433
1434 void ExtensionService::ReconcileKnownDisabled() { 1434 void ExtensionService::ReconcileKnownDisabled() {
1435 const ExtensionIdSet known_disabled_ids = 1435 ExtensionIdSet known_disabled_ids;
1436 extension_prefs_->GetKnownDisabled(); 1436 if (!extension_prefs_->GetKnownDisabled(&known_disabled_ids)) {
1437 if (known_disabled_ids.empty() && !disabled_extensions_.is_empty()) {
1438 extension_prefs_->SetKnownDisabled(disabled_extensions_.GetIDs()); 1437 extension_prefs_->SetKnownDisabled(disabled_extensions_.GetIDs());
1439 UMA_HISTOGRAM_BOOLEAN("Extensions.KnownDisabledInitialized", true); 1438 UMA_HISTOGRAM_BOOLEAN("Extensions.KnownDisabledInitialized", true);
1440 return; 1439 return;
1441 } 1440 }
1442 1441
1443 // Both |known_disabled_ids| and |extensions_| are ordered (by definition 1442 // Both |known_disabled_ids| and |extensions_| are ordered (by definition
1444 // of std::map and std::set). Iterate forward over both sets in parallel 1443 // of std::map and std::set). Iterate forward over both sets in parallel
1445 // to find matching IDs and disable the corresponding extensions. 1444 // to find matching IDs and disable the corresponding extensions.
1446 ExtensionSet::const_iterator extensions_it = extensions_.begin(); 1445 ExtensionSet::const_iterator extensions_it = extensions_.begin();
1447 ExtensionIdSet::const_iterator known_disabled_ids_it = 1446 ExtensionIdSet::const_iterator known_disabled_ids_it =
(...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after
2811 } 2810 }
2812 2811
2813 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { 2812 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) {
2814 update_observers_.AddObserver(observer); 2813 update_observers_.AddObserver(observer);
2815 } 2814 }
2816 2815
2817 void ExtensionService::RemoveUpdateObserver( 2816 void ExtensionService::RemoveUpdateObserver(
2818 extensions::UpdateObserver* observer) { 2817 extensions::UpdateObserver* observer) {
2819 update_observers_.RemoveObserver(observer); 2818 update_observers_.RemoveObserver(observer);
2820 } 2819 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_prefs_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698