| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 /** | 5 /** |
| 6 * An example empty pref. | 6 * An example empty pref. |
| 7 * @type {SiteSettingsPref} | 7 * @type {SiteSettingsPref} |
| 8 */ | 8 */ |
| 9 var prefsEmpty = { | 9 var prefsEmpty = { |
| 10 defaults: { | 10 defaults: { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 for (var type in settings.ContentSettingsTypes) { | 67 for (var type in settings.ContentSettingsTypes) { |
| 68 cr.webUIListenerCallback( | 68 cr.webUIListenerCallback( |
| 69 'contentSettingSitePermissionChanged', | 69 'contentSettingSitePermissionChanged', |
| 70 settings.ContentSettingsTypes[type], | 70 settings.ContentSettingsTypes[type], |
| 71 ''); | 71 ''); |
| 72 } | 72 } |
| 73 }, | 73 }, |
| 74 | 74 |
| 75 /** @override */ | 75 /** @override */ |
| 76 setDefaultValueForContentType: function(contentType, defaultValue) { | 76 setDefaultValueForContentType: function(contentType, defaultValue) { |
| 77 if (contentType == settings.ContentSettingsTypes.CAMERA) | |
| 78 this.prefs_.defaults.media_stream_camera = defaultValue == 'allow'; | |
| 79 else if (contentType == settings.ContentSettingsTypes.COOKIES) | |
| 80 this.prefs_.defaults.cookies = defaultValue == 'allow'; | |
| 81 else if (contentType == settings.ContentSettingsTypes.FULLSCREEN) | |
| 82 this.prefs_.defaults.fullscreen = defaultValue == 'allow'; | |
| 83 else if (contentType == settings.ContentSettingsTypes.GEOLOCATION) | |
| 84 this.prefs_.defaults.geolocation = defaultValue == 'allow'; | |
| 85 else if (contentType == settings.ContentSettingsTypes.IMAGES) | |
| 86 this.prefs_.defaults.images = defaultValue == 'allow'; | |
| 87 else if (contentType == settings.ContentSettingsTypes.JAVASCRIPT) | |
| 88 this.prefs_.defaults.javascript = defaultValue == 'allow'; | |
| 89 else if (contentType == settings.ContentSettingsTypes.MIC) | |
| 90 this.prefs_.defaults.media_stream_mic = defaultValue == 'allow'; | |
| 91 else if (contentType == settings.ContentSettingsTypes.NOTIFICATIONS) | |
| 92 this.prefs_.defaults.notifications = defaultValue == 'allow'; | |
| 93 else if (contentType == settings.ContentSettingsTypes.POPUPS) | |
| 94 this.prefs_.defaults.popups = defaultValue == 'allow'; | |
| 95 else | |
| 96 console.log('setDefault received unknown category: ' + contentType); | |
| 97 | |
| 98 this.methodCalled( | 77 this.methodCalled( |
| 99 'setDefaultValueForContentType', [contentType, defaultValue]); | 78 'setDefaultValueForContentType', [contentType, defaultValue]); |
| 100 }, | 79 }, |
| 101 | 80 |
| 102 /** @override */ | 81 /** @override */ |
| 103 getDefaultValueForContentType: function(contentType) { | 82 getDefaultValueForContentType: function(contentType) { |
| 104 this.methodCalled('getDefaultValueForContentType', contentType); | 83 this.methodCalled('getDefaultValueForContentType', contentType); |
| 105 | 84 |
| 106 if (contentType == settings.ContentSettingsTypes.CAMERA) { | 85 if (contentType == settings.ContentSettingsTypes.CAMERA) { |
| 107 return Promise.resolve( | 86 return Promise.resolve( |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 }, | 145 }, |
| 167 | 146 |
| 168 /** @override */ | 147 /** @override */ |
| 169 setCategoryPermissionForOrigin: function( | 148 setCategoryPermissionForOrigin: function( |
| 170 primaryPattern, secondaryPattern, contentType, value) { | 149 primaryPattern, secondaryPattern, contentType, value) { |
| 171 this.methodCalled('setCategoryPermissionForOrigin', | 150 this.methodCalled('setCategoryPermissionForOrigin', |
| 172 [primaryPattern, secondaryPattern, contentType, value]); | 151 [primaryPattern, secondaryPattern, contentType, value]); |
| 173 return Promise.resolve(); | 152 return Promise.resolve(); |
| 174 }, | 153 }, |
| 175 }; | 154 }; |
| OLD | NEW |