mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
* chore: bump chromium in DEPS to 87.0.4280.6 * chore: bump chromium in DEPS to 87.0.4280.11 * chore: update patches * Add deprecated_default_sources_assignment_filter variable https://chromium-review.googlesource.com/c/chromium/src/+/2416496 * 2426564: Remove global sources assignment filter value https://chromium-review.googlesource.com/c/chromium/src/+/2426564 * Remove set_sources_filter import * chore: fixup printing patch * Add DragOperation and AllowedDragOperations Mojo types https://chromium-review.googlesource.com/c/chromium/src/+/2196167 * Add DragOperation and AllowedDragOperations Mojo types https://chromium-review.googlesource.com/c/chromium/src/+/2196167 * Remove several references to BrowserPlugin from content https://chromium-review.googlesource.com/c/chromium/src/+/2401031 * Remove SurfaceEmbeddingTime and LocalSurfaceIdAllocation https://chromium-review.googlesource.com/c/chromium/src/+/2415128 * Remove several references to BrowserPlugin from content https://chromium-review.googlesource.com/c/chromium/src/+/2401031 * Service Manager embedders switches have been removed or moved Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2440974 * Remove SurfaceEmbeddingTime and LocalSurfaceIdAllocation https://chromium-review.googlesource.com/c/chromium/src/+/2415128 * [XProto] Remove usage of Xlib Visuals https://chromium-review.googlesource.com/c/chromium/src/+/2429933 * Implement tabs.removeCSS in electrons TabsExecuteScriptFunction Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2250506 * Remove lossy ConvertSizeToPixel() methods https://chromium-review.googlesource.com/c/chromium/src/+/2419534 * Remove all keyboard related usage of Xlib Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2436787 * fix: use parent namespace for zygote switches * ConvertRectToPixel methods have been removed Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2429143 * impl SortingLSH service Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2425327 * chore: update patches * chore: fix servicemanager removed namespace * chore: revert removed methods * chore: update patches * ExtensionURLLoaderFactory is now owned by its receivers Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2357523 * chore: fix linting * Skip Angle manifest file https://chromium-review.googlesource.com/c/angle/angle/+/2425197 Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
61 lines
1.8 KiB
C++
61 lines
1.8 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 "shell/renderer/guest_view_container.h"
|
|
|
|
#include <map>
|
|
#include <utility>
|
|
|
|
#include "base/bind.h"
|
|
#include "base/lazy_instance.h"
|
|
#include "base/threading/thread_task_runner_handle.h"
|
|
#include "ui/gfx/geometry/size.h"
|
|
|
|
namespace electron {
|
|
|
|
namespace {
|
|
|
|
using GuestViewContainerMap = std::map<int, GuestViewContainer*>;
|
|
static base::LazyInstance<GuestViewContainerMap>::DestructorAtExit
|
|
g_guest_view_container_map = LAZY_INSTANCE_INITIALIZER;
|
|
|
|
} // namespace
|
|
|
|
GuestViewContainer::GuestViewContainer(content::RenderFrame* render_frame)
|
|
: weak_ptr_factory_(this) {}
|
|
|
|
GuestViewContainer::~GuestViewContainer() {
|
|
if (element_instance_id_ > 0)
|
|
g_guest_view_container_map.Get().erase(element_instance_id_);
|
|
}
|
|
|
|
// static
|
|
GuestViewContainer* GuestViewContainer::FromID(int element_instance_id) {
|
|
GuestViewContainerMap* guest_view_containers =
|
|
g_guest_view_container_map.Pointer();
|
|
auto it = guest_view_containers->find(element_instance_id);
|
|
return it == guest_view_containers->end() ? nullptr : it->second;
|
|
}
|
|
|
|
void GuestViewContainer::RegisterElementResizeCallback(
|
|
const ResizeCallback& callback) {
|
|
element_resize_callback_ = callback;
|
|
}
|
|
|
|
void GuestViewContainer::SetElementInstanceID(int element_instance_id) {
|
|
element_instance_id_ = element_instance_id;
|
|
g_guest_view_container_map.Get().insert(
|
|
std::make_pair(element_instance_id, this));
|
|
}
|
|
|
|
void GuestViewContainer::DidResizeElement(const gfx::Size& new_size) {
|
|
if (element_resize_callback_.is_null())
|
|
return;
|
|
|
|
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
|
FROM_HERE, base::BindOnce(element_resize_callback_, new_size));
|
|
}
|
|
|
|
} // namespace electron
|