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

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: Refactor logging into new function. 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(int action) {
69 UMA_HISTOGRAM_ENUMERATION("ContentSettings.MixedScript",
70 action,
71 MIXEDSCRIPT_NUM_ACTIONS);
72 }
73
66 TabSpecificContentSettings::SiteDataObserver::SiteDataObserver( 74 TabSpecificContentSettings::SiteDataObserver::SiteDataObserver(
67 TabSpecificContentSettings* tab_specific_content_settings) 75 TabSpecificContentSettings* tab_specific_content_settings)
68 : tab_specific_content_settings_(tab_specific_content_settings) { 76 : tab_specific_content_settings_(tab_specific_content_settings) {
69 tab_specific_content_settings_->AddSiteDataObserver(this); 77 tab_specific_content_settings_->AddSiteDataObserver(this);
70 } 78 }
71 79
72 TabSpecificContentSettings::SiteDataObserver::~SiteDataObserver() { 80 TabSpecificContentSettings::SiteDataObserver::~SiteDataObserver() {
73 if (tab_specific_content_settings_) 81 if (tab_specific_content_settings_)
74 tab_specific_content_settings_->RemoveSiteDataObserver(this); 82 tab_specific_content_settings_->RemoveSiteDataObserver(this);
75 } 83 }
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 } 325 }
318 #endif 326 #endif
319 327
320 if (!content_blocked_[type]) { 328 if (!content_blocked_[type]) {
321 content_blocked_[type] = true; 329 content_blocked_[type] = true;
322 // TODO: it would be nice to have a way of mocking this in tests. 330 // TODO: it would be nice to have a way of mocking this in tests.
323 content::NotificationService::current()->Notify( 331 content::NotificationService::current()->Notify(
324 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, 332 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED,
325 content::Source<WebContents>(web_contents()), 333 content::Source<WebContents>(web_contents()),
326 content::NotificationService::NoDetails()); 334 content::NotificationService::NoDetails());
335
336 if (type == CONTENT_SETTINGS_TYPE_MIXEDSCRIPT) {
337 RecordMixedScriptAction(MIXEDSCRIPT_DISPLAYED_SHIELD);
338 }
327 } 339 }
328 } 340 }
329 341
330 void TabSpecificContentSettings::OnContentAllowed(ContentSettingsType type) { 342 void TabSpecificContentSettings::OnContentAllowed(ContentSettingsType type) {
331 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION) 343 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION)
332 << "Geolocation settings handled by OnGeolocationPermissionSet"; 344 << "Geolocation settings handled by OnGeolocationPermissionSet";
333 DCHECK(type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC && 345 DCHECK(type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC &&
334 type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) 346 type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)
335 << "Media stream settings handled by OnMediaStreamPermissionSet"; 347 << "Media stream settings handled by OnMediaStreamPermissionSet";
336 bool access_changed = false; 348 bool access_changed = false;
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 } 779 }
768 780
769 void TabSpecificContentSettings::RemoveSiteDataObserver( 781 void TabSpecificContentSettings::RemoveSiteDataObserver(
770 SiteDataObserver* observer) { 782 SiteDataObserver* observer) {
771 observer_list_.RemoveObserver(observer); 783 observer_list_.RemoveObserver(observer);
772 } 784 }
773 785
774 void TabSpecificContentSettings::NotifySiteDataObservers() { 786 void TabSpecificContentSettings::NotifySiteDataObservers() {
775 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed()); 787 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed());
776 } 788 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698