Files
munki/code/Managed Software Update/MSUWebViewPolicyDelegate.py
Greg Neagle a853f78c9f Update copyright dates across the board.
git-svn-id: http://munki.googlecode.com/svn/trunk@1010 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-01-25 18:22:14 +00:00

35 lines
1.3 KiB
Python

#
# MSUWebViewPolicyDelegate.py
# ManagedSoftwareUpdate
#
# Created by Greg Neagle on 2/10/10.
# Copyright 2009-2011 Greg Neagle.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from Foundation import *
from WebKit import *
class MSUWebViewPolicyDelegate(NSObject):
# needed to intercept clicks on weblinks in descriptions
# and pass them onto the user's default web browser.
# without this the link will load inside the webview in our app.
def webView_decidePolicyForNavigationAction_request_frame_decisionListener_(self, webView, actionInformation, request, frame, listener):
if actionInformation.objectForKey_(u"WebActionNavigationTypeKey").intValue() == WebNavigationTypeLinkClicked:
listener.ignore()
NSWorkspace.sharedWorkspace().openURL_(request.URL())
else:
listener.use()