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

Side by Side Diff: chrome/browser/resources/settings/site_settings/add_site_dialog.js

Issue 2817103002: [MD settings] hide option for incognito on session only exceptions (Closed)
Patch Set: Created 3 years, 8 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 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 * @fileoverview 6 * @fileoverview
7 * 'add-site-dialog' provides a dialog to add exceptions for a given Content 7 * 'add-site-dialog' provides a dialog to add exceptions for a given Content
8 * Settings category. 8 * Settings category.
9 */ 9 */
10 Polymer({ 10 Polymer({
11 is: 'add-site-dialog', 11 is: 'add-site-dialog',
12 12
13 behaviors: [SiteSettingsBehavior, WebUIListenerBehavior], 13 behaviors: [SiteSettingsBehavior, WebUIListenerBehavior],
14 14
15 properties: { 15 properties: {
16 /** 16 /**
17 * What kind of setting, e.g. Location, Camera, Cookies, and so on. 17 * What kind of setting, e.g. Location, Camera, Cookies, and so on.
18 * @type {settings.ContentSettingsTypes} 18 * @type {settings.ContentSettingsTypes}
19 */ 19 */
20 category: String, 20 category: String,
21 21
22 /** 22 /**
23 * Whether this is about an Allow, Block, SessionOnly, or other. 23 * Whether this is about an Allow, Block, SessionOnly, or other.
24 * @type {settings.PermissionValues} 24 * @type {settings.PermissionValues}
25 */ 25 */
26 contentSetting: String, 26 contentSetting: String,
27 27
28 /** @private */ 28 /** @private */
29 isIncognitoActive_: Boolean, 29 showIncognitoSessionOnly_: Boolean,
30 30
31 /** 31 /**
32 * The site to add an exception for. 32 * The site to add an exception for.
33 * @private 33 * @private
34 */ 34 */
35 site_: String, 35 site_: String,
36 }, 36 },
37 37
38 /** @override */ 38 /** @override */
39 attached: function() { 39 attached: function() {
40 assert(this.category); 40 assert(this.category);
41 assert(this.contentSetting); 41 assert(this.contentSetting);
42 }, 42 },
43 43
44 /** 44 /**
45 * Opens the dialog. 45 * Opens the dialog.
46 * @param {string} type Whether this was launched from an Allow list or a 46 * @param {string} type Whether this was launched from an Allow list or a
47 * Block list. 47 * Block list.
48 */ 48 */
49 open: function(type) { 49 open: function(type) {
50 this.addWebUIListener('onIncognitoStatusChanged', function(isActive) { 50 this.addWebUIListener('onIncognitoStatusChanged', function(isActive) {
51 this.isIncognitoActive_ = isActive; 51 this.showIncognitoSessionOnly_ = isActive &&
52 this.contentSetting != settings.PermissionValues.SESSION_ONLY;
52 }.bind(this)); 53 }.bind(this));
53 this.browserProxy.updateIncognitoStatus(); 54 this.browserProxy.updateIncognitoStatus();
54 this.$.dialog.showModal(); 55 this.$.dialog.showModal();
55 }, 56 },
56 57
57 /** 58 /**
58 * Validates that the pattern entered is valid. 59 * Validates that the pattern entered is valid.
59 * @private 60 * @private
60 */ 61 */
61 validate_: function() { 62 validate_: function() {
(...skipping 23 matching lines...) Expand all
85 */ 86 */
86 onSubmit_: function() { 87 onSubmit_: function() {
87 if (this.$.add.disabled) 88 if (this.$.add.disabled)
88 return; // Can happen when Enter is pressed. 89 return; // Can happen when Enter is pressed.
89 this.browserProxy.setCategoryPermissionForOrigin( 90 this.browserProxy.setCategoryPermissionForOrigin(
90 this.site_, this.site_, this.category, this.contentSetting, 91 this.site_, this.site_, this.category, this.contentSetting,
91 this.$.incognito.checked); 92 this.$.incognito.checked);
92 this.$.dialog.close(); 93 this.$.dialog.close();
93 }, 94 },
94 }); 95 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698