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

Side by Side Diff: components/content_settings/core/common/content_settings.cc

Issue 2129153002: Improve the comments around content settings histograms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | components/content_settings/core/common/content_settings_types.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "components/content_settings/core/common/content_settings.h" 5 #include "components/content_settings/core/common/content_settings.h"
6 6
7 #include "base/containers/hash_tables.h" 7 #include "base/containers/hash_tables.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 12
13 ContentSetting IntToContentSetting(int content_setting) { 13 ContentSetting IntToContentSetting(int content_setting) {
14 return ((content_setting < 0) || 14 return ((content_setting < 0) ||
15 (content_setting >= CONTENT_SETTING_NUM_SETTINGS)) ? 15 (content_setting >= CONTENT_SETTING_NUM_SETTINGS)) ?
16 CONTENT_SETTING_DEFAULT : static_cast<ContentSetting>(content_setting); 16 CONTENT_SETTING_DEFAULT : static_cast<ContentSetting>(content_setting);
17 } 17 }
18 18
19 // WARNING: This array should not be reordered or removed as it is used for 19 // WARNING: This array should not be reordered or removed as it is used for
20 // histogram values. If a ContentSettingsType value has been removed, the entry 20 // histogram values. New content setting types must be added to the end.
21 // must be replaced by a placeholder. It should correspond directly to the 21 // If a ContentSettingsType value has been removed, the entry must be replaced
22 // ContentType enum in histograms.xml. 22 // by a placeholder.
23 // TODO(raymes): We should use a sparse histogram here on the hash of the 23 // TODO(raymes): We should use a sparse histogram here on the hash of the
24 // content settings type name instead. 24 // content settings type name instead.
25 ContentSettingsType kHistogramOrder[] = { 25 ContentSettingsType kHistogramOrder[] = {
26 CONTENT_SETTINGS_TYPE_COOKIES, 26 CONTENT_SETTINGS_TYPE_COOKIES,
27 CONTENT_SETTINGS_TYPE_IMAGES, 27 CONTENT_SETTINGS_TYPE_IMAGES,
28 CONTENT_SETTINGS_TYPE_JAVASCRIPT, 28 CONTENT_SETTINGS_TYPE_JAVASCRIPT,
29 CONTENT_SETTINGS_TYPE_PLUGINS, 29 CONTENT_SETTINGS_TYPE_PLUGINS,
30 CONTENT_SETTINGS_TYPE_POPUPS, 30 CONTENT_SETTINGS_TYPE_POPUPS,
31 CONTENT_SETTINGS_TYPE_GEOLOCATION, 31 CONTENT_SETTINGS_TYPE_GEOLOCATION,
32 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, 32 CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
33 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, 33 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE,
34 CONTENT_SETTINGS_TYPE_FULLSCREEN, 34 CONTENT_SETTINGS_TYPE_FULLSCREEN,
35 CONTENT_SETTINGS_TYPE_MOUSELOCK, 35 CONTENT_SETTINGS_TYPE_MOUSELOCK,
36 CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, 36 CONTENT_SETTINGS_TYPE_MIXEDSCRIPT,
37 CONTENT_SETTINGS_TYPE_DEFAULT, // MEDIASTREAM (removed). 37 CONTENT_SETTINGS_TYPE_DEFAULT, // MEDIASTREAM (removed).
38 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, 38 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
39 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, 39 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA,
40 CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, 40 CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS,
41 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, 41 CONTENT_SETTINGS_TYPE_PPAPI_BROKER,
42 CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, 42 CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS,
43 CONTENT_SETTINGS_TYPE_MIDI_SYSEX, 43 CONTENT_SETTINGS_TYPE_MIDI_SYSEX,
44 CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, 44 CONTENT_SETTINGS_TYPE_PUSH_MESSAGING,
45 CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, 45 CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS,
46 CONTENT_SETTINGS_TYPE_DEFAULT, // METRO_SWITCH_TO_DESKTOP (deprecated). 46 CONTENT_SETTINGS_TYPE_DEFAULT, // METRO_SWITCH_TO_DESKTOP (removed).
47 #if defined(OS_ANDROID) || defined(OS_CHROMEOS)
48 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, 47 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER,
49 #else
50 CONTENT_SETTINGS_TYPE_DEFAULT, // PROTECTED_MEDIA_IDENTIFIER (mobile only).
51 #endif
52 CONTENT_SETTINGS_TYPE_APP_BANNER, 48 CONTENT_SETTINGS_TYPE_APP_BANNER,
53 CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, 49 CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT,
54 CONTENT_SETTINGS_TYPE_DURABLE_STORAGE, 50 CONTENT_SETTINGS_TYPE_DURABLE_STORAGE,
55 CONTENT_SETTINGS_TYPE_KEYGEN, 51 CONTENT_SETTINGS_TYPE_KEYGEN,
56 CONTENT_SETTINGS_TYPE_BLUETOOTH_GUARD, 52 CONTENT_SETTINGS_TYPE_BLUETOOTH_GUARD,
57 CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC, 53 CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC,
58 CONTENT_SETTINGS_TYPE_AUTOPLAY, 54 CONTENT_SETTINGS_TYPE_AUTOPLAY,
59 }; 55 };
60 56
61 int ContentSettingTypeToHistogramValue(ContentSettingsType content_setting, 57 int ContentSettingTypeToHistogramValue(ContentSettingsType content_setting,
(...skipping 28 matching lines...) Expand all
90 ContentSettingPatternSource::ContentSettingPatternSource() 86 ContentSettingPatternSource::ContentSettingPatternSource()
91 : setting(CONTENT_SETTING_DEFAULT), incognito(false) { 87 : setting(CONTENT_SETTING_DEFAULT), incognito(false) {
92 } 88 }
93 89
94 ContentSettingPatternSource::ContentSettingPatternSource( 90 ContentSettingPatternSource::ContentSettingPatternSource(
95 const ContentSettingPatternSource& other) = default; 91 const ContentSettingPatternSource& other) = default;
96 92
97 RendererContentSettingRules::RendererContentSettingRules() {} 93 RendererContentSettingRules::RendererContentSettingRules() {}
98 94
99 RendererContentSettingRules::~RendererContentSettingRules() {} 95 RendererContentSettingRules::~RendererContentSettingRules() {}
OLDNEW
« no previous file with comments | « no previous file | components/content_settings/core/common/content_settings_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698