示例#1
0
        public CefSettings() : base(RecyclePtr)
        {
            cef_settings_t *ptr = (cef_settings_t *)Ptr;

            ptr->log_severity = cef_log_severity_t.LOGSEVERITY_WARNING;
            //ptr->multi_threaded_message_loop = 1;//TEST
        }
示例#2
0
 private static void Clear(cef_settings_t *ptr)
 {
     libcef.string_clear(&ptr->browser_subprocess_path);
     libcef.string_clear(&ptr->cache_path);
     libcef.string_clear(&ptr->user_agent);
     libcef.string_clear(&ptr->product_version);
     libcef.string_clear(&ptr->locale);
     libcef.string_clear(&ptr->log_file);
     libcef.string_clear(&ptr->javascript_flags);
     libcef.string_clear(&ptr->resources_dir_path);
     libcef.string_clear(&ptr->locales_dir_path);
 }
示例#3
0
        static unsafe void RecyclePtr(IntPtr intptr)
        {
            cef_settings_t *ptr = (cef_settings_t *)intptr;

            //TODO: if the libcef.dll is not initialized , this function is not able to call
            //so check the pointer before release it
            if (ptr->resources_dir_path.str != null)
            {
                ObjectInterop.cef_string_utf16_clear(&ptr->resources_dir_path);
            }
            //TODO:other strings
        }
示例#4
0
 public static void Clear(cef_settings_t *self)
 {
     cef_string_t.Clear(&self->cache_path);
     cef_string_t.Clear(&self->user_agent);
     cef_string_t.Clear(&self->product_version);
     cef_string_t.Clear(&self->locale);
     // FIXME: null check?
     CefStringList.DestroyHandle(self->extra_plugin_paths);
     cef_string_t.Clear(&self->log_file);
     cef_string_t.Clear(&self->javascript_flags);
     cef_string_t.Clear(&self->resources_dir_path);
     cef_string_t.Clear(&self->locales_dir_path);
 }
示例#5
0
 private static void Clear(cef_settings_t *ptr)
 {
     libcef.string_clear(&ptr->browser_subprocess_path);
     libcef.string_clear(&ptr->cache_path);
     libcef.string_clear(&ptr->user_data_path);
     libcef.string_clear(&ptr->user_agent);
     libcef.string_clear(&ptr->product_version);
     libcef.string_clear(&ptr->locale);
     libcef.string_clear(&ptr->log_file);
     libcef.string_clear(&ptr->javascript_flags);
     libcef.string_clear(&ptr->resources_dir_path);
     libcef.string_clear(&ptr->locales_dir_path);
     libcef.string_clear(&ptr->accept_language_list);
     libcef.string_clear(&ptr->auth_server_whitelist);
     libcef.string_clear(&ptr->auth_delegate_whitelist);
 }
示例#6
0
 private static void Clear(cef_settings_t *ptr)
 {
     libcef.string_clear(&ptr->browser_subprocess_path);
     libcef.string_clear(&ptr->framework_dir_path);
     libcef.string_clear(&ptr->main_bundle_path);
     libcef.string_clear(&ptr->cache_path);
     libcef.string_clear(&ptr->root_cache_path);
     libcef.string_clear(&ptr->user_data_path);
     libcef.string_clear(&ptr->user_agent);
     libcef.string_clear(&ptr->product_version);
     libcef.string_clear(&ptr->locale);
     libcef.string_clear(&ptr->log_file);
     libcef.string_clear(&ptr->javascript_flags);
     libcef.string_clear(&ptr->resources_dir_path);
     libcef.string_clear(&ptr->locales_dir_path);
     libcef.string_clear(&ptr->accept_language_list);
     libcef.string_clear(&ptr->application_client_id_for_file_scanning);
 }
