 
 import UIKit
 
-class V2WebViewViewController: UIViewController ,V2WebViewProgressDelegate {
+class V2WebViewViewController: UIViewController ,V2WebViewProgressDelegate ,V2ActivityViewDataSource {
     var webViewProgress: V2WebViewProgress?
     var webViewProgressView: V2WebViewProgressView?
     var webView:UIWebView?

        self.closeButton!.addTarget(self, action: "pop", forControlEvents: .TouchUpInside)
        
        self.navigationItem.leftBarButtonItems = [UIBarButtonItem(customView: backbtn),UIBarButtonItem(customView: self.closeButton!)]
        
        self.webViewProgress = V2WebViewProgress()
        self.webViewProgress!.delegate = self

    deinit{
        NSLog("webview deinit")
    }
    
    //MARK: - V2ActivityView
    func rightClick(){
        let activityView = V2ActivityViewController()
        activityView.dataSource = self
        self.navigationController!.presentViewController(activityView, animated: true, completion: nil)
    }
    func V2ActivityView(activityView: V2ActivityViewController, numberOfCellsInSection section: Int) -> Int {
        return 1
    }
    func V2ActivityView(activityView: V2ActivityViewController, ActivityAtIndexPath indexPath: NSIndexPath) -> V2Activity {
        return V2Activity(title: ["Safari"][indexPath.row], image: UIImage(named: ["ic_explore_48pt"][indexPath.row])!)
    }
    func V2ActivityView(activityView: V2ActivityViewController, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        activityView.dismiss()
        if  let url = self.webView?.request?.URL {
            if url.absoluteString.Lenght > 0 {
                UIApplication.sharedApplication().openURL(url)
                return;
            }
        }
        if let url = NSURL(string: self.url) {
            UIApplication.sharedApplication().openURL(url)
        }
        
    }
}
