Well, you can study the source code of Adblock Plus: https://github.com/adblockplus/adblockpluschrome
I guess the high-level answer would be chrome.webRequest
API (and its upcoming update chrome.declarativeWebRequest
), which allows to intercept requests and deny/modify them.