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 17 matching lines...) Expand all Loading... | |
28 properties: { | 28 properties: { |
29 /** @private */ | 29 /** @private */ |
30 enableSiteSettings_: { | 30 enableSiteSettings_: { |
31 type: Boolean, | 31 type: Boolean, |
32 value: function() { | 32 value: function() { |
33 return loadTimeData.getBoolean('enableSiteSettings'); | 33 return loadTimeData.getBoolean('enableSiteSettings'); |
34 }, | 34 }, |
35 }, | 35 }, |
36 | 36 |
37 /** | 37 /** |
38 * The site that was selected by the user in the dropdown list. | |
39 * @type {SiteException} | |
40 */ | |
41 selectedSite: { | |
42 type: Object, | |
43 notify: true, | |
44 }, | |
45 | |
46 /** | |
47 * 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. |
48 * @private {?SiteException} | 39 * @private {?SiteException} |
49 */ | 40 */ |
50 actionMenuSite_: Object, | 41 actionMenuSite_: Object, |
51 | 42 |
52 /** | 43 /** |
53 * Array of sites to display in the widget. | 44 * Array of sites to display in the widget. |
54 * @type {!Array<SiteException>} | 45 * @type {!Array<SiteException>} |
55 */ | 46 */ |
56 sites: { | 47 sites: { |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
397 }, | 388 }, |
398 | 389 |
399 /** | 390 /** |
400 * A handler for selecting a site (by clicking on the origin). | 391 * A handler for selecting a site (by clicking on the origin). |
401 * @param {!{model: !{item: !SiteException}}} event | 392 * @param {!{model: !{item: !SiteException}}} event |
402 * @private | 393 * @private |
403 */ | 394 */ |
404 onOriginTap_: function(event) { | 395 onOriginTap_: function(event) { |
405 if (!this.enableSiteSettings_) | 396 if (!this.enableSiteSettings_) |
406 return; | 397 return; |
407 this.selectedSite = event.model.item; | 398 this.selectedSiteForUnitTest = event.model.item; |
tommycli
2016/12/16 00:39:49
I think you can also eliminate this by testing for
dschuyler
2016/12/16 01:11:57
Done.
| |
408 settings.navigateTo(settings.Route.SITE_SETTINGS_SITE_DETAILS, | 399 settings.navigateTo(settings.Route.SITE_SETTINGS_SITE_DETAILS, |
409 new URLSearchParams('site=' + this.selectedSite.origin)); | 400 new URLSearchParams('site=' + event.model.item.origin)); |
410 }, | 401 }, |
411 | 402 |
412 /** | 403 /** |
413 * A handler for activating one of the menu action items. | 404 * A handler for activating one of the menu action items. |
414 * @param {string} action The permission to set (Allow, Block, SessionOnly, | 405 * @param {string} action The permission to set (Allow, Block, SessionOnly, |
415 * etc). | 406 * etc). |
416 * @private | 407 * @private |
417 */ | 408 */ |
418 onActionMenuActivate_: function(action) { | 409 onActionMenuActivate_: function(action) { |
419 var origin = this.actionMenuSite_.origin; | 410 var origin = this.actionMenuSite_.origin; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
482 Polymer.dom(/** @type {!Event} */ (e)).localTarget)); | 473 Polymer.dom(/** @type {!Event} */ (e)).localTarget)); |
483 }, | 474 }, |
484 | 475 |
485 /** @private */ | 476 /** @private */ |
486 closeActionMenu_: function() { | 477 closeActionMenu_: function() { |
487 this.actionMenuSite_ = null; | 478 this.actionMenuSite_ = null; |
488 /** @type {!CrActionMenuElement} */ ( | 479 /** @type {!CrActionMenuElement} */ ( |
489 this.$$('dialog[is=cr-action-menu]')).close(); | 480 this.$$('dialog[is=cr-action-menu]')).close(); |
490 }, | 481 }, |
491 }); | 482 }); |
OLD | NEW |