| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 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. |
| 4 chrome.runtime.onInstalled.addListener( |
| 5 function(a){ |
| 6 console.log("chrome.runtime.onInstalled details: "+JSON.stringify(a)); |
| 7 console.log("typeof chrome.dataReductionProxy: "+ |
| 8 typeof chrome.dataReductionProxy); |
| 9 if("undefined"!=typeof chrome.dataReductionProxy) |
| 10 if("install"==a.reason)chrome.dataReductionProxy.spdyProxyEnabled.set( |
| 11 {value:!0}), |
| 12 "clearDataSavings"in chrome.dataReductionProxy&& |
| 13 chrome.dataReductionProxy.clearDataSavings(), |
| 14 showEnabledIcon(); |
| 15 else if("update"==a.reason||"chrome_update"==a.reason) |
| 16 showEnabledIconIfProxyOn(), |
| 17 chrome.storage.local.get("user_enabled_proxy", |
| 18 function(a){"user_enabled_proxy"in a&&( |
| 19 chrome.dataReductionProxy.spdyProxyEnabled.set({value:!0}), |
| 20 showEnabledIcon(), |
| 21 chrome.storage.local.remove("user_enabled_proxy"))})}); |
| 22 chrome.runtime.onStartup.addListener(function(){ |
| 23 showEnabledIconIfProxyOn()});chrome.tabs.onCreated.addListener( |
| 24 function(a){setTimeout(function(){a.incognito&& |
| 25 chrome.browserAction.setIcon({tabId:a.id,path:{ |
| 26 19:"./images/proxy-disabled19.png", |
| 27 38:"./images/proxy-disabled38.png"}})},500)}); |
| 28 function showEnabledIconIfProxyOn(){ |
| 29 "undefined"!=typeof chrome.dataReductionProxy&&( |
| 30 console.log("Calling spdyProxyEnabled.get"), |
| 31 chrome.dataReductionProxy.spdyProxyEnabled.get({}, |
| 32 function(a){ |
| 33 console.log("chrome.dataReductionProxy.spdyProxyEnabled.get: " |
| 34 +JSON.stringify(a)); |
| 35 (a="value"in a&&a.value)&&showEnabledIcon() |
| 36 }) |
| 37 ) |
| 38 }; |
| 39 function showEnabledIcon(){ |
| 40 console.log("Calling chrome.browserAction.setIcon"); |
| 41 chrome.browserAction.setIcon({path:{19:"./images/proxy-enabled19.webp", |
| 42 38:"./images/proxy-enabled38.webp"}}) |
| 43 }; |
| OLD | NEW |