OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/website_settings/website_settings.h" | 5 #include "chrome/browser/ui/website_settings/website_settings.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 rappor::SampleDomainAndRegistryFromGURL( | 261 rappor::SampleDomainAndRegistryFromGURL( |
262 g_browser_process->rappor_service(), rappor_metric, this->site_url_); | 262 g_browser_process->rappor_service(), rappor_metric, this->site_url_); |
263 } | 263 } |
264 } | 264 } |
265 | 265 |
266 // This is technically redundant given the histogram above, but putting the | 266 // This is technically redundant given the histogram above, but putting the |
267 // total count of permission changes in another histogram makes it easier to | 267 // total count of permission changes in another histogram makes it easier to |
268 // compare it against other kinds of actions in WebsiteSettings[PopupView]. | 268 // compare it against other kinds of actions in WebsiteSettings[PopupView]. |
269 RecordWebsiteSettingsAction(WEBSITE_SETTINGS_CHANGED_PERMISSION); | 269 RecordWebsiteSettingsAction(WEBSITE_SETTINGS_CHANGED_PERMISSION); |
270 | 270 |
271 // TODO(raymes): The scoping here should be a property of ContentSettingsInfo. | 271 content_settings_->SetNarrowestContentSetting(site_url_, site_url_, type, |
272 // Make this happen! crbug.com/444742. | 272 setting); |
273 ContentSettingsPattern primary_pattern; | |
274 ContentSettingsPattern secondary_pattern; | |
275 if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION || | |
276 type == CONTENT_SETTINGS_TYPE_MIDI_SYSEX || | |
277 type == CONTENT_SETTINGS_TYPE_FULLSCREEN) { | |
278 // TODO(markusheintz): The rule we create here should also change the | |
279 // location permission for iframed content. | |
280 primary_pattern = ContentSettingsPattern::FromURLNoWildcard(site_url_); | |
281 secondary_pattern = ContentSettingsPattern::FromURLNoWildcard(site_url_); | |
282 } else if (type == CONTENT_SETTINGS_TYPE_IMAGES || | |
283 type == CONTENT_SETTINGS_TYPE_JAVASCRIPT || | |
284 type == CONTENT_SETTINGS_TYPE_PLUGINS || | |
285 type == CONTENT_SETTINGS_TYPE_POPUPS || | |
286 type == CONTENT_SETTINGS_TYPE_MOUSELOCK || | |
287 type == CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS || | |
288 type == CONTENT_SETTINGS_TYPE_PUSH_MESSAGING) { | |
289 primary_pattern = ContentSettingsPattern::FromURL(site_url_); | |
290 secondary_pattern = ContentSettingsPattern::Wildcard(); | |
291 } else if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || | |
292 type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA || | |
293 type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { | |
294 primary_pattern = ContentSettingsPattern::FromURLNoWildcard(site_url_); | |
295 secondary_pattern = ContentSettingsPattern::Wildcard(); | |
296 } else { | |
297 NOTREACHED() << "ContentSettingsType " << type << "is not supported."; | |
298 } | |
299 | |
300 // Permission settings are specified via rules. There exists always at least | |
301 // one rule for the default setting. Get the rule that currently defines | |
302 // the permission for the given permission |type|. Then test whether the | |
303 // existing rule is more specific than the rule we are about to create. If | |
304 // the existing rule is more specific, than change the existing rule instead | |
305 // of creating a new rule that would be hidden behind the existing rule. | |
306 content_settings::SettingInfo info; | |
307 scoped_ptr<base::Value> v = | |
308 content_settings_->GetWebsiteSetting( | |
309 site_url_, site_url_, type, std::string(), &info); | |
310 content_settings_->SetNarrowestWebsiteSetting( | |
311 primary_pattern, secondary_pattern, type, std::string(), setting, info); | |
312 | 273 |
313 show_info_bar_ = true; | 274 show_info_bar_ = true; |
314 | 275 |
315 // Refresh the UI to reflect the new setting. | 276 // Refresh the UI to reflect the new setting. |
316 PresentSitePermissions(); | 277 PresentSitePermissions(); |
317 } | 278 } |
318 | 279 |
319 void WebsiteSettings::OnSiteDataAccessed() { | 280 void WebsiteSettings::OnSiteDataAccessed() { |
320 PresentSiteData(); | 281 PresentSiteData(); |
321 } | 282 } |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 info.connection_status = site_connection_status_; | 699 info.connection_status = site_connection_status_; |
739 info.connection_status_description = | 700 info.connection_status_description = |
740 UTF16ToUTF8(site_connection_details_); | 701 UTF16ToUTF8(site_connection_details_); |
741 info.identity_status = site_identity_status_; | 702 info.identity_status = site_identity_status_; |
742 info.identity_status_description = | 703 info.identity_status_description = |
743 UTF16ToUTF8(site_identity_details_); | 704 UTF16ToUTF8(site_identity_details_); |
744 info.cert_id = cert_id_; | 705 info.cert_id = cert_id_; |
745 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; | 706 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; |
746 ui_->SetIdentityInfo(info); | 707 ui_->SetIdentityInfo(info); |
747 } | 708 } |
OLD | NEW |