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

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

Issue 11275069: Perform install tasks for newly installed or upgraded component apps/extensions. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase and move v2 component app added in r169911 (and r170087) into background section in componen… Created 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_prefs.h" 5 #include "chrome/browser/extensions/extension_prefs.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/prefs/pref_notifier.h" 8 #include "base/prefs/pref_notifier.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 scoped_ptr<ExtensionInfo> ExtensionPrefs::GetInstalledExtensionInfo( 1646 scoped_ptr<ExtensionInfo> ExtensionPrefs::GetInstalledExtensionInfo(
1647 const std::string& extension_id) const { 1647 const std::string& extension_id) const {
1648 const DictionaryValue* ext; 1648 const DictionaryValue* ext;
1649 const DictionaryValue* extensions = prefs_->GetDictionary(kExtensionsPref); 1649 const DictionaryValue* extensions = prefs_->GetDictionary(kExtensionsPref);
1650 if (!extensions || 1650 if (!extensions ||
1651 !extensions->GetDictionaryWithoutPathExpansion(extension_id, &ext)) 1651 !extensions->GetDictionaryWithoutPathExpansion(extension_id, &ext))
1652 return scoped_ptr<ExtensionInfo>(); 1652 return scoped_ptr<ExtensionInfo>();
1653 if (IsBlacklistBitSet(ext)) 1653 if (IsBlacklistBitSet(ext))
1654 return scoped_ptr<ExtensionInfo>(); 1654 return scoped_ptr<ExtensionInfo>();
1655 int state_value; 1655 int state_value;
1656 if (!ext->GetInteger(kPrefState, &state_value)) { 1656 if (!ext->GetInteger(kPrefState, &state_value) ||
1657 // This can legitimately happen if we store preferences for component 1657 state_value == Extension::ENABLED_COMPONENT) {
1658 // extensions. 1658 // Old preferences files may not have kPrefState for component extensions.
1659 return scoped_ptr<ExtensionInfo>(); 1659 return scoped_ptr<ExtensionInfo>();
1660 } 1660 }
1661
1661 if (state_value == Extension::EXTERNAL_EXTENSION_UNINSTALLED) { 1662 if (state_value == Extension::EXTERNAL_EXTENSION_UNINSTALLED) {
1662 LOG(WARNING) << "External extension with id " << extension_id 1663 LOG(WARNING) << "External extension with id " << extension_id
1663 << " has been uninstalled by the user"; 1664 << " has been uninstalled by the user";
1664 return scoped_ptr<ExtensionInfo>(); 1665 return scoped_ptr<ExtensionInfo>();
1665 } 1666 }
1666 FilePath::StringType path; 1667 FilePath::StringType path;
1667 int location_value; 1668 int location_value;
1668 if (!ext->GetInteger(kPrefLocation, &location_value)) 1669 if (!ext->GetInteger(kPrefLocation, &location_value))
1669 return scoped_ptr<ExtensionInfo>(); 1670 return scoped_ptr<ExtensionInfo>();
1670 1671
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
2313 const ExtensionIdList& strings) { 2314 const ExtensionIdList& strings) {
2314 ListPrefUpdate update(prefs_, pref); 2315 ListPrefUpdate update(prefs_, pref);
2315 ListValue* list_of_values = update.Get(); 2316 ListValue* list_of_values = update.Get();
2316 list_of_values->Clear(); 2317 list_of_values->Clear();
2317 for (ExtensionIdList::const_iterator iter = strings.begin(); 2318 for (ExtensionIdList::const_iterator iter = strings.begin();
2318 iter != strings.end(); ++iter) 2319 iter != strings.end(); ++iter)
2319 list_of_values->Append(new StringValue(*iter)); 2320 list_of_values->Append(new StringValue(*iter));
2320 } 2321 }
2321 2322
2322 } // namespace extensions 2323 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/component_loader_unittest.cc ('k') | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698