18bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved.
28bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
38bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// found in the LICENSE file.
48bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
58bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)function setCursorToSelectValue() {
68bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  var selectEl = document.querySelector('select');
78bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  var cursorType = parseInt(selectEl.value, 10);
88bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  common.naclModule.postMessage(cursorType);
98bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)}
108bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
118bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)function moduleDidLoad() {
128bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  setCursorToSelectValue();
138bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)}
148bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
158bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)function attachListeners() {
168bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  var selectEl = document.querySelector('select');
178bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  selectEl.addEventListener('change', function (e) {
188bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    setCursorToSelectValue();
198bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  });
208bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)}
21