Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: chrome/browser/ui/webui/options/website_settings_handler.cc

Issue 440423003: Clean content_settings_pattern_parser.* from unnecessary dependencies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/common/chrome_content_settings_client.h"
10 #include "content/public/browser/web_ui.h" 11 #include "content/public/browser/web_ui.h"
11 #include "grit/generated_resources.h" 12 #include "grit/generated_resources.h"
12 #include "ui/base/text/bytes_formatting.h" 13 #include "ui/base/text/bytes_formatting.h"
13 14
14 namespace { 15 namespace {
15 16
16 const char kPreferencesSource[] = "preference"; 17 const char kPreferencesSource[] = "preference";
17 const char kStorage[] = "storage"; 18 const char kStorage[] = "storage";
18 const ContentSettingsType kValidTypes[] = {CONTENT_SETTINGS_TYPE_GEOLOCATION, 19 const ContentSettingsType kValidTypes[] = {CONTENT_SETTINGS_TYPE_GEOLOCATION,
19 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, 20 CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 for (ContentSettingsForOneType::const_iterator it = all_settings.begin(); 130 for (ContentSettingsForOneType::const_iterator it = all_settings.begin();
130 it != all_settings.end(); 131 it != all_settings.end();
131 ++it) { 132 ++it) {
132 // Don't add default settings. 133 // Don't add default settings.
133 if (it->primary_pattern == ContentSettingsPattern::Wildcard() && 134 if (it->primary_pattern == ContentSettingsPattern::Wildcard() &&
134 it->secondary_pattern == ContentSettingsPattern::Wildcard() && 135 it->secondary_pattern == ContentSettingsPattern::Wildcard() &&
135 it->source != kPreferencesSource) { 136 it->source != kPreferencesSource) {
136 continue; 137 continue;
137 } 138 }
138 139
139 std::string origin = it->primary_pattern.ToString(); 140 content_settings::ChromeContentSettingsClient client;
141 std::string origin = it->primary_pattern.ToString(&client);
140 142
141 // Mediastream isn't set unless both mic and camera are set to the same. 143 // Mediastream isn't set unless both mic and camera are set to the same.
142 if (last_setting == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) { 144 if (last_setting == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) {
143 GURL origin_url(origin); 145 GURL origin_url(origin);
144 ContentSetting cam_setting = 146 ContentSetting cam_setting =
145 settings->GetContentSetting(origin_url, 147 settings->GetContentSetting(origin_url,
146 origin_url, 148 origin_url,
147 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, 149 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA,
148 std::string()); 150 std::string());
149 if (it->setting != cam_setting) 151 if (it->setting != cam_setting)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 "usage", new base::FundamentalValue(static_cast<double>(it->size))); 183 "usage", new base::FundamentalValue(static_cast<double>(it->size)));
182 origin_entry->SetWithoutPathExpansion( 184 origin_entry->SetWithoutPathExpansion(
183 "usageString", new base::StringValue(ui::FormatBytes(it->size))); 185 "usageString", new base::StringValue(ui::FormatBytes(it->size)));
184 local_storage_map.SetWithoutPathExpansion(origin, origin_entry); 186 local_storage_map.SetWithoutPathExpansion(origin, origin_entry);
185 } 187 }
186 web_ui()->CallJavascriptFunction("WebsiteSettingsManager.populateOrigins", 188 web_ui()->CallJavascriptFunction("WebsiteSettingsManager.populateOrigins",
187 local_storage_map); 189 local_storage_map);
188 } 190 }
189 191
190 } // namespace options 192 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698