OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 /** | 6 /** |
7 * @fileoverview The local InstantExtended NTP. | 7 * @fileoverview The local InstantExtended NTP. |
8 */ | 8 */ |
9 | 9 |
10 | 10 |
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1074 attribution = $(IDS.ATTRIBUTION); | 1074 attribution = $(IDS.ATTRIBUTION); |
1075 ntpContents = $(IDS.NTP_CONTENTS); | 1075 ntpContents = $(IDS.NTP_CONTENTS); |
1076 | 1076 |
1077 if (configData.isGooglePage) { | 1077 if (configData.isGooglePage) { |
1078 var logo = document.createElement('div'); | 1078 var logo = document.createElement('div'); |
1079 logo.id = IDS.LOGO; | 1079 logo.id = IDS.LOGO; |
1080 | 1080 |
1081 fakebox = document.createElement('div'); | 1081 fakebox = document.createElement('div'); |
1082 fakebox.id = IDS.FAKEBOX; | 1082 fakebox.id = IDS.FAKEBOX; |
1083 var fakeboxHtml = []; | 1083 var fakeboxHtml = []; |
| 1084 fakeboxHtml.push('<div id="' + IDS.FAKEBOX_TEXT + '"></div>'); |
1084 fakeboxHtml.push('<input id="' + IDS.FAKEBOX_INPUT + | 1085 fakeboxHtml.push('<input id="' + IDS.FAKEBOX_INPUT + |
1085 '" autocomplete="off" tabindex="-1" type="url" aria-hidden="true">'); | 1086 '" autocomplete="off" tabindex="-1" type="url" aria-hidden="true">'); |
1086 fakeboxHtml.push('<div id="' + IDS.FAKEBOX_TEXT + '"></div>'); | |
1087 fakeboxHtml.push('<div id="cursor"></div>'); | 1087 fakeboxHtml.push('<div id="cursor"></div>'); |
1088 fakebox.innerHTML = fakeboxHtml.join(''); | 1088 fakebox.innerHTML = fakeboxHtml.join(''); |
1089 | 1089 |
1090 ntpContents.insertBefore(fakebox, ntpContents.firstChild); | 1090 ntpContents.insertBefore(fakebox, ntpContents.firstChild); |
1091 ntpContents.insertBefore(logo, ntpContents.firstChild); | 1091 ntpContents.insertBefore(logo, ntpContents.firstChild); |
1092 } else { | 1092 } else { |
1093 document.body.classList.add(CLASSES.NON_GOOGLE_PAGE); | 1093 document.body.classList.add(CLASSES.NON_GOOGLE_PAGE); |
1094 } | 1094 } |
1095 | 1095 |
1096 // Hide notifications after fade out, so we can't focus on links via keyboard. | 1096 // Hide notifications after fade out, so we can't focus on links via keyboard. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 else if (isFakeboxFocused()) | 1147 else if (isFakeboxFocused()) |
1148 searchboxApiHandle.stopCapturingKeyStrokes(); | 1148 searchboxApiHandle.stopCapturingKeyStrokes(); |
1149 }; | 1149 }; |
1150 searchboxApiHandle.onkeycapturechange = function() { | 1150 searchboxApiHandle.onkeycapturechange = function() { |
1151 setFakeboxFocus(searchboxApiHandle.isKeyCaptureEnabled); | 1151 setFakeboxFocus(searchboxApiHandle.isKeyCaptureEnabled); |
1152 }; | 1152 }; |
1153 var inputbox = $(IDS.FAKEBOX_INPUT); | 1153 var inputbox = $(IDS.FAKEBOX_INPUT); |
1154 if (inputbox) { | 1154 if (inputbox) { |
1155 inputbox.onpaste = function(event) { | 1155 inputbox.onpaste = function(event) { |
1156 event.preventDefault(); | 1156 event.preventDefault(); |
1157 searchboxApiHandle.paste(); | 1157 // Send pasted text to Omnibox. |
| 1158 var text = event.clipboardData.getData('text/plain'); |
| 1159 if (text) |
| 1160 searchboxApiHandle.paste(text); |
1158 }; | 1161 }; |
1159 inputbox.ondrop = function(event) { | 1162 inputbox.ondrop = function(event) { |
1160 event.preventDefault(); | 1163 event.preventDefault(); |
1161 var text = event.dataTransfer.getData('text/plain'); | 1164 var text = event.dataTransfer.getData('text/plain'); |
1162 if (text) { | 1165 if (text) { |
1163 searchboxApiHandle.paste(text); | 1166 searchboxApiHandle.paste(text); |
1164 } | 1167 } |
1165 }; | 1168 }; |
1166 inputbox.ondragenter = function() { | 1169 inputbox.ondragenter = function() { |
1167 setFakeboxDragFocus(true); | 1170 setFakeboxDragFocus(true); |
(...skipping 28 matching lines...) Expand all Loading... |
1196 | 1199 |
1197 return { | 1200 return { |
1198 init: init, | 1201 init: init, |
1199 listen: listen | 1202 listen: listen |
1200 }; | 1203 }; |
1201 } | 1204 } |
1202 | 1205 |
1203 if (!window.localNTPUnitTest) { | 1206 if (!window.localNTPUnitTest) { |
1204 LocalNTP().listen(); | 1207 LocalNTP().listen(); |
1205 } | 1208 } |
OLD | NEW |