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

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

Issue 2819023: Reworked ExtensionsService::AddPendingExtension(). (Closed)
Patch Set: Fixed browsertest test failure Created 10 years, 6 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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/string_util.h" 5 #include "base/string_util.h"
6 #include "chrome/browser/extensions/extension_prefs.h" 6 #include "chrome/browser/extensions/extension_prefs.h"
7 #include "chrome/common/extensions/extension.h" 7 #include "chrome/common/extensions/extension.h"
8 #include "chrome/common/pref_names.h" 8 #include "chrome/common/pref_names.h"
9 9
10 using base::Time; 10 using base::Time;
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 const std::vector<std::string>& extension_ids) { 437 const std::vector<std::string>& extension_ids) {
438 ListValue* toolbar_order = prefs_->GetMutableList(kExtensionToolbar); 438 ListValue* toolbar_order = prefs_->GetMutableList(kExtensionToolbar);
439 toolbar_order->Clear(); 439 toolbar_order->Clear();
440 for (std::vector<std::string>::const_iterator iter = extension_ids.begin(); 440 for (std::vector<std::string>::const_iterator iter = extension_ids.begin();
441 iter != extension_ids.end(); ++iter) { 441 iter != extension_ids.end(); ++iter) {
442 toolbar_order->Append(new StringValue(*iter)); 442 toolbar_order->Append(new StringValue(*iter));
443 } 443 }
444 prefs_->ScheduleSavePersistentPrefs(); 444 prefs_->ScheduleSavePersistentPrefs();
445 } 445 }
446 446
447 void ExtensionPrefs::OnExtensionInstalled(Extension* extension) { 447 void ExtensionPrefs::OnExtensionInstalled(
448 Extension* extension, Extension::State initial_state,
449 bool initial_incognito_enabled) {
448 const std::string& id = extension->id(); 450 const std::string& id = extension->id();
449 // Make sure we don't enable a disabled extension. 451 UpdateExtensionPref(id, kPrefState,
450 if (GetExtensionState(extension->id()) != Extension::DISABLED) { 452 Value::CreateIntegerValue(initial_state));
451 UpdateExtensionPref(id, kPrefState, 453 UpdateExtensionPref(id, kPrefIncognitoEnabled,
452 Value::CreateIntegerValue(Extension::ENABLED)); 454 Value::CreateBooleanValue(initial_incognito_enabled));
453 }
454 UpdateExtensionPref(id, kPrefLocation, 455 UpdateExtensionPref(id, kPrefLocation,
455 Value::CreateIntegerValue(extension->location())); 456 Value::CreateIntegerValue(extension->location()));
456 FilePath::StringType path = MakePathRelative(install_directory_, 457 FilePath::StringType path = MakePathRelative(install_directory_,
457 extension->path(), NULL); 458 extension->path(), NULL);
458 UpdateExtensionPref(id, kPrefPath, Value::CreateStringValue(path)); 459 UpdateExtensionPref(id, kPrefPath, Value::CreateStringValue(path));
459 // We store prefs about LOAD extensions, but don't cache their manifest 460 // We store prefs about LOAD extensions, but don't cache their manifest
460 // since it may change on disk. 461 // since it may change on disk.
461 if (extension->location() != Extension::LOAD) { 462 if (extension->location() != Extension::LOAD) {
462 UpdateExtensionPref(id, kPrefManifest, 463 UpdateExtensionPref(id, kPrefManifest,
463 extension->manifest_value()->DeepCopy()); 464 extension->manifest_value()->DeepCopy());
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 808
808 809
809 // static 810 // static
810 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) { 811 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) {
811 prefs->RegisterDictionaryPref(kExtensionsPref); 812 prefs->RegisterDictionaryPref(kExtensionsPref);
812 prefs->RegisterListPref(kExtensionShelf); 813 prefs->RegisterListPref(kExtensionShelf);
813 prefs->RegisterListPref(kExtensionToolbar); 814 prefs->RegisterListPref(kExtensionToolbar);
814 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1); 815 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1);
815 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate); 816 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate);
816 } 817 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_prefs.h ('k') | chrome/browser/extensions/extension_prefs_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698