| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 cr.define('options.internet', function() { | 5 cr.define('options.internet', function() { |
| 6 var OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
| 7 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; | 7 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Network settings constants. These enums must match their C++ | 10 * Network settings constants. These enums must match their C++ |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 */ | 74 */ |
| 75 proxyListInitialized_: false, | 75 proxyListInitialized_: false, |
| 76 | 76 |
| 77 /** | 77 /** |
| 78 * Initializes DetailsInternetPage page. | 78 * Initializes DetailsInternetPage page. |
| 79 * Calls base class implementation to starts preference initialization. | 79 * Calls base class implementation to starts preference initialization. |
| 80 */ | 80 */ |
| 81 initializePage: function() { | 81 initializePage: function() { |
| 82 OptionsPage.prototype.initializePage.call(this); | 82 OptionsPage.prototype.initializePage.call(this); |
| 83 options.internet.CellularPlanElement.decorate($('plan-list')); | 83 options.internet.CellularPlanElement.decorate($('plan-list')); |
| 84 this.initializePageContents_(); | 84 var params = parseQueryParams(window.location); |
| 85 this.showNetworkDetails_(); | 85 this.initializePageContents_(params); |
| 86 this.showNetworkDetails_(params); |
| 86 }, | 87 }, |
| 87 | 88 |
| 88 /** | 89 /** |
| 89 * Auto-activates the network details dialog if network information | 90 * Auto-activates the network details dialog if network information |
| 90 * is included in the URL. | 91 * is included in the URL. |
| 91 */ | 92 */ |
| 92 showNetworkDetails_: function() { | 93 showNetworkDetails_: function(params) { |
| 93 var params = parseQueryParams(window.location); | |
| 94 var servicePath = params.servicePath; | 94 var servicePath = params.servicePath; |
| 95 var networkType = params.networkType; | 95 var networkType = params.networkType; |
| 96 if (!servicePath || !servicePath.length || | 96 if (!servicePath || !servicePath.length || |
| 97 !networkType || !networkType.length) | 97 !networkType || !networkType.length) |
| 98 return; | 98 return; |
| 99 chrome.send('networkCommand', | 99 chrome.send('networkCommand', |
| 100 [networkType, servicePath, 'options']); | 100 [networkType, servicePath, 'options']); |
| 101 }, | 101 }, |
| 102 | 102 |
| 103 /** | 103 /** |
| 104 * Initializes the contents of the page. | 104 * Initializes the contents of the page. |
| 105 */ | 105 */ |
| 106 initializePageContents_: function() { | 106 initializePageContents_: function(params) { |
| 107 $('details-internet-dismiss').addEventListener('click', function(event) { | 107 $('details-internet-dismiss').addEventListener('click', function(event) { |
| 108 DetailsInternetPage.setDetails(); | 108 DetailsInternetPage.setDetails(); |
| 109 }); | 109 }); |
| 110 | 110 |
| 111 $('details-internet-login').addEventListener('click', function(event) { | 111 $('details-internet-login').addEventListener('click', function(event) { |
| 112 DetailsInternetPage.setDetails(); | 112 DetailsInternetPage.setDetails(); |
| 113 DetailsInternetPage.loginFromDetails(); | 113 DetailsInternetPage.loginFromDetails(); |
| 114 }); | 114 }); |
| 115 | 115 |
| 116 $('details-internet-disconnect').addEventListener('click', | 116 $('details-internet-disconnect').addEventListener('click', |
| 117 function(event) { | 117 function(event) { |
| 118 DetailsInternetPage.setDetails(); | 118 DetailsInternetPage.setDetails(); |
| 119 DetailsInternetPage.disconnectNetwork(); | 119 DetailsInternetPage.disconnectNetwork(); |
| 120 }); | 120 }); |
| 121 | 121 |
| 122 $('activate-details').addEventListener('click', function(event) { | 122 $('activate-details').addEventListener('click', function(event) { |
| 123 DetailsInternetPage.activateFromDetails(); | 123 DetailsInternetPage.activateFromDetails(); |
| 124 }); | 124 }); |
| 125 | 125 |
| 126 $('buyplan-details').addEventListener('click', function(event) { | 126 $('buyplan-details').addEventListener('click', function(event) { |
| 127 chrome.send('buyDataPlan'); | 127 chrome.send('buyDataPlan', [params.servicePath]); |
| 128 OptionsPage.closeOverlay(); | 128 OptionsPage.closeOverlay(); |
| 129 }); | 129 }); |
| 130 | 130 |
| 131 $('view-account-details').addEventListener('click', function(event) { | 131 $('view-account-details').addEventListener('click', function(event) { |
| 132 chrome.send('showMorePlanInfo'); | 132 chrome.send('showMorePlanInfo'); |
| 133 OptionsPage.closeOverlay(); | 133 OptionsPage.closeOverlay(); |
| 134 }); | 134 }); |
| 135 | 135 |
| 136 $('cellular-apn-use-default').addEventListener('click', function(event) { | 136 $('cellular-apn-use-default').addEventListener('click', function(event) { |
| 137 var data = $('connection-state').data; | 137 var data = $('connection-state').data; |
| (...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 | 903 |
| 904 // Don't show page name in address bar and in history to prevent people | 904 // Don't show page name in address bar and in history to prevent people |
| 905 // navigate here by hand and solve issue with page session restore. | 905 // navigate here by hand and solve issue with page session restore. |
| 906 OptionsPage.showPageByName('detailsInternetPage', false); | 906 OptionsPage.showPageByName('detailsInternetPage', false); |
| 907 }; | 907 }; |
| 908 | 908 |
| 909 return { | 909 return { |
| 910 DetailsInternetPage: DetailsInternetPage | 910 DetailsInternetPage: DetailsInternetPage |
| 911 }; | 911 }; |
| 912 }); | 912 }); |
| OLD | NEW |