コード例 #1
0
        /// <summary>
        /// this is done just once, to globally initialize CefSharp/CEF
        /// </summary>
        private void InitBrowser()
        {
            CefSettings settings = new CefSettings();

            settings.RegisterScheme(new CefCustomScheme {
                SchemeName           = "sharpbrowser",
                SchemeHandlerFactory = new SchemeHandlerFactory()
            });

            settings.UserAgent = UserAgent;

            settings.IgnoreCertificateErrors = true;

            settings.CachePath = GetAppDir("Cache");

            Cef.Initialize(settings);

            dHandler = new DownloadHandler(this);
            lHandler = new LifeSpanHandler(this);
            mHandler = new ContextMenuHandler(this);
            kHandler = new KeyboardHandler(this);
            rHandler = new RequestHandler(this);

            InitDownloads();

            host = new HostHandler(this);

            AddNewBrowser(tabStrip1, HomepageURL);
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: GerHobbelt/SharpBrowser
        /// <summary>
        /// this is done just once, to globally initialize CefSharp/CEF
        /// </summary>
        private void InitBrowser()
        {
            CefSharpSettings.LegacyJavascriptBindingEnabled = true;
            CefSharpSettings.WcfEnabled = false;

            CefSettings settings = new CefSettings();

            settings.RegisterScheme(new CefCustomScheme {
                SchemeName           = InternalURL,
                SchemeHandlerFactory = new SchemeHandlerFactory()
            });

            settings.UserAgent          = UserAgent;
            settings.AcceptLanguageList = AcceptLanguage;

            settings.IgnoreCertificateErrors = true;

            settings.CachePath = GetAppDir("Cache");

            Cef.Initialize(settings);

            dHandler = new DownloadHandler(this);
            lHandler = new LifeSpanHandler(this);
            mHandler = new ContextMenuHandler(this);
            kHandler = new KeyboardHandler(this);
            rHandler = new RequestHandler(this);

            InitDownloads();

            host = new HostHandler(this);

            AddNewBrowser(tabStrip1, HomepageURL);
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: mwwalmsley/SharpBrowser
        public MainForm()
        {
            InitializeComponent();

            CefSettings settings = new CefSettings();

            settings.RegisterScheme(new CefCustomScheme {
                SchemeName           = SchemeHandlerFactory.SchemeName,
                SchemeHandlerFactory = new SchemeHandlerFactory()
            });

            settings.RegisterScheme(new CefCustomScheme {
                SchemeName           = SchemeHandlerFactory.SchemeNameTest,
                SchemeHandlerFactory = new SchemeHandlerFactory()
            });

            settings.UserAgent = ChromeAgent;

            Cef.Initialize(settings);

            dHandler = new DownloadHandler(this);
            lHandler = new LifeSpanHandler(this);
            mHandler = new MenuHandler(this);
            kHandler = new KeyboardHandler(this);

            downloads              = new Dictionary <int, DownloadItem>();
            downloadNames          = new Dictionary <int, string>();
            downloadCancelRequests = new List <int>();

            host = new HostHandler(this);

            txtUrl.Text = startURL;
            AddNewBrowser(tabStrip1, startURL);

            SetFormTitle(null);
        }