Skip to content

Implement Change Preferences at Runtime. #1444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 22, 2015

Conversation

amaitland
Copy link
Member

Add new Get/Set preference methods to the RequestContext
Implementation is not quite complete yet.

@Bodekaer
Copy link
Contributor

@myrnazhou FYI a way for us to change spelling on the fly in the near future.

@mohdimas
Copy link
Contributor

@Bodekaer cool (y)

@amaitland amaitland force-pushed the feature/preferences branch from f20180b to 249ea57 Compare December 9, 2015 02:09
@amaitland
Copy link
Member Author

Basic implementation should be complete.

@Bodekaer @myrnazhou If either if you have time to take this for a spin that would be greatly appreciated 👍

@amaitland
Copy link
Member Author

It's probably worth creating an IRequestContext interface, so it's easy to write some extension methods in C# as I'm sure there will be some common use cases.

@ghost
Copy link

ghost commented Dec 13, 2015

GetAllPreferences returns null. I'd test if GetPreference/SetPreference works but I don't know preference names. Hmm maybe I use it wrong? (It's the latest commit from your fork/pull request)

var requestContext = new RequestContext(new RequestContextSettings(){CachePath = "data"});
var preferences = requestContext.GetAllPreferences(true);
// exception: preferences is null
foreach(var preference in preferences)
{
    //if(preference.Value!= null)
        Debug.Print(preference.Key + " : " + preference.Value);
}

Also don't forget to wrap GetDefaultCookieManager :)

@amaitland
Copy link
Member Author

GetAllPreferences returns null. I'd test if GetPreference/SetPreference works but I don't know preference names. Hmm maybe I use it wrong?

From what I can gather you have to wait for the browser to have initialized before you can call GetAllPreferences.

Also don't forget to wrap GetDefaultCookieManager :)

@midas643 I don't have any more time to work on this as the moment. Please submit a PR if you have time 👍

@ghost
Copy link

ghost commented Dec 14, 2015

@amaitland Thanks so much. I've used GetAllPreferences after initialization and it works.

Preferences:
apps
browser
content_settings_window
disable_3d_apis
enable_a_ping
enable_do_not_track
enable_referrers
extensions
fullscreen
intl
media
native_messaging
partition
plugins
printing
profile
proxy
settings
spellcheck
webkit
webrtc

I will surely submit a PR when I find time. After I test setting/getting I will post some examples here.

@amaitland
Copy link
Member Author

@midas643 Excellent news 👍 Any luck with setting a preference?

Anyone have a suggestion on how to wrap things in a nicer way?

Haven't yet implemented the GetAllPreferences as yet.
…eference key can have a dictionary of values as it's child.

For instance webgl may have a number of sub preferences.
Allow for returning of a dictionary when returning a specific preference
Having some compiler problems with setting of dictionary values
Can now access the RequestContext through IBrowserHost (can get access to the global context if required now)
@amaitland
Copy link
Member Author

I've rebased this PR on master and pushed a new commit, CookieManager is now exposed, I've also added a IRequestContext interface which means you can get access to the RequestContext through IBrowserHost.

Merging this into master now, any bugs/examples/improvements can be made in a subsequent PR.

amaitland added a commit that referenced this pull request Dec 22, 2015
Implement Change Preferences at Runtime.
@amaitland amaitland merged commit 4f6130b into cefsharp:master Dec 22, 2015
@amaitland amaitland deleted the feature/preferences branch December 22, 2015 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants