OLD | NEW |
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 "base/string_number_conversions.h" |
| 7 #include "base/utf_string_conversions.h" |
6 #include "chrome/browser/extensions/extension_prefs.h" | 8 #include "chrome/browser/extensions/extension_prefs.h" |
7 #include "chrome/common/extensions/extension.h" | 9 #include "chrome/common/extensions/extension.h" |
8 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
9 | 11 |
10 using base::Time; | 12 using base::Time; |
11 | 13 |
12 namespace { | 14 namespace { |
13 | 15 |
14 // Preferences keys | 16 // Preferences keys |
15 | 17 |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 } | 312 } |
311 return Time(); | 313 return Time(); |
312 } | 314 } |
313 | 315 |
314 void ExtensionPrefs::SetLastPingDayImpl(const Time& time, | 316 void ExtensionPrefs::SetLastPingDayImpl(const Time& time, |
315 DictionaryValue* dictionary) { | 317 DictionaryValue* dictionary) { |
316 if (!dictionary) { | 318 if (!dictionary) { |
317 NOTREACHED(); | 319 NOTREACHED(); |
318 return; | 320 return; |
319 } | 321 } |
320 std::string value = Int64ToString(time.ToInternalValue()); | 322 std::string value = base::Int64ToString(time.ToInternalValue()); |
321 dictionary->SetString(kLastPingDay, value); | 323 dictionary->SetString(kLastPingDay, value); |
322 prefs_->ScheduleSavePersistentPrefs(); | 324 prefs_->ScheduleSavePersistentPrefs(); |
323 } | 325 } |
324 | 326 |
325 Time ExtensionPrefs::LastPingDay(const std::string& extension_id) const { | 327 Time ExtensionPrefs::LastPingDay(const std::string& extension_id) const { |
326 DCHECK(Extension::IdIsValid(extension_id)); | 328 DCHECK(Extension::IdIsValid(extension_id)); |
327 return LastPingDayImpl(GetExtensionPref(extension_id)); | 329 return LastPingDayImpl(GetExtensionPref(extension_id)); |
328 } | 330 } |
329 | 331 |
330 Time ExtensionPrefs::BlacklistLastPingDay() const { | 332 Time ExtensionPrefs::BlacklistLastPingDay() const { |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 DictionaryValue* extension_prefs = GetExtensionPref(extension_id); | 690 DictionaryValue* extension_prefs = GetExtensionPref(extension_id); |
689 if (!extension_prefs) { | 691 if (!extension_prefs) { |
690 NOTREACHED(); | 692 NOTREACHED(); |
691 return; | 693 return; |
692 } | 694 } |
693 extension_prefs->Remove(kIdleInstallInfo, NULL); | 695 extension_prefs->Remove(kIdleInstallInfo, NULL); |
694 DictionaryValue* info = new DictionaryValue(); | 696 DictionaryValue* info = new DictionaryValue(); |
695 info->SetString(kIdleInstallInfoCrxPath, crx_path.value()); | 697 info->SetString(kIdleInstallInfoCrxPath, crx_path.value()); |
696 info->SetString(kIdleInstallInfoVersion, version); | 698 info->SetString(kIdleInstallInfoVersion, version); |
697 info->SetString(kIdleInstallInfoFetchTime, | 699 info->SetString(kIdleInstallInfoFetchTime, |
698 Int64ToString(fetch_time.ToInternalValue())); | 700 base::Int64ToString(fetch_time.ToInternalValue())); |
699 extension_prefs->Set(kIdleInstallInfo, info); | 701 extension_prefs->Set(kIdleInstallInfo, info); |
700 prefs_->ScheduleSavePersistentPrefs(); | 702 prefs_->ScheduleSavePersistentPrefs(); |
701 } | 703 } |
702 | 704 |
703 bool ExtensionPrefs::RemoveIdleInstallInfo(const std::string& extension_id) { | 705 bool ExtensionPrefs::RemoveIdleInstallInfo(const std::string& extension_id) { |
704 DictionaryValue* extension_prefs = GetExtensionPref(extension_id); | 706 DictionaryValue* extension_prefs = GetExtensionPref(extension_id); |
705 if (!extension_prefs) | 707 if (!extension_prefs) |
706 return false; | 708 return false; |
707 bool result = extension_prefs->Remove(kIdleInstallInfo, NULL); | 709 bool result = extension_prefs->Remove(kIdleInstallInfo, NULL); |
708 prefs_->ScheduleSavePersistentPrefs(); | 710 prefs_->ScheduleSavePersistentPrefs(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 | 781 |
780 | 782 |
781 // static | 783 // static |
782 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) { | 784 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) { |
783 prefs->RegisterDictionaryPref(kExtensionsPref); | 785 prefs->RegisterDictionaryPref(kExtensionsPref); |
784 prefs->RegisterListPref(kExtensionShelf); | 786 prefs->RegisterListPref(kExtensionShelf); |
785 prefs->RegisterListPref(kExtensionToolbar); | 787 prefs->RegisterListPref(kExtensionToolbar); |
786 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1); | 788 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1); |
787 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate); | 789 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate); |
788 } | 790 } |
OLD | NEW |