mirror of
https://github.com/electron/electron.git
synced 2026-01-10 07:58:08 -05:00
* chore: bump chromium in DEPS to 143.0.7489.0 * chore: update add_didinstallconditionalfeatures.patch no manual changes; patch applied with fuzz * chore: update allow_in-process_windows_to_have_different_web_prefs.patch patch reapplied manually due to context shear Remove BackForwardTransitions flag | https://chromium-review.googlesource.com/c/chromium/src/+/7022596 * chore: update process_singleton.patch patch reapplied manually due to context shear Use an empty prefix for socket temporary directory. | https://chromium-review.googlesource.com/c/chromium/src/+/7062192 * chore: update add_electron_deps_to_license_credits_file.patch no manual changes; patch applied with fuzz * chore: update expose_ripemd160.patch Apply modernize-use-nullptr fixes in all .cc files | https://boringssl-review.googlesource.com/c/boringssl/+/83067 * chore: update feat_expose_several_extra_cipher_functions.patch Apply modernize-use-nullptr fixes in all .cc files | https://boringssl-review.googlesource.com/c/boringssl/+/83067 * Pass Bus::Options by value with std::move. | https://chromium-review.googlesource.com/c/chromium/src/+/7056670 * chore: update patches * Remove some includes of base/callback_list.h | https://chromium-review.googlesource.com/c/chromium/src/+/7055621 * chore: run gen-libc++-filenames.js --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
54 lines
1.9 KiB
C++
54 lines
1.9 KiB
C++
// Copyright (c) 2015 GitHub, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "base/callback_list.h"
|
|
#include "content/public/browser/browser_context.h"
|
|
#include "shell/browser/javascript_environment.h"
|
|
#include "shell/browser/web_contents_preferences.h"
|
|
#include "shell/browser/web_contents_zoom_controller.h"
|
|
#include "shell/browser/web_view_manager.h"
|
|
#include "shell/common/gin_converters/content_converter.h"
|
|
#include "shell/common/gin_helper/dictionary.h"
|
|
#include "shell/common/node_includes.h"
|
|
#include "shell/common/options_switches.h"
|
|
|
|
using electron::WebContentsPreferences;
|
|
|
|
namespace {
|
|
|
|
void AddGuest(int guest_instance_id,
|
|
content::WebContents* embedder,
|
|
content::WebContents* guest_web_contents,
|
|
const gin_helper::Dictionary& options) {
|
|
auto* manager = electron::WebViewManager::GetWebViewManager(embedder);
|
|
if (manager)
|
|
manager->AddGuest(guest_instance_id, embedder, guest_web_contents);
|
|
|
|
double zoom_factor;
|
|
if (options.Get(electron::options::kZoomFactor, &zoom_factor)) {
|
|
electron::WebContentsZoomController::FromWebContents(guest_web_contents)
|
|
->SetDefaultZoomFactor(zoom_factor);
|
|
}
|
|
}
|
|
|
|
void RemoveGuest(content::WebContents* embedder, int guest_instance_id) {
|
|
auto* manager = electron::WebViewManager::GetWebViewManager(embedder);
|
|
if (manager)
|
|
manager->RemoveGuest(guest_instance_id);
|
|
}
|
|
|
|
void Initialize(v8::Local<v8::Object> exports,
|
|
v8::Local<v8::Value> unused,
|
|
v8::Local<v8::Context> context,
|
|
void* priv) {
|
|
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
|
gin_helper::Dictionary dict{isolate, exports};
|
|
dict.SetMethod("addGuest", &AddGuest);
|
|
dict.SetMethod("removeGuest", &RemoveGuest);
|
|
}
|
|
|
|
} // namespace
|
|
|
|
NODE_LINKED_BINDING_CONTEXT_AWARE(electron_browser_web_view_manager, Initialize)
|