From 502b3321716ff063e1992c35cb28483da48b0dd6 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Fri, 12 Oct 2007 21:10:57 +0000 Subject: Merge branch 'master' of git+ssh://dev.laptop.org/git/web-activity Conflicts: NEWS browser.py --- diff --git a/NEWS b/NEWS index 0f1efd1..0e8bbbf 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,9 @@ +<<<<<<< HEAD:NEWS * #2910 Open popups in the current window (marco) +======= +* Add agent-stylesheet.css and support for blocking flash. (tomeu) +* Add support for agent and user stylesheets. (tomeu) +>>>>>>> d800b328ebea44310d6bb475c72f6a9e1557f13c:NEWS 61 diff --git a/agent-stylesheet.css b/agent-stylesheet.css new file mode 100644 index 0000000..6c94d0e --- /dev/null +++ b/agent-stylesheet.css @@ -0,0 +1,8 @@ +/* Prevent flash animations from playing until you click on them. */ +object[classid$=":D27CDB6E-AE6D-11cf-96B8-444553540000"], +object[codebase*="swflash.cab"], +object[type="application/x-shockwave-flash"], +embed[type="application/x-shockwave-flash"], +embed[src$=".swf"] +{ -moz-binding: url("clickToView.xml#flash"); } + diff --git a/browser.py b/browser.py index e9e6d00..ec6a69f 100644 --- a/browser.py +++ b/browser.py @@ -31,7 +31,9 @@ from hulahop.webview import WebView from sugar.datastore import datastore from sugar import profile +from sugar import env from sugar.activity import activityfactory +from sugar.activity import activity import sessionstore @@ -66,9 +68,31 @@ class GetSourceListener(gobject.GObject): pass class Browser(WebView): + + AGENT_SHEET = os.path.join(activity.get_bundle_path(), 'agent-stylesheet.css') + USER_SHEET = os.path.join(env.get_profile_path(), 'gecko', 'user-stylesheet.css') + def __init__(self): WebView.__init__(self) + io_service_class = components.classes["@mozilla.org/network/io-service;1"] + io_service = io_service_class.getService(interfaces.nsIIOService) + + cls = components.classes['@mozilla.org/content/style-sheet-service;1'] + style_sheet_service = cls.getService(interfaces.nsIStyleSheetService) + + if os.path.exists(Browser.AGENT_SHEET): + agent_sheet_uri = io_service.newURI('file:///' + Browser.AGENT_SHEET, + None, None) + style_sheet_service.loadAndRegisterSheet(agent_sheet_uri, + interfaces.nsIStyleSheetService.AGENT_SHEET) + + if os.path.exists(Browser.USER_SHEET): + user_sheet_uri = io_service.newURI('file:///' + Browser.USER_SHEET, + None, None) + style_sheet_service.loadAndRegisterSheet(user_sheet_uri, + interfaces.nsIStyleSheetService.USER_SHEET) + def get_session(self): return sessionstore.get_session(self) diff --git a/clickToView.xml b/clickToView.xml new file mode 100644 index 0000000..6164c73 --- /dev/null +++ b/clickToView.xml @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + + -- cgit v0.9.1