Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2532)

Unified Diff: chrome/browser/resources/local_ntp/local_ntp.js

Issue 20501002: Adds paste function to searchbox api and handles paste event on fakebox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Focus handled in browser_instant_controller Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 ab514dfeb1f0c07205ffa45495031cf3daead90c..7d0ff2338e6f9288c84a9dbcbfa6165eabb99519 100644
--- a/chrome/browser/resources/local_ntp/local_ntp.js
+++ b/chrome/browser/resources/local_ntp/local_ntp.js
@@ -55,6 +55,7 @@ var IDS = {
ATTRIBUTION_TEXT: 'attribution-text',
CUSTOM_THEME_STYLE: 'ct-style',
FAKEBOX: 'fakebox',
+ FAKEBOX_INPUT: 'fakebox-input',
LOGO: 'logo',
NOTIFICATION: 'mv-notice',
NOTIFICATION_CLOSE_BUTTON: 'mv-notice-x',
@@ -947,7 +948,8 @@ function init() {
fakebox = document.createElement('div');
fakebox.id = IDS.FAKEBOX;
fakebox.innerHTML =
- '<input autocomplete="off" tabindex="-1" aria-hidden="true">' +
+ '<input id="' + IDS.FAKEBOX_INPUT +
+ '" autocomplete="off" tabindex="-1" aria-hidden="true">' +
'<div id=cursor></div>';
ntpContents.insertBefore(fakebox, ntpContents.firstChild);
@@ -1011,7 +1013,7 @@ function init() {
if (fakebox) {
// Listener for updating the key capture state.
- document.body.onclick = function(event) {
+ document.body.onmousedown = function(event) {
if (isFakeboxClick(event))
searchboxApiHandle.startCapturingKeyStrokes();
else if (isFakeboxFocused())
@@ -1020,6 +1022,13 @@ function init() {
searchboxApiHandle.onkeycapturechange = function() {
setFakeboxFocus(searchboxApiHandle.isKeyCaptureEnabled);
};
+ var inputbox = $(IDS.FAKEBOX_INPUT);
+ if (inputbox) {
+ inputbox.onpaste = function(event) {
+ event.preventDefault();
+ searchboxApiHandle.paste();
+ };
+ }
}
if (searchboxApiHandle.rtl) {
« no previous file with comments | « no previous file | chrome/browser/ui/browser_instant_controller.h » ('j') | chrome/browser/ui/browser_instant_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698