| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 * Enumeration mapping all possible controlled-by values for exceptions to | 6 * Enumeration mapping all possible controlled-by values for exceptions to |
| 7 * icons. | 7 * icons. |
| 8 * @enum {string} | 8 * @enum {string} |
| 9 */ | 9 */ |
| 10 var iconControlledBy = { | 10 var iconControlledBy = { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 }, | 34 }, |
| 35 }, | 35 }, |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * The site serving as the model for the currently open action menu. | 38 * The site serving as the model for the currently open action menu. |
| 39 * @private {?SiteException} | 39 * @private {?SiteException} |
| 40 */ | 40 */ |
| 41 actionMenuSite_: Object, | 41 actionMenuSite_: Object, |
| 42 | 42 |
| 43 /** | 43 /** |
| 44 * Whether the "edit exception" dialog should be shown. |
| 45 * @private |
| 46 */ |
| 47 showEditExceptionDialog_: Boolean, |
| 48 |
| 49 /** |
| 44 * Array of sites to display in the widget. | 50 * Array of sites to display in the widget. |
| 45 * @type {!Array<SiteException>} | 51 * @type {!Array<SiteException>} |
| 46 */ | 52 */ |
| 47 sites: { | 53 sites: { |
| 48 type: Array, | 54 type: Array, |
| 49 value: function() { return []; }, | 55 value: function() { return []; }, |
| 50 }, | 56 }, |
| 51 | 57 |
| 52 /** | 58 /** |
| 53 * Whether this list is for the All Sites category. | 59 * Whether this list is for the All Sites category. |
| 54 */ | 60 */ |
| 55 allSites: { | 61 allSites: { |
| 56 type: Boolean, | 62 type: Boolean, |
| 57 value: false, | 63 value: false, |
| 58 }, | 64 }, |
| 59 | 65 |
| 60 /** | 66 /** |
| 61 * The type of category this widget is displaying data for. Normally | 67 * The type of category this widget is displaying data for. Normally |
| 62 * either 'allow' or 'block', representing which sites are allowed or | 68 * either 'allow' or 'block', representing which sites are allowed or |
| 63 * blocked respectively. | 69 * blocked respectively. |
| 64 */ | 70 */ |
| 65 categorySubtype: { | 71 categorySubtype: { |
| 66 type: String, | 72 type: String, |
| 67 value: settings.INVALID_CATEGORY_SUBTYPE, | 73 value: settings.INVALID_CATEGORY_SUBTYPE, |
| 68 }, | 74 }, |
| 69 | 75 |
| 70 /** | 76 /** |
| 71 * Whether to show the Allow action in the action menu. | 77 * Whether to show the Allow action in the action menu. |
| 78 * @private |
| 72 */ | 79 */ |
| 73 showAllowAction_: Boolean, | 80 showAllowAction_: Boolean, |
| 74 | 81 |
| 75 /** | 82 /** |
| 76 * Whether to show the Block action in the action menu. | 83 * Whether to show the Block action in the action menu. |
| 84 * @private |
| 77 */ | 85 */ |
| 78 showBlockAction_: Boolean, | 86 showBlockAction_: Boolean, |
| 79 | 87 |
| 80 /** | 88 /** |
| 81 * Whether to show the 'Clear on exit' action in the action | 89 * Whether to show the 'Clear on exit' action in the action |
| 82 * menu. | 90 * menu. |
| 91 * @private |
| 83 */ | 92 */ |
| 84 showSessionOnlyAction_: Boolean, | 93 showSessionOnlyAction_: Boolean, |
| 85 | 94 |
| 86 /** | 95 /** |
| 96 * Whether to show the 'edit' action in the action menu. |
| 97 * @private |
| 98 */ |
| 99 showEditAction_: Boolean, |
| 100 |
| 101 /** |
| 87 * Keeps track of the incognito status of the current profile (whether one | 102 * Keeps track of the incognito status of the current profile (whether one |
| 88 * exists). | 103 * exists). |
| 104 * @private |
| 89 */ | 105 */ |
| 90 incognitoProfileActive_: { | 106 incognitoProfileActive_: { |
| 91 type: Boolean, | 107 type: Boolean, |
| 92 value: false, | 108 value: false, |
| 93 }, | 109 }, |
| 94 | 110 |
| 95 /** | 111 /** |
| 96 * All possible actions in the action menu. | 112 * All possible actions in the action menu. |
| 113 * @private |
| 97 */ | 114 */ |
| 98 actions_: { | 115 actions_: { |
| 99 readOnly: true, | 116 readOnly: true, |
| 100 type: Object, | 117 type: Object, |
| 101 values: { | 118 values: { |
| 102 ALLOW: 'Allow', | 119 ALLOW: 'Allow', |
| 103 BLOCK: 'Block', | 120 BLOCK: 'Block', |
| 104 RESET: 'Reset', | 121 RESET: 'Reset', |
| 105 SESSION_ONLY: 'SessionOnly', | 122 SESSION_ONLY: 'SessionOnly', |
| 106 } | 123 } |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 * @private | 372 * @private |
| 356 */ | 373 */ |
| 357 setUpActionMenu_: function() { | 374 setUpActionMenu_: function() { |
| 358 this.showAllowAction_ = | 375 this.showAllowAction_ = |
| 359 this.categorySubtype != settings.PermissionValues.ALLOW; | 376 this.categorySubtype != settings.PermissionValues.ALLOW; |
| 360 this.showBlockAction_ = | 377 this.showBlockAction_ = |
| 361 this.categorySubtype != settings.PermissionValues.BLOCK; | 378 this.categorySubtype != settings.PermissionValues.BLOCK; |
| 362 this.showSessionOnlyAction_ = | 379 this.showSessionOnlyAction_ = |
| 363 this.categorySubtype != settings.PermissionValues.SESSION_ONLY && | 380 this.categorySubtype != settings.PermissionValues.SESSION_ONLY && |
| 364 this.category == settings.ContentSettingsTypes.COOKIES; | 381 this.category == settings.ContentSettingsTypes.COOKIES; |
| 382 this.showEditAction_ = |
| 383 this.category == settings.ContentSettingsTypes.COOKIES; |
| 365 }, | 384 }, |
| 366 | 385 |
| 367 /** | 386 /** |
| 368 * @return {boolean} Whether to show the "Session Only" menu item for the | 387 * @return {boolean} Whether to show the "Session Only" menu item for the |
| 369 * currently active site. | 388 * currently active site. |
| 370 * @private | 389 * @private |
| 371 */ | 390 */ |
| 372 showSessionOnlyActionForSite_: function() { | 391 showSessionOnlyActionForSite_: function() { |
| 373 // It makes no sense to show "clear on exit" for exceptions that only apply | 392 // It makes no sense to show "clear on exit" for exceptions that only apply |
| 374 // to incognito. It gives the impression that they might under some | 393 // to incognito. It gives the impression that they might under some |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 this.closeActionMenu_(); | 441 this.closeActionMenu_(); |
| 423 }, | 442 }, |
| 424 | 443 |
| 425 /** @private */ | 444 /** @private */ |
| 426 onSessionOnlyTap_: function() { | 445 onSessionOnlyTap_: function() { |
| 427 this.onActionMenuActivate_(settings.PermissionValues.SESSION_ONLY); | 446 this.onActionMenuActivate_(settings.PermissionValues.SESSION_ONLY); |
| 428 this.closeActionMenu_(); | 447 this.closeActionMenu_(); |
| 429 }, | 448 }, |
| 430 | 449 |
| 431 /** @private */ | 450 /** @private */ |
| 451 onEditTap_: function() { |
| 452 this.showEditExceptionDialog_ = true; |
| 453 }, |
| 454 |
| 455 /** @private */ |
| 456 onEditExceptionDialogClosed_: function() { |
| 457 this.showEditExceptionDialog_ = false; |
| 458 // Close action menu after dialog has been closed, otherwise |
| 459 // |actionMenuSite_| is reset while the dialog is still accessing it. |
| 460 this.closeActionMenu_(); |
| 461 }, |
| 462 |
| 463 /** @private */ |
| 432 onResetTap_: function() { | 464 onResetTap_: function() { |
| 433 this.onActionMenuActivate_(settings.PermissionValues.DEFAULT); | 465 this.onActionMenuActivate_(settings.PermissionValues.DEFAULT); |
| 434 this.closeActionMenu_(); | 466 this.closeActionMenu_(); |
| 435 }, | 467 }, |
| 436 | 468 |
| 437 /** | 469 /** |
| 438 * Returns the appropriate site description to display. This can, for example, | 470 * Returns the appropriate site description to display. This can, for example, |
| 439 * be blank, an 'embedded on <site>' or 'Current incognito session' (or a | 471 * be blank, an 'embedded on <site>' or 'Current incognito session' (or a |
| 440 * mix of the last two). | 472 * mix of the last two). |
| 441 * @param {SiteException} item The site exception entry. | 473 * @param {SiteException} item The site exception entry. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 466 | 498 |
| 467 /** @private */ | 499 /** @private */ |
| 468 closeActionMenu_: function() { | 500 closeActionMenu_: function() { |
| 469 this.actionMenuSite_ = null; | 501 this.actionMenuSite_ = null; |
| 470 var actionMenu = /** @type {!CrActionMenuElement} */ ( | 502 var actionMenu = /** @type {!CrActionMenuElement} */ ( |
| 471 this.$$('dialog[is=cr-action-menu]')); | 503 this.$$('dialog[is=cr-action-menu]')); |
| 472 if (actionMenu.open) | 504 if (actionMenu.open) |
| 473 actionMenu.close(); | 505 actionMenu.close(); |
| 474 }, | 506 }, |
| 475 }); | 507 }); |
| OLD | NEW |