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

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

Issue 2791623004: [sensors][permission] Add new permission types in permission module. (Closed)
Patch Set: Use 1 single permissionName SENSORS, add ContentSettings Created 3 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
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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 10 matching lines...) Expand all
21 21
22 // WARNING: The value specified here for a type should match exactly the value 22 // WARNING: The value specified here for a type should match exactly the value
23 // specified in the ContentType enum in histograms.xml. Since these values are 23 // specified in the ContentType enum in histograms.xml. Since these values are
24 // used for histograms, please do not reuse the same value for a different 24 // used for histograms, please do not reuse the same value for a different
25 // content setting. Always append to the end and increment. 25 // content setting. Always append to the end and increment.
26 // 26 //
27 // TODO(raymes): We should use a sparse histogram here on the hash of the 27 // TODO(raymes): We should use a sparse histogram here on the hash of the
28 // content settings type name instead. 28 // content settings type name instead.
29 // 29 //
30 // The array size must be explicit for the static_asserts below. 30 // The array size must be explicit for the static_asserts below.
31 constexpr size_t kNumHistogramValues = 30; 31 constexpr size_t kNumHistogramValues = 31;
32 constexpr HistogramValue kHistogramValue[kNumHistogramValues] = { 32 constexpr HistogramValue kHistogramValue[kNumHistogramValues] = {
33 {CONTENT_SETTINGS_TYPE_COOKIES, 0}, 33 {CONTENT_SETTINGS_TYPE_COOKIES, 0},
34 {CONTENT_SETTINGS_TYPE_IMAGES, 1}, 34 {CONTENT_SETTINGS_TYPE_IMAGES, 1},
35 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, 2}, 35 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, 2},
36 {CONTENT_SETTINGS_TYPE_PLUGINS, 3}, 36 {CONTENT_SETTINGS_TYPE_PLUGINS, 3},
37 {CONTENT_SETTINGS_TYPE_POPUPS, 4}, 37 {CONTENT_SETTINGS_TYPE_POPUPS, 4},
38 {CONTENT_SETTINGS_TYPE_GEOLOCATION, 5}, 38 {CONTENT_SETTINGS_TYPE_GEOLOCATION, 5},
39 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, 6}, 39 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, 6},
40 {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, 7}, 40 {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, 7},
41 {CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, 10}, 41 {CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, 10},
(...skipping 11 matching lines...) Expand all
53 {CONTENT_SETTINGS_TYPE_BLUETOOTH_GUARD, 26}, 53 {CONTENT_SETTINGS_TYPE_BLUETOOTH_GUARD, 26},
54 {CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC, 27}, 54 {CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC, 27},
55 {CONTENT_SETTINGS_TYPE_AUTOPLAY, 28}, 55 {CONTENT_SETTINGS_TYPE_AUTOPLAY, 28},
56 {CONTENT_SETTINGS_TYPE_IMPORTANT_SITE_INFO, 30}, 56 {CONTENT_SETTINGS_TYPE_IMPORTANT_SITE_INFO, 30},
57 {CONTENT_SETTINGS_TYPE_PERMISSION_AUTOBLOCKER_DATA, 31}, 57 {CONTENT_SETTINGS_TYPE_PERMISSION_AUTOBLOCKER_DATA, 31},
58 {CONTENT_SETTINGS_TYPE_ADS, 32}, 58 {CONTENT_SETTINGS_TYPE_ADS, 32},
59 {CONTENT_SETTINGS_TYPE_ADS_DATA, 33}, 59 {CONTENT_SETTINGS_TYPE_ADS_DATA, 33},
60 {CONTENT_SETTINGS_TYPE_PASSWORD_PROTECTION, 34}, 60 {CONTENT_SETTINGS_TYPE_PASSWORD_PROTECTION, 34},
61 {CONTENT_SETTINGS_TYPE_MEDIA_ENGAGEMENT, 35}, 61 {CONTENT_SETTINGS_TYPE_MEDIA_ENGAGEMENT, 35},
62 {CONTENT_SETTINGS_TYPE_SOUND, 36}, 62 {CONTENT_SETTINGS_TYPE_SOUND, 36},
63 {CONTENT_SETTINGS_TYPE_SENSORS, 37},
63 }; 64 };
64 65
65 } // namespace 66 } // namespace
66 67
67 ContentSetting IntToContentSetting(int content_setting) { 68 ContentSetting IntToContentSetting(int content_setting) {
68 return ((content_setting < 0) || 69 return ((content_setting < 0) ||
69 (content_setting >= CONTENT_SETTING_NUM_SETTINGS)) 70 (content_setting >= CONTENT_SETTING_NUM_SETTINGS))
70 ? CONTENT_SETTING_DEFAULT 71 ? CONTENT_SETTING_DEFAULT
71 : static_cast<ContentSetting>(content_setting); 72 : static_cast<ContentSetting>(content_setting);
72 } 73 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 128
128 ContentSettingPatternSource::~ContentSettingPatternSource() {} 129 ContentSettingPatternSource::~ContentSettingPatternSource() {}
129 130
130 ContentSetting ContentSettingPatternSource::GetContentSetting() const { 131 ContentSetting ContentSettingPatternSource::GetContentSetting() const {
131 return content_settings::ValueToContentSetting(setting_value.get()); 132 return content_settings::ValueToContentSetting(setting_value.get());
132 } 133 }
133 134
134 RendererContentSettingRules::RendererContentSettingRules() {} 135 RendererContentSettingRules::RendererContentSettingRules() {}
135 136
136 RendererContentSettingRules::~RendererContentSettingRules() {} 137 RendererContentSettingRules::~RendererContentSettingRules() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698