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 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 DCHECK(!uninstall_extension_id_.empty() || !did_start_uninstall); | 373 DCHECK(!uninstall_extension_id_.empty() || !did_start_uninstall); |
374 uninstall_extension_id_.clear(); | 374 uninstall_extension_id_.clear(); |
375 } | 375 } |
376 | 376 |
377 std::string ExtensionStorageMonitor::GetNotificationId( | 377 std::string ExtensionStorageMonitor::GetNotificationId( |
378 const std::string& extension_id) { | 378 const std::string& extension_id) { |
379 std::vector<std::string> placeholders; | 379 std::vector<std::string> placeholders; |
380 placeholders.push_back(context_->GetPath().BaseName().MaybeAsASCII()); | 380 placeholders.push_back(context_->GetPath().BaseName().MaybeAsASCII()); |
381 placeholders.push_back(extension_id); | 381 placeholders.push_back(extension_id); |
382 | 382 |
383 return ReplaceStringPlaceholders(kNotificationIdFormat, placeholders, NULL); | 383 return base::ReplaceStringPlaceholders( |
| 384 kNotificationIdFormat, placeholders, NULL); |
384 } | 385 } |
385 | 386 |
386 void ExtensionStorageMonitor::OnStorageThresholdExceeded( | 387 void ExtensionStorageMonitor::OnStorageThresholdExceeded( |
387 const std::string& extension_id, | 388 const std::string& extension_id, |
388 int64 next_threshold, | 389 int64 next_threshold, |
389 int64 current_usage) { | 390 int64 current_usage) { |
390 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 391 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
391 | 392 |
392 const Extension* extension = GetExtensionById(context_, extension_id); | 393 const Extension* extension = GetExtensionById(context_, extension_id); |
393 if (!extension) | 394 if (!extension) |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 void ExtensionStorageMonitor::SetStorageNotificationEnabled( | 666 void ExtensionStorageMonitor::SetStorageNotificationEnabled( |
666 const std::string& extension_id, | 667 const std::string& extension_id, |
667 bool enable_notifications) { | 668 bool enable_notifications) { |
668 extension_prefs_->UpdateExtensionPref( | 669 extension_prefs_->UpdateExtensionPref( |
669 extension_id, | 670 extension_id, |
670 kPrefDisableStorageNotifications, | 671 kPrefDisableStorageNotifications, |
671 enable_notifications ? NULL : new base::FundamentalValue(true)); | 672 enable_notifications ? NULL : new base::FundamentalValue(true)); |
672 } | 673 } |
673 | 674 |
674 } // namespace extensions | 675 } // namespace extensions |
OLD | NEW |