webcontents: notify guests of embedders' zoom level change
This commit is contained in:
parent
2d802d6f1e
commit
7756bb6762
5 changed files with 55 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "atom/common/api/api_messages.h"
|
||||
#include "atom/common/api/atom_bindings.h"
|
||||
#include "atom/common/node_bindings.h"
|
||||
#include "atom/common/node_includes.h"
|
||||
|
@ -21,11 +22,13 @@
|
|||
#include "content/public/renderer/render_frame.h"
|
||||
#include "content/public/renderer/render_frame_observer.h"
|
||||
#include "content/public/renderer/render_thread.h"
|
||||
#include "ipc/ipc_message_macros.h"
|
||||
#include "third_party/WebKit/public/web/WebCustomElement.h"
|
||||
#include "third_party/WebKit/public/web/WebLocalFrame.h"
|
||||
#include "third_party/WebKit/public/web/WebPluginParams.h"
|
||||
#include "third_party/WebKit/public/web/WebKit.h"
|
||||
#include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
|
||||
#include "third_party/WebKit/public/web/WebView.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <shlobj.h>
|
||||
|
@ -64,6 +67,22 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver {
|
|||
render_frame()->GetWebFrame(), context);
|
||||
}
|
||||
|
||||
bool OnMessageReceived(const IPC::Message& message) {
|
||||
bool handled = true;
|
||||
IPC_BEGIN_MESSAGE_MAP(AtomRenderFrameObserver, message)
|
||||
IPC_MESSAGE_HANDLER(AtomViewMsg_SetZoomLevel, OnSetZoomLevel)
|
||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||
IPC_END_MESSAGE_MAP()
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
void OnSetZoomLevel(double level) {
|
||||
auto view = render_frame()->GetWebFrame()->view();
|
||||
if (view)
|
||||
view->setZoomLevel(level);
|
||||
}
|
||||
|
||||
private:
|
||||
AtomRendererClient* renderer_client_;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue