1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 function showMessage(msg) {
6 var area = $('message-area');
7 var entry = document.createElement('div');
8 entry.textContent = msg;
9 area.appendChild(entry);
10 window.setTimeout(function() {
11 area.removeChild(entry);
15 function getShowMessageCallback(message) {
17 var error = chrome.runtime.lastError;
19 showMessage(message + ': ' + error.message);
21 showMessage(message + ': Success!');
26 function onPageLoad() {
27 var networkConfig = $('network-config');
28 network.config.NetworkConfig.decorate(networkConfig);
30 $('save').onclick = function() {
31 chrome.networkingPrivate.setProperties(
32 networkConfig.networkId,
33 networkConfig.userSettings,
34 getShowMessageCallback('Set properties of ' + networkConfig.networkId));
37 $('connect').onclick = function() {
38 chrome.networkingPrivate.startConnect(
39 networkConfig.networkId,
40 getShowMessageCallback(
41 'Requested connect to ' + networkConfig.networkId));
44 $('disconnect').onclick = function() {
45 chrome.networkingPrivate.startDisconnect(
46 networkConfig.networkId,
47 getShowMessageCallback(
48 'Requested disconnect from ' + networkConfig.networkId));
52 document.addEventListener('DOMContentLoaded', onPageLoad);