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

Side by Side Diff: chrome/browser/content_settings/tab_specific_content_settings.cc

Issue 659573003: Log mixed script shield events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Give the MixedScriptAction enum a name. Created 6 years, 2 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
OLDNEW
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 STATIC_CONST_MEMBER_DEFINITION const 57 STATIC_CONST_MEMBER_DEFINITION const
57 TabSpecificContentSettings::MicrophoneCameraState 58 TabSpecificContentSettings::MicrophoneCameraState
58 TabSpecificContentSettings::MICROPHONE_BLOCKED; 59 TabSpecificContentSettings::MICROPHONE_BLOCKED;
59 STATIC_CONST_MEMBER_DEFINITION const 60 STATIC_CONST_MEMBER_DEFINITION const
60 TabSpecificContentSettings::MicrophoneCameraState 61 TabSpecificContentSettings::MicrophoneCameraState
61 TabSpecificContentSettings::CAMERA_ACCESSED; 62 TabSpecificContentSettings::CAMERA_ACCESSED;
62 STATIC_CONST_MEMBER_DEFINITION const 63 STATIC_CONST_MEMBER_DEFINITION const
63 TabSpecificContentSettings::MicrophoneCameraState 64 TabSpecificContentSettings::MicrophoneCameraState
64 TabSpecificContentSettings::CAMERA_BLOCKED; 65 TabSpecificContentSettings::CAMERA_BLOCKED;
65 66
67
68 void TabSpecificContentSettings::RecordMixedScriptAction(
69 MixedScriptAction action) {
70 UMA_HISTOGRAM_ENUMERATION("ContentSettings.MixedScript",
71 action,
72 MIXEDSCRIPT_NUM_ACTIONS);
73 }
74
66 TabSpecificContentSettings::SiteDataObserver::SiteDataObserver( 75 TabSpecificContentSettings::SiteDataObserver::SiteDataObserver(
67 TabSpecificContentSettings* tab_specific_content_settings) 76 TabSpecificContentSettings* tab_specific_content_settings)
68 : tab_specific_content_settings_(tab_specific_content_settings) { 77 : tab_specific_content_settings_(tab_specific_content_settings) {
69 tab_specific_content_settings_->AddSiteDataObserver(this); 78 tab_specific_content_settings_->AddSiteDataObserver(this);
70 } 79 }
71 80
72 TabSpecificContentSettings::SiteDataObserver::~SiteDataObserver() { 81 TabSpecificContentSettings::SiteDataObserver::~SiteDataObserver() {
73 if (tab_specific_content_settings_) 82 if (tab_specific_content_settings_)
74 tab_specific_content_settings_->RemoveSiteDataObserver(this); 83 tab_specific_content_settings_->RemoveSiteDataObserver(this);
75 } 84 }
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 } 326 }
318 #endif 327 #endif
319 328
320 if (!content_blocked_[type]) { 329 if (!content_blocked_[type]) {
321 content_blocked_[type] = true; 330 content_blocked_[type] = true;
322 // TODO: it would be nice to have a way of mocking this in tests. 331 // TODO: it would be nice to have a way of mocking this in tests.
323 content::NotificationService::current()->Notify( 332 content::NotificationService::current()->Notify(
324 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, 333 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED,
325 content::Source<WebContents>(web_contents()), 334 content::Source<WebContents>(web_contents()),
326 content::NotificationService::NoDetails()); 335 content::NotificationService::NoDetails());
336
337 if (type == CONTENT_SETTINGS_TYPE_MIXEDSCRIPT) {
338 RecordMixedScriptAction(MIXEDSCRIPT_DISPLAYED_SHIELD);
339 }
327 } 340 }
328 } 341 }
329 342
330 void TabSpecificContentSettings::OnContentAllowed(ContentSettingsType type) { 343 void TabSpecificContentSettings::OnContentAllowed(ContentSettingsType type) {
331 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION) 344 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION)
332 << "Geolocation settings handled by OnGeolocationPermissionSet"; 345 << "Geolocation settings handled by OnGeolocationPermissionSet";
333 DCHECK(type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC && 346 DCHECK(type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC &&
334 type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) 347 type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)
335 << "Media stream settings handled by OnMediaStreamPermissionSet"; 348 << "Media stream settings handled by OnMediaStreamPermissionSet";
336 bool access_changed = false; 349 bool access_changed = false;
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 } 780 }
768 781
769 void TabSpecificContentSettings::RemoveSiteDataObserver( 782 void TabSpecificContentSettings::RemoveSiteDataObserver(
770 SiteDataObserver* observer) { 783 SiteDataObserver* observer) {
771 observer_list_.RemoveObserver(observer); 784 observer_list_.RemoveObserver(observer);
772 } 785 }
773 786
774 void TabSpecificContentSettings::NotifySiteDataObservers() { 787 void TabSpecificContentSettings::NotifySiteDataObservers() {
775 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed()); 788 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed());
776 } 789 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698