Chromium Code Reviews| Index: chrome/browser/resources/local_ntp/local_ntp.js |
| diff --git a/chrome/browser/resources/local_ntp/local_ntp.js b/chrome/browser/resources/local_ntp/local_ntp.js |
| index b8f60bf8977499af0d527a8bd672afb113ea2177..31d42806121cf52dc09809e6c6fde43b9e831d51 100644 |
| --- a/chrome/browser/resources/local_ntp/local_ntp.js |
| +++ b/chrome/browser/resources/local_ntp/local_ntp.js |
| @@ -1081,9 +1081,9 @@ function init() { |
| fakebox = document.createElement('div'); |
| fakebox.id = IDS.FAKEBOX; |
| var fakeboxHtml = []; |
| + fakeboxHtml.push('<div id="' + IDS.FAKEBOX_TEXT + '"></div>'); |
| fakeboxHtml.push('<input id="' + IDS.FAKEBOX_INPUT + |
| '" autocomplete="off" tabindex="-1" type="url" aria-hidden="true">'); |
| - fakeboxHtml.push('<div id="' + IDS.FAKEBOX_TEXT + '"></div>'); |
| fakeboxHtml.push('<div id="cursor"></div>'); |
| fakebox.innerHTML = fakeboxHtml.join(''); |
| @@ -1154,7 +1154,17 @@ function init() { |
| if (inputbox) { |
| inputbox.onpaste = function(event) { |
| event.preventDefault(); |
| - searchboxApiHandle.paste(); |
| + // Send pasted text to Omnibox. |
| + var items = event.clipboardData.items; |
| + if (items.length > 0) { |
|
huangs
2014/10/01 21:49:41
Combine with "&&".
Georges Khalil
2014/10/01 22:22:20
Done.
|
| + if (items[0].type == 'text/plain') { |
|
huangs
2014/10/01 21:49:41
We should ensure that other text would work, e.g.,
Georges Khalil
2014/10/01 22:22:20
Per discussion, no problem here.
|
| + items[0].getAsString(function(text) { |
| + if (text) { |
| + searchboxApiHandle.paste(text); |
| + } |
| + }); |
| + } |
| + } |
| }; |
| inputbox.ondrop = function(event) { |
| event.preventDefault(); |