chore: remove unused GuestViewContainer
(#35405)
chore: remove unused GuestViewContainer
This commit is contained in:
parent
22ff2b6b93
commit
70d6cbfb44
3 changed files with 0 additions and 109 deletions
|
@ -677,8 +677,6 @@ filenames = {
|
||||||
"shell/renderer/electron_renderer_pepper_host_factory.h",
|
"shell/renderer/electron_renderer_pepper_host_factory.h",
|
||||||
"shell/renderer/electron_sandboxed_renderer_client.cc",
|
"shell/renderer/electron_sandboxed_renderer_client.cc",
|
||||||
"shell/renderer/electron_sandboxed_renderer_client.h",
|
"shell/renderer/electron_sandboxed_renderer_client.h",
|
||||||
"shell/renderer/guest_view_container.cc",
|
|
||||||
"shell/renderer/guest_view_container.h",
|
|
||||||
"shell/renderer/renderer_client_base.cc",
|
"shell/renderer/renderer_client_base.cc",
|
||||||
"shell/renderer/renderer_client_base.h",
|
"shell/renderer/renderer_client_base.h",
|
||||||
"shell/renderer/web_worker_observer.cc",
|
"shell/renderer/web_worker_observer.cc",
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
// 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 "content/public/renderer/render_frame.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) {}
|
|
||||||
|
|
||||||
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
|
|
|
@ -1,47 +0,0 @@
|
||||||
// Copyright (c) 2015 GitHub, Inc.
|
|
||||||
// Use of this source code is governed by the MIT license that can be
|
|
||||||
// found in the LICENSE file.
|
|
||||||
|
|
||||||
#ifndef ELECTRON_SHELL_RENDERER_GUEST_VIEW_CONTAINER_H_
|
|
||||||
#define ELECTRON_SHELL_RENDERER_GUEST_VIEW_CONTAINER_H_
|
|
||||||
|
|
||||||
#include "base/callback.h"
|
|
||||||
|
|
||||||
namespace content {
|
|
||||||
class RenderFrame;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace gfx {
|
|
||||||
class Size;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace electron {
|
|
||||||
|
|
||||||
class GuestViewContainer {
|
|
||||||
public:
|
|
||||||
typedef base::RepeatingCallback<void(const gfx::Size&)> ResizeCallback;
|
|
||||||
|
|
||||||
explicit GuestViewContainer(content::RenderFrame* render_frame);
|
|
||||||
virtual ~GuestViewContainer();
|
|
||||||
|
|
||||||
// disable copy
|
|
||||||
GuestViewContainer(const GuestViewContainer&) = delete;
|
|
||||||
GuestViewContainer& operator=(const GuestViewContainer&) = delete;
|
|
||||||
|
|
||||||
static GuestViewContainer* FromID(int element_instance_id);
|
|
||||||
|
|
||||||
void RegisterElementResizeCallback(const ResizeCallback& callback);
|
|
||||||
void SetElementInstanceID(int element_instance_id);
|
|
||||||
void DidResizeElement(const gfx::Size& new_size);
|
|
||||||
|
|
||||||
private:
|
|
||||||
int element_instance_id_;
|
|
||||||
|
|
||||||
ResizeCallback element_resize_callback_;
|
|
||||||
|
|
||||||
base::WeakPtrFactory<GuestViewContainer> weak_ptr_factory_{this};
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace electron
|
|
||||||
|
|
||||||
#endif // ELECTRON_SHELL_RENDERER_GUEST_VIEW_CONTAINER_H_
|
|
Loading…
Add table
Reference in a new issue