diff options
author | zelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-25 06:17:04 +0000 |
---|---|---|
committer | zelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-25 06:17:04 +0000 |
commit | 9d3f7d5e85d9834495434d7b925c1ba7933a344f (patch) | |
tree | 1b1100ef3ca76cbd86aa302cd29603c7dbffed84 /chrome/browser/resources/connection_manager.js | |
parent | 5530ac65a61c659e28ced24a4479a5c4d11dc546 (diff) | |
download | chromium_src-9d3f7d5e85d9834495434d7b925c1ba7933a344f.zip chromium_src-9d3f7d5e85d9834495434d7b925c1ba7933a344f.tar.gz chromium_src-9d3f7d5e85d9834495434d7b925c1ba7933a344f.tar.bz2 |
Skeleton for mobile device activation UI.
BUG=chromium-os:6868
TEST=none
Review URL: http://codereview.chromium.org/3448018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60568 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources/connection_manager.js')
-rw-r--r-- | chrome/browser/resources/connection_manager.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/chrome/browser/resources/connection_manager.js b/chrome/browser/resources/connection_manager.js new file mode 100644 index 0000000..bf443c4 --- /dev/null +++ b/chrome/browser/resources/connection_manager.js @@ -0,0 +1,49 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + + +function chromeos() { +} + +chromeos.connectionManager = function() { +}; + +chromeos.connectionManager.device_info_callback_ = null; +chromeos.connectionManager.transaction_status_callback_ = null; +chromeos.connectionManager.parent_page_url_ = 'chrome://mobilesetup'; + +chromeos.connectionManager.getDeviceInfo = function(callback) { + chromeos.connectionManager.device_info_callback_ = callback; + chromeos.connectionManager.requestDeviceInfo_(); +}; + +chromeos.connectionManager.setTransactionStatus = function(status, callback) { + chromeos.connectionManager.transaction_status_callback_ = callback; + chromeos.connectionManager.reportTransactionStatus_(status); +}; + +chromeos.connectionManager.reportTransactionStatus_ = function(status) { + var msg = { + 'type': 'reportTransactionStatusMsg', + 'domain': location.href, + 'status': status + }; + window.parent.postMessage(msg, chromeos.connectionManager.parent_page_url_); +}; + +chromeos.connectionManager.requestDeviceInfo_ = function() { + var msg = { + 'type': 'requestDeviceInfoMsg', + 'domain': location.href, + }; + window.parent.postMessage(msg, chromeos.connectionManager.parent_page_url_); +} + +window.addEventListener('message', function(e) { + if (e.data.type == 'deviceInfoMsg') { + if (chromeos.connectionManager.device_info_callback_) + chromeos.connectionManager.device_info_callback_(e.data.payload); + } +}); + |