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