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 * @fileoverview 'settings-search-engine-entry' is a component for showing a | 6 * @fileoverview 'settings-search-engine-entry' is a component for showing a |
7 * search engine with its name, domain and query URL. | 7 * search engine with its name, domain and query URL. |
8 * | 8 * |
9 * @group Chrome Settings Elements | 9 * @group Chrome Settings Elements |
10 * @element settings-search-engine-entry | 10 * @element settings-search-engine-entry |
11 */ | 11 */ |
12 Polymer({ | 12 Polymer({ |
13 is: 'settings-search-engine-entry', | 13 is: 'settings-search-engine-entry', |
14 | 14 |
15 properties: { | 15 properties: { |
16 /** @type {!SearchEngine} */ | 16 /** @type {!SearchEngine} */ |
17 engine: Object, | 17 engine: Object, |
18 | 18 |
19 /** @private {boolean} */ | 19 /** @private {boolean} */ |
20 showEditSearchEngineDialog_: Boolean, | 20 showEditSearchEngineDialog_: Boolean, |
| 21 |
| 22 /** @type {boolean} */ |
| 23 isDefault: { |
| 24 reflectToAttribute: true, |
| 25 type: Boolean, |
| 26 computed: 'computeIsDefault_(engine)' |
| 27 }, |
21 }, | 28 }, |
22 | 29 |
23 /** @private {!settings.SearchEnginesBrowserProxy} */ | 30 /** @private {!settings.SearchEnginesBrowserProxy} */ |
24 browserProxy_: null, | 31 browserProxy_: null, |
25 | 32 |
| 33 /** @override */ |
26 created: function() { | 34 created: function() { |
27 this.browserProxy_ = settings.SearchEnginesBrowserProxyImpl.getInstance(); | 35 this.browserProxy_ = settings.SearchEnginesBrowserProxyImpl.getInstance(); |
28 }, | 36 }, |
29 | 37 |
| 38 /** |
| 39 * @return {boolean} |
| 40 * @private |
| 41 */ |
| 42 computeIsDefault_: function() { |
| 43 return this.engine.default; |
| 44 }, |
| 45 |
30 /** @private */ | 46 /** @private */ |
31 onDeleteTap_: function() { | 47 onDeleteTap_: function() { |
32 this.browserProxy_.removeSearchEngine(this.engine.modelIndex); | 48 this.browserProxy_.removeSearchEngine(this.engine.modelIndex); |
33 }, | 49 }, |
34 | 50 |
35 /** @private */ | 51 /** @private */ |
36 onEditTap_: function() { | 52 onEditTap_: function() { |
37 this.closePopupMenu_(); | 53 this.closePopupMenu_(); |
38 | 54 |
39 this.showEditSearchEngineDialog_ = true; | 55 this.showEditSearchEngineDialog_ = true; |
(...skipping 12 matching lines...) Expand all Loading... |
52 onMakeDefaultTap_: function() { | 68 onMakeDefaultTap_: function() { |
53 this.closePopupMenu_(); | 69 this.closePopupMenu_(); |
54 this.browserProxy_.setDefaultSearchEngine(this.engine.modelIndex); | 70 this.browserProxy_.setDefaultSearchEngine(this.engine.modelIndex); |
55 }, | 71 }, |
56 | 72 |
57 /** @private */ | 73 /** @private */ |
58 closePopupMenu_: function() { | 74 closePopupMenu_: function() { |
59 this.$$('iron-dropdown').close(); | 75 this.$$('iron-dropdown').close(); |
60 }, | 76 }, |
61 }); | 77 }); |
OLD | NEW |