示例#7
0
 protected virtual void Dispose(bool disposing)
 {
     if (_disposable && _instance != null)
     {
         BrowserSubprocessPath = null;
         FrameworkDirPath      = null;
         MainBundlePath        = null;
         CachePath             = null;
         RootCachePath         = null;
         UserDataPath          = null;
         UserAgent             = null;
         ProductVersion        = null;
         Locale             = null;
         LogFile            = null;
         JavascriptFlags    = null;
         ResourcesDirPath   = null;
         LocalesDirPath     = null;
         AcceptLanguageList = null;
         ApplicationClientIdForFileScanning = null;
         Marshal.FreeHGlobal((IntPtr)_instance);
         _instance = null;
     }
 }
 public static void Free(cef_settings_t *ptr)
 {
     Marshal.FreeHGlobal((IntPtr)ptr);
 }
示例#9
0
 public static extern int initialize(cef_main_args_t *args, cef_settings_t *settings, cef_app_t *application, void *windows_sandbox_info);
示例#10
0
        static public unsafe CefInitState InternalCefInitialize(string resourceFolder)
        {
            cef_settings_t *settings = LibCefInterop.Settings.FixedPtr;

            //TODO: better solution for dirs..

            if (settings->resources_dir_path.IsNullOrEmpty())
            {
                F.invoke_set(&settings->resources_dir_path, resourceFolder);
            }


            string folder;

            try
            {
                folder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
                folder = System.IO.Path.Combine(folder, ApplicationName);
                if (!System.IO.Directory.Exists(folder))
                {
                    System.IO.Directory.CreateDirectory(folder);
                }
            }
            catch (Exception x)
            {
                WriteDebugLine("Error:Failed to create local app data folder.");
                WriteDebugLine(x);
                folder = System.IO.Path.GetTempPath();
            }


            Console.WriteLine("CEF Data Folder : " + folder);

            if (settings->log_severity != cef_log_severity_t.LOGSEVERITY_DISABLE)
            {
                F.invoke_set(&settings->log_file, System.IO.Path.Combine(folder, "ceflog.txt"));
            }


            bool continueUseCacheFolder = true;

            if (SettingAutoClearCacheInStoragePath && DetectIsMainProcess())
            {
                try
                {
                    void DeleteFolder(string path)
                    {
                        if (!Directory.Exists(path))
                        {
                            return;
                        }
                        foreach (string file in Directory.GetFiles(path))
                        {
                            File.Delete(file);
                        }
                        foreach (string subdir in Directory.GetDirectories(path))
                        {
                            DeleteFolder(subdir);
                        }
                        Directory.Delete(path);
                    }
                    DeleteFolder(Path.Combine(folder, "Cache"));
                }
                catch (Exception x)
                {
                    continueUseCacheFolder = false;
                    WriteDebugLine(x);
                }
            }

            if (SettingAutoSetCacheStoragePath && continueUseCacheFolder)
            {
                if (settings->cache_path.IsNullOrEmpty())
                {
                    F.invoke_set(&settings->cache_path, folder);
                    F.invoke_set(&settings->root_cache_path, folder);                    //force the root_cache_path use the same value
                }
            }

            if (SettingAutoSetUserDataStoragePath)
            {
                if (settings->user_data_path.IsNullOrEmpty())
                {
                    F.invoke_set(&settings->user_data_path, folder);
                }
            }

            var state = LibCefInterop.Initialize();

            WriteDebugLine("libcef Initialize : " + state);

            if (state != CefInitState.Initialized)
            {
                CloseSplashScreen();
            }

            return(state);
        }
示例#11
0
 internal static void Free(cef_settings_t *ptr)
 {
     Clear(ptr);
     cef_settings_t.Free(ptr);
 }
示例#12
0
 public static extern int initialize(cef_main_args_t *args, cef_settings_t *settings, cef_app_t *application);
示例#13
0
 public CefSettings(cef_settings_t *instance)
 {
     _instance = instance;
 }
示例#14
0
 public CefSettings()
 {
     _disposable     = true;
     _instance       = (cef_settings_t *)CefStructure.Allocate(sizeof(cef_settings_t));
     _instance->size = new UIntPtr((uint)sizeof(cef_settings_t));
 }