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/content_settings/tab_specific_content_settings.h" | 5 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "base/metrics/histogram.h" | |
11 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
13 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" | 14 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" |
14 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" | 15 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" |
15 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" | 16 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" |
16 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" | 17 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" |
17 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" | 18 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" |
18 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" | 19 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" |
19 #include "chrome/browser/browsing_data/cookies_tree_model.h" | 20 #include "chrome/browser/browsing_data/cookies_tree_model.h" |
20 #include "chrome/browser/chrome_notification_types.h" | 21 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
317 } | 318 } |
318 #endif | 319 #endif |
319 | 320 |
320 if (!content_blocked_[type]) { | 321 if (!content_blocked_[type]) { |
321 content_blocked_[type] = true; | 322 content_blocked_[type] = true; |
322 // TODO: it would be nice to have a way of mocking this in tests. | 323 // TODO: it would be nice to have a way of mocking this in tests. |
323 content::NotificationService::current()->Notify( | 324 content::NotificationService::current()->Notify( |
324 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, | 325 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, |
325 content::Source<WebContents>(web_contents()), | 326 content::Source<WebContents>(web_contents()), |
326 content::NotificationService::NoDetails()); | 327 content::NotificationService::NoDetails()); |
328 | |
329 if (type == CONTENT_SETTINGS_TYPE_MIXEDSCRIPT) { | |
330 UMA_HISTOGRAM_ENUMERATION("ContentSettings.MixedScript", | |
331 MIXEDSCRIPT_DISPLAYED_SHIELD, | |
332 MIXEDSCRIPT_CONTENT_NUM_EVENTS); | |
Ilya Sherman
2014/10/16 03:24:51
Please define a wrapper function that emits to thi
| |
333 } | |
327 } | 334 } |
328 } | 335 } |
329 | 336 |
330 void TabSpecificContentSettings::OnContentAllowed(ContentSettingsType type) { | 337 void TabSpecificContentSettings::OnContentAllowed(ContentSettingsType type) { |
331 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION) | 338 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION) |
332 << "Geolocation settings handled by OnGeolocationPermissionSet"; | 339 << "Geolocation settings handled by OnGeolocationPermissionSet"; |
333 DCHECK(type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC && | 340 DCHECK(type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC && |
334 type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) | 341 type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) |
335 << "Media stream settings handled by OnMediaStreamPermissionSet"; | 342 << "Media stream settings handled by OnMediaStreamPermissionSet"; |
336 bool access_changed = false; | 343 bool access_changed = false; |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
767 } | 774 } |
768 | 775 |
769 void TabSpecificContentSettings::RemoveSiteDataObserver( | 776 void TabSpecificContentSettings::RemoveSiteDataObserver( |
770 SiteDataObserver* observer) { | 777 SiteDataObserver* observer) { |
771 observer_list_.RemoveObserver(observer); | 778 observer_list_.RemoveObserver(observer); |
772 } | 779 } |
773 | 780 |
774 void TabSpecificContentSettings::NotifySiteDataObservers() { | 781 void TabSpecificContentSettings::NotifySiteDataObservers() { |
775 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed()); | 782 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed()); |
776 } | 783 } |
OLD | NEW |