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
3 // found in the LICENSE file.
6 * @fileoverview 'cr-search-engine-entry' is a component for showing a search
7 * engine with its name, domain and query URL.
9 * @group Chrome Settings Elements
10 * @element cr-search-engine-entry
13 is
: 'cr-search-engine-entry',
16 /** @type {!SearchEngine} */
21 deleteEngine_: function() {
22 chrome
.searchEnginesPrivate
.removeSearchEngine(this.engine
.guid
);
26 makeDefault_: function() {
27 chrome
.searchEnginesPrivate
.setSelectedSearchEngine(this.engine
.guid
);
28 this.makeNotEditable_();
32 toggleEditable_: function() {
33 this.$.domainField
.disabled
= !this.$.domainField
.disabled
;
34 this.$.keywordField
.disabled
= !this.$.keywordField
.disabled
;
35 this.$.queryURLField
.disabled
= !this.$.queryURLField
.disabled
;
37 this.$.checkIcon
.hidden
=
38 !this.$.checkIcon
.hidden
|| this.engine
.isSelected
;
39 this.$.deleteIcon
.hidden
=
40 !this.$.deleteIcon
.hidden
|| this.engine
.isSelected
;
44 makeNotEditable_: function() {
45 this.$.domainField
.disabled
= true;
46 this.$.keywordField
.disabled
= true;
47 this.$.queryURLField
.disabled
= true;
49 this.$.checkIcon
.hidden
= true;
50 this.$.deleteIcon
.hidden
= true;
54 fieldChanged_: function() {
55 // NOTE: This currently doesn't fire in response to a change event from the
56 // cr-input, even though it should. This Polymer change should fix the
57 // issue: https://github.com/PolymerElements/paper-input/pull/33
58 chrome
.searchEnginesPrivate
.updateSearchEngine(
60 this.$.domainField
.value
,
61 this.$.keywordField
.value
,
62 this.$.queryURLField
.value
);
63 this.makeNotEditable_();