| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 var hostPrefix = chrome.extension.inIncognitoContext ? 'test_split' : | 5 var hostPrefix = chrome.extension.inIncognitoContext ? 'test_split' : |
| 6 'test_normal'; | 6 'test_normal'; |
| 7 | 7 |
| 8 var rule = { | 8 var rule = { |
| 9 conditions: [ | 9 conditions: [ |
| 10 new chrome.declarativeContent.PageStateMatcher({ | 10 new chrome.declarativeContent.PageStateMatcher({ |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // chrome.storage.local, but the onInstalled event only gets sent for the | 29 // chrome.storage.local, but the onInstalled event only gets sent for the |
| 30 // non-incognito side of the extension in split incognito mode. | 30 // non-incognito side of the extension in split incognito mode. |
| 31 var key = chrome.extension.inIncognitoContext ? "split" : "normal"; | 31 var key = chrome.extension.inIncognitoContext ? "split" : "normal"; |
| 32 chrome.storage.local.get(key, function(items) { | 32 chrome.storage.local.get(key, function(items) { |
| 33 if (!(key in items)) { | 33 if (!(key in items)) { |
| 34 chrome.declarativeContent.onPageChanged.addRules([rule], function() { | 34 chrome.declarativeContent.onPageChanged.addRules([rule], function() { |
| 35 items[key] = "added"; | 35 items[key] = "added"; |
| 36 chrome.storage.local.set(items, sendMessage.bind(null, "ready")); | 36 chrome.storage.local.set(items, sendMessage.bind(null, "ready")); |
| 37 }); | 37 }); |
| 38 } else { | 38 } else { |
| 39 sendMessage("second run ready"); | 39 sendMessage(sendMessage("second run ready")); |
| 40 } | 40 } |
| 41 }); | 41 }); |
| OLD | NEW |