feat: add new imageAnimationPolicy webpref and webContents setter (#29095)

This commit is contained in:
Samuel Attard 2021-06-07 19:00:22 -07:00 committed by GitHub
parent 79cb5144ae
commit 8446ce1fc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 51 additions and 0 deletions

View file

@ -3142,6 +3142,13 @@ void WebContents::NotifyUserActivation() {
blink::mojom::UserActivationNotificationType::kInteraction);
}
void WebContents::SetImageAnimationPolicy(const std::string& new_policy) {
auto* web_preferences = WebContentsPreferences::From(web_contents());
web_preferences->preference()->SetKey(options::kImageAnimationPolicy,
base::Value(new_policy));
web_contents()->OnWebPreferencesChanged();
}
v8::Local<v8::Promise> WebContents::TakeHeapSnapshot(
v8::Isolate* isolate,
const base::FilePath& file_path) {
@ -3689,6 +3696,8 @@ v8::Local<v8::ObjectTemplate> WebContents::FillObjectTemplate(
&WebContents::GetWebRTCIPHandlingPolicy)
.SetMethod("_grantOriginAccess", &WebContents::GrantOriginAccess)
.SetMethod("takeHeapSnapshot", &WebContents::TakeHeapSnapshot)
.SetMethod("setImageAnimationPolicy",
&WebContents::SetImageAnimationPolicy)
.SetProperty("id", &WebContents::ID)
.SetProperty("session", &WebContents::Session)
.SetProperty("hostWebContents", &WebContents::HostWebContents)