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/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "content/public/browser/web_ui.h" | 10 #include "content/public/browser/web_ui.h" |
| 11 #include "extensions/common/constants.h" |
11 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
12 #include "ui/base/l10n/time_format.h" | 13 #include "ui/base/l10n/time_format.h" |
13 #include "ui/base/text/bytes_formatting.h" | 14 #include "ui/base/text/bytes_formatting.h" |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
17 const char kPreferencesSource[] = "preference"; | 18 const char kPreferencesSource[] = "preference"; |
18 const char kStorage[] = "storage"; | 19 const char kStorage[] = "storage"; |
19 const ContentSettingsType kValidTypes[] = {CONTENT_SETTINGS_TYPE_GEOLOCATION, | 20 const ContentSettingsType kValidTypes[] = {CONTENT_SETTINGS_TYPE_GEOLOCATION, |
20 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | 21 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 for (ContentSettingsForOneType::const_iterator it = all_settings.begin(); | 131 for (ContentSettingsForOneType::const_iterator it = all_settings.begin(); |
131 it != all_settings.end(); | 132 it != all_settings.end(); |
132 ++it) { | 133 ++it) { |
133 // Don't add default settings. | 134 // Don't add default settings. |
134 if (it->primary_pattern == ContentSettingsPattern::Wildcard() && | 135 if (it->primary_pattern == ContentSettingsPattern::Wildcard() && |
135 it->secondary_pattern == ContentSettingsPattern::Wildcard() && | 136 it->secondary_pattern == ContentSettingsPattern::Wildcard() && |
136 it->source != kPreferencesSource) { | 137 it->source != kPreferencesSource) { |
137 continue; | 138 continue; |
138 } | 139 } |
139 | 140 |
140 std::string origin = it->primary_pattern.ToString(); | 141 std::string origin = |
| 142 it->primary_pattern.ToString(extensions::kExtensionScheme); |
141 | 143 |
142 // Mediastream isn't set unless both mic and camera are set to the same. | 144 // Mediastream isn't set unless both mic and camera are set to the same. |
143 if (last_setting == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) { | 145 if (last_setting == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) { |
144 GURL origin_url(origin); | 146 GURL origin_url(origin); |
145 ContentSetting cam_setting = | 147 ContentSetting cam_setting = |
146 settings->GetContentSetting(origin_url, | 148 settings->GetContentSetting(origin_url, |
147 origin_url, | 149 origin_url, |
148 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, | 150 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, |
149 std::string()); | 151 std::string()); |
150 if (it->setting != cam_setting) | 152 if (it->setting != cam_setting) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 "usage", new base::FundamentalValue(static_cast<double>(it->size))); | 189 "usage", new base::FundamentalValue(static_cast<double>(it->size))); |
188 origin_entry->SetWithoutPathExpansion( | 190 origin_entry->SetWithoutPathExpansion( |
189 "usageString", new base::StringValue(ui::FormatBytes(it->size))); | 191 "usageString", new base::StringValue(ui::FormatBytes(it->size))); |
190 local_storage_map.SetWithoutPathExpansion(origin, origin_entry); | 192 local_storage_map.SetWithoutPathExpansion(origin, origin_entry); |
191 } | 193 } |
192 web_ui()->CallJavascriptFunction("WebsiteSettingsManager.populateOrigins", | 194 web_ui()->CallJavascriptFunction("WebsiteSettingsManager.populateOrigins", |
193 local_storage_map); | 195 local_storage_map); |
194 } | 196 } |
195 | 197 |
196 } // namespace options | 198 } // namespace options |
OLD | NEW |