Refactor common functionality out of webview, appview, and extensionoptions.