15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Update the declarative rules on install or upgrade. 65d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)chrome.runtime.onInstalled.addListener(function() { 75d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) chrome.declarativeContent.onPageChanged.removeRules(undefined, function() { 85d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) chrome.declarativeContent.onPageChanged.addRules([{ 95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) conditions: [ 105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // When a page contains a <video> tag... 115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) new chrome.declarativeContent.PageStateMatcher({ 125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) css: ["video"] 135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) }) 145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ], 155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // ... show the page action. 165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) actions: [new chrome.declarativeContent.ShowPageAction() ] 175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) }]); 185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) }); 195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}); 20