Chromium Code Reviews| Index: ui/keyboard/resources/elements/kb-keyboard.html |
| diff --git a/ui/keyboard/resources/elements/kb-keyboard.html b/ui/keyboard/resources/elements/kb-keyboard.html |
| index 2082a84aeae47c3f43cce2b60a858114f4d40ce6..8c4f45488009d27e46787be45c078a6414e15282 100644 |
| --- a/ui/keyboard/resources/elements/kb-keyboard.html |
| +++ b/ui/keyboard/resources/elements/kb-keyboard.html |
| @@ -479,7 +479,24 @@ |
| keyboard.appendChild(flattenKeysets(keysets.content)); |
| this.selectDefaultKeyset(); |
| } else { |
| - console.error('Unable to find layout ' + this.layout); |
| + // Add link for the keysets if missing from the document. Force |
| + // a layout change after resolving the import of the link. |
| + var query = 'link[id=' + this.layout + ']'; |
| + if (!document.querySelector(query)) { |
| + // Layout has not beeen loaded yet. |
| + var link = document.createElement('link'); |
| + link.id = this.layout; |
| + link.setAttribute('rel', 'import'); |
| + link.setAttribute('href', 'layouts/' + this.layout + '.html'); |
| + document.head.appendChild(link); |
| + |
| + // Load content for the new link element. |
| + var self = this; |
| + HTMLImports.importer.load(document, function() { |
| + HTMLImports.parser.parseLink(link); |
|
bshe
2013/09/06 21:12:21
would it enter infinite loop if failed to load?
kevers
2013/09/09 15:44:04
We do a check for an existing link element before
|
| + self.layoutChanged(); |
| + }); |
| + } |
| } |
| } |
| this.classList.remove('caps-locked'); |