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/ui/webui/options/website_settings_handler.h" | 5 #include "chrome/browser/ui/webui/options/website_settings_handler.h" |
6 | 6 |
7 #include "chrome/browser/content_settings/content_settings_utils.h" | 7 #include "chrome/browser/content_settings/content_settings_utils.h" |
8 #include "chrome/browser/content_settings/host_content_settings_map.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 for (std::map<GURL, int>::iterator it = percent_map.begin(); | 676 for (std::map<GURL, int>::iterator it = percent_map.begin(); |
677 it != percent_map.end(); | 677 it != percent_map.end(); |
678 ++it) { | 678 ++it) { |
679 std::string origin = it->first.spec(); | 679 std::string origin = it->first.spec(); |
680 | 680 |
681 if (origin.find(last_filter_) == base::string16::npos) | 681 if (origin.find(last_filter_) == base::string16::npos) |
682 continue; | 682 continue; |
683 | 683 |
684 base::DictionaryValue* origin_entry = new base::DictionaryValue(); | 684 base::DictionaryValue* origin_entry = new base::DictionaryValue(); |
685 origin_entry->SetInteger("usage", it->second); | 685 origin_entry->SetInteger("usage", it->second); |
686 origin_entry->SetString( | 686 if (it->second == 0) { |
687 "usageString", | 687 origin_entry->SetString( |
688 l10n_util::GetStringFUTF16Int(IDS_WEBSITE_SETTINGS_BATTERY_PERCENT, | 688 "usageString", |
689 it->second)); | 689 l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_BATTERY_ZERO_PERCENT)); |
| 690 } else { |
| 691 origin_entry->SetString( |
| 692 "usageString", |
| 693 l10n_util::GetStringFUTF16Int(IDS_WEBSITE_SETTINGS_BATTERY_PERCENT, |
| 694 it->second)); |
| 695 } |
690 origin_entry->SetStringWithoutPathExpansion("readableName", | 696 origin_entry->SetStringWithoutPathExpansion("readableName", |
691 GetReadableName(it->first)); | 697 GetReadableName(it->first)); |
692 power_map.SetWithoutPathExpansion(origin, origin_entry); | 698 power_map.SetWithoutPathExpansion(origin, origin_entry); |
693 } | 699 } |
694 web_ui()->CallJavascriptFunction("WebsiteSettingsManager.populateOrigins", | 700 web_ui()->CallJavascriptFunction("WebsiteSettingsManager.populateOrigins", |
695 power_map); | 701 power_map); |
696 } | 702 } |
697 | 703 |
698 std::string WebsiteSettingsHandler::GetSettingDefaultFromModel( | 704 std::string WebsiteSettingsHandler::GetSettingDefaultFromModel( |
699 ContentSettingsType type, | 705 ContentSettingsType type, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 // If extension is NULL, it was removed and we cannot look up its name. | 772 // If extension is NULL, it was removed and we cannot look up its name. |
767 if (!extension) | 773 if (!extension) |
768 return site_url.spec(); | 774 return site_url.spec(); |
769 | 775 |
770 return extension->name(); | 776 return extension->name(); |
771 } | 777 } |
772 return site_url.spec(); | 778 return site_url.spec(); |
773 } | 779 } |
774 | 780 |
775 } // namespace options | 781 } // namespace options |
OLD | NEW |