OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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. |
| 4 |
| 5 /** |
| 6 * @fileoverview Oobe Voice Interaction Value Prop screen implementation. |
| 7 */ |
| 8 |
| 9 login.createScreen('VoiceInteractionValuePropScreen', |
| 10 'voice-interaction-value-prop', function() { |
| 11 return { |
| 12 |
| 13 /** @Override */ |
| 14 onBeforeShow: function(data) { |
| 15 var valueView = $('voice-interaction-value-prop-md'). |
| 16 getElement('value-prop-view'); |
| 17 |
| 18 valueView.addContentScripts([ |
| 19 { |
| 20 name: 'stripLinks', |
| 21 matches: ['<all_urls>'], |
| 22 js: { code: |
| 23 "document.querySelectorAll('a').forEach(" + |
| 24 "function(anchor){anchor.href='javascript:void(0)';})" |
| 25 }, |
| 26 run_at: 'document_end' |
| 27 }]); |
| 28 |
| 29 // TODO(updowndota): provide static content later for the final fallback. |
| 30 valueView.request.onHeadersReceived.addListener(function(details) { |
| 31 if (details.statusCode == '404') { |
| 32 if (valueView.src != |
| 33 'https://www.gstatic.com/opa-chromeos/oobe/en/value_proposition.ht
ml') { |
| 34 valueView.src = |
| 35 'https://www.gstatic.com/opa-chromeos/oobe/en/value_proposition.ht
ml'; |
| 36 } |
| 37 } |
| 38 }, {urls: ['<all_urls>'], types: ['main_frame']}); |
| 39 |
| 40 var locale = loadTimeData.getString('locale'); |
| 41 valueView.src = 'https://www.gstatic.com/opa-chromeos/oobe/' + locale |
| 42 + '/value_proposition.html'; |
| 43 |
| 44 Oobe.getInstance().headerHidden = true; |
| 45 } |
| 46 }; |
| 47 }); |
OLD | NEW |