| OLD | NEW |
| 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/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 UpdateExtensionPref(extension_id, kPrefAppNotificationClientId, | 656 UpdateExtensionPref(extension_id, kPrefAppNotificationClientId, |
| 657 Value::CreateStringValue(oauth_client_id)); | 657 Value::CreateStringValue(oauth_client_id)); |
| 658 } | 658 } |
| 659 | 659 |
| 660 bool ExtensionPrefs::IsAppNotificationDisabled( | 660 bool ExtensionPrefs::IsAppNotificationDisabled( |
| 661 const std::string& extension_id) const { | 661 const std::string& extension_id) const { |
| 662 return ReadExtensionPrefBoolean(extension_id, kPrefAppNotificationDisbaled); | 662 return ReadExtensionPrefBoolean(extension_id, kPrefAppNotificationDisbaled); |
| 663 } | 663 } |
| 664 | 664 |
| 665 void ExtensionPrefs::SetAppNotificationDisabled( | 665 void ExtensionPrefs::SetAppNotificationDisabled( |
| 666 const std::string& extension_id, bool value) { | 666 const std::string& extension_id, bool value) { |
| 667 DCHECK(Extension::IdIsValid(extension_id)); | 667 DCHECK(Extension::IdIsValid(extension_id)); |
| 668 UpdateExtensionPref(extension_id, kPrefAppNotificationDisbaled, | 668 UpdateExtensionPref(extension_id, kPrefAppNotificationDisbaled, |
| 669 Value::CreateBooleanValue(value)); | 669 Value::CreateBooleanValue(value)); |
| 670 } | 670 } |
| 671 | 671 |
| 672 std::string ExtensionPrefs::GetDebugPolicyProviderName() const { | 672 std::string ExtensionPrefs::GetDebugPolicyProviderName() const { |
| 673 #ifdef NDEBUG | 673 #ifdef NDEBUG |
| 674 NOTREACHED(); | 674 NOTREACHED(); |
| 675 return std::string(); | 675 return std::string(); |
| 676 #else | 676 #else |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1473 // We store prefs about LOAD extensions, but don't cache their manifest | 1473 // We store prefs about LOAD extensions, but don't cache their manifest |
| 1474 // since it may change on disk. | 1474 // since it may change on disk. |
| 1475 if (extension->location() != Extension::LOAD) { | 1475 if (extension->location() != Extension::LOAD) { |
| 1476 extension_dict->Set(kPrefManifest, | 1476 extension_dict->Set(kPrefManifest, |
| 1477 extension->manifest()->value()->DeepCopy()); | 1477 extension->manifest()->value()->DeepCopy()); |
| 1478 } | 1478 } |
| 1479 | 1479 |
| 1480 // Clear state that may be registered from a previous install. | 1480 // Clear state that may be registered from a previous install. |
| 1481 extension_dict->Remove(kRegisteredEvents, NULL); | 1481 extension_dict->Remove(kRegisteredEvents, NULL); |
| 1482 | 1482 |
| 1483 if (extension->is_app()) { | 1483 if (extension->ShouldDisplayInLauncher()) |
| 1484 syncer::StringOrdinal new_page_ordinal = page_ordinal.IsValid() ? | 1484 extension_sorting_->EnsureValidOrdinals(extension->id(), page_ordinal); |
| 1485 page_ordinal : extension_sorting_->GetNaturalAppPageOrdinal(); | |
| 1486 if (!extension_sorting_->GetPageOrdinal(id).IsValid()) | |
| 1487 extension_sorting_->SetPageOrdinal(id, new_page_ordinal); | |
| 1488 if (!extension_sorting_->GetAppLaunchOrdinal(id).IsValid()) | |
| 1489 extension_sorting_->SetAppLaunchOrdinal( | |
| 1490 id, extension_sorting_->CreateNextAppLaunchOrdinal(new_page_ordinal)); | |
| 1491 } | |
| 1492 | 1485 |
| 1493 extension_pref_value_map_->RegisterExtension( | 1486 extension_pref_value_map_->RegisterExtension( |
| 1494 id, install_time, initial_state == Extension::ENABLED); | 1487 id, install_time, initial_state == Extension::ENABLED); |
| 1495 content_settings_store_->RegisterExtension( | 1488 content_settings_store_->RegisterExtension( |
| 1496 id, install_time, initial_state == Extension::ENABLED); | 1489 id, install_time, initial_state == Extension::ENABLED); |
| 1497 } | 1490 } |
| 1498 | 1491 |
| 1499 void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id, | 1492 void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id, |
| 1500 const Extension::Location& location, | 1493 const Extension::Location& location, |
| 1501 bool external_uninstall) { | 1494 bool external_uninstall) { |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2206 const ExtensionIds& strings) { | 2199 const ExtensionIds& strings) { |
| 2207 ListPrefUpdate update(prefs_, pref); | 2200 ListPrefUpdate update(prefs_, pref); |
| 2208 ListValue* list_of_values = update.Get(); | 2201 ListValue* list_of_values = update.Get(); |
| 2209 list_of_values->Clear(); | 2202 list_of_values->Clear(); |
| 2210 for (ExtensionIds::const_iterator iter = strings.begin(); | 2203 for (ExtensionIds::const_iterator iter = strings.begin(); |
| 2211 iter != strings.end(); ++iter) | 2204 iter != strings.end(); ++iter) |
| 2212 list_of_values->Append(new StringValue(*iter)); | 2205 list_of_values->Append(new StringValue(*iter)); |
| 2213 } | 2206 } |
| 2214 | 2207 |
| 2215 } // namespace extensions | 2208 } // namespace extensions |
| OLD | NEW |