| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_storage_monitor.h" | 5 #include "chrome/browser/extensions/extension_storage_monitor.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 // exceeded. | 600 // exceeded. |
| 601 next_threshold = initial_extension_threshold_; | 601 next_threshold = initial_extension_threshold_; |
| 602 } | 602 } |
| 603 return next_threshold; | 603 return next_threshold; |
| 604 } | 604 } |
| 605 | 605 |
| 606 void ExtensionStorageMonitor::SetNextStorageThreshold( | 606 void ExtensionStorageMonitor::SetNextStorageThreshold( |
| 607 const std::string& extension_id, | 607 const std::string& extension_id, |
| 608 int64_t next_threshold) { | 608 int64_t next_threshold) { |
| 609 extension_prefs_->UpdateExtensionPref( | 609 extension_prefs_->UpdateExtensionPref( |
| 610 extension_id, | 610 extension_id, kPrefNextStorageThreshold, |
| 611 kPrefNextStorageThreshold, | 611 next_threshold > 0 ? new base::Value(base::Int64ToString(next_threshold)) |
| 612 next_threshold > 0 | 612 : NULL); |
| 613 ? new base::StringValue(base::Int64ToString(next_threshold)) | |
| 614 : NULL); | |
| 615 } | 613 } |
| 616 | 614 |
| 617 int64_t ExtensionStorageMonitor::GetNextStorageThresholdFromPrefs( | 615 int64_t ExtensionStorageMonitor::GetNextStorageThresholdFromPrefs( |
| 618 const std::string& extension_id) const { | 616 const std::string& extension_id) const { |
| 619 std::string next_threshold_str; | 617 std::string next_threshold_str; |
| 620 if (extension_prefs_->ReadPrefAsString( | 618 if (extension_prefs_->ReadPrefAsString( |
| 621 extension_id, kPrefNextStorageThreshold, &next_threshold_str)) { | 619 extension_id, kPrefNextStorageThreshold, &next_threshold_str)) { |
| 622 int64_t next_threshold; | 620 int64_t next_threshold; |
| 623 if (base::StringToInt64(next_threshold_str, &next_threshold)) | 621 if (base::StringToInt64(next_threshold_str, &next_threshold)) |
| 624 return next_threshold; | 622 return next_threshold; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 643 | 641 |
| 644 void ExtensionStorageMonitor::SetStorageNotificationEnabled( | 642 void ExtensionStorageMonitor::SetStorageNotificationEnabled( |
| 645 const std::string& extension_id, | 643 const std::string& extension_id, |
| 646 bool enable_notifications) { | 644 bool enable_notifications) { |
| 647 extension_prefs_->UpdateExtensionPref( | 645 extension_prefs_->UpdateExtensionPref( |
| 648 extension_id, kPrefDisableStorageNotifications, | 646 extension_id, kPrefDisableStorageNotifications, |
| 649 enable_notifications ? NULL : new base::Value(true)); | 647 enable_notifications ? NULL : new base::Value(true)); |
| 650 } | 648 } |
| 651 | 649 |
| 652 } // namespace extensions | 650 } // namespace extensions |
| OLD | NEW |