| 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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 if (notification_image.IsEmpty()) { | 435 if (notification_image.IsEmpty()) { |
| 436 notification_image = | 436 notification_image = |
| 437 extension->is_app() ? gfx::Image(util::GetDefaultAppIcon()) | 437 extension->is_app() ? gfx::Image(util::GetDefaultAppIcon()) |
| 438 : gfx::Image(util::GetDefaultExtensionIcon()); | 438 : gfx::Image(util::GetDefaultExtensionIcon()); |
| 439 } | 439 } |
| 440 | 440 |
| 441 scoped_ptr<message_center::Notification> notification; | 441 scoped_ptr<message_center::Notification> notification; |
| 442 notification.reset(new message_center::Notification( | 442 notification.reset(new message_center::Notification( |
| 443 message_center::NOTIFICATION_TYPE_SIMPLE, notification_id, | 443 message_center::NOTIFICATION_TYPE_SIMPLE, notification_id, |
| 444 l10n_util::GetStringUTF16(IDS_EXTENSION_STORAGE_MONITOR_TITLE), | 444 l10n_util::GetStringUTF16(IDS_EXTENSION_STORAGE_MONITOR_TITLE), |
| 445 l10n_util::GetStringFUTF16(IDS_EXTENSION_STORAGE_MONITOR_TEXT, | 445 l10n_util::GetStringFUTF16( |
| 446 base::UTF8ToUTF16(extension->name()), | 446 IDS_EXTENSION_STORAGE_MONITOR_TEXT, |
| 447 base::IntToString16(current_usage / kMBytes)), | 447 base::UTF8ToUTF16(extension->name()), |
| 448 base::Int64ToString16(current_usage / kMBytes)), |
| 448 notification_image, base::string16() /* display source */, GURL(), | 449 notification_image, base::string16() /* display source */, GURL(), |
| 449 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, | 450 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, |
| 450 kSystemNotifierId), | 451 kSystemNotifierId), |
| 451 notification_data, | 452 notification_data, |
| 452 new message_center::HandleNotificationButtonClickDelegate( | 453 new message_center::HandleNotificationButtonClickDelegate( |
| 453 base::Bind(&ExtensionStorageMonitor::OnNotificationButtonClick, | 454 base::Bind(&ExtensionStorageMonitor::OnNotificationButtonClick, |
| 454 weak_ptr_factory_.GetWeakPtr(), extension_id)))); | 455 weak_ptr_factory_.GetWeakPtr(), extension_id)))); |
| 455 notification->SetSystemPriority(); | 456 notification->SetSystemPriority(); |
| 456 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); | 457 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); |
| 457 | 458 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 void ExtensionStorageMonitor::SetStorageNotificationEnabled( | 664 void ExtensionStorageMonitor::SetStorageNotificationEnabled( |
| 664 const std::string& extension_id, | 665 const std::string& extension_id, |
| 665 bool enable_notifications) { | 666 bool enable_notifications) { |
| 666 extension_prefs_->UpdateExtensionPref( | 667 extension_prefs_->UpdateExtensionPref( |
| 667 extension_id, | 668 extension_id, |
| 668 kPrefDisableStorageNotifications, | 669 kPrefDisableStorageNotifications, |
| 669 enable_notifications ? NULL : new base::FundamentalValue(true)); | 670 enable_notifications ? NULL : new base::FundamentalValue(true)); |
| 670 } | 671 } |
| 671 | 672 |
| 672 } // namespace extensions | 673 } // namespace extensions |
| OLD | NEW |