2012-04-03 03:34:16 +02:00
|
|
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
|
|
|
// reserved. Use of this source code is governed by a BSD-style license that can
|
|
|
|
// be found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef CEF_LIBCEF_RENDERER_FRAME_IMPL_H_
|
|
|
|
#define CEF_LIBCEF_RENDERER_FRAME_IMPL_H_
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include "include/cef_frame.h"
|
|
|
|
#include "include/cef_v8.h"
|
|
|
|
|
2019-05-24 22:23:43 +02:00
|
|
|
namespace base {
|
|
|
|
class ListValue;
|
|
|
|
}
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2013-11-08 22:28:56 +01:00
|
|
|
namespace blink {
|
2020-12-02 23:31:49 +01:00
|
|
|
class ResourceLoadInfoNotifierWrapper;
|
2017-07-27 01:19:27 +02:00
|
|
|
class WebLocalFrame;
|
2020-12-02 23:31:49 +01:00
|
|
|
class WebURLLoader;
|
2019-05-11 00:14:48 +02:00
|
|
|
class WebURLLoaderFactory;
|
|
|
|
} // namespace blink
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2019-05-24 22:23:43 +02:00
|
|
|
namespace IPC {
|
|
|
|
class Message;
|
|
|
|
}
|
|
|
|
|
|
|
|
class GURL;
|
|
|
|
|
|
|
|
class CefBrowserImpl;
|
|
|
|
class CefResponseManager;
|
|
|
|
struct CefMsg_LoadRequest_Params;
|
|
|
|
struct Cef_Request_Params;
|
|
|
|
struct Cef_Response_Params;
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
// Implementation of CefFrame. CefFrameImpl objects are owned by the
|
|
|
|
// CefBrowerImpl and will be detached when the browser is notified that the
|
|
|
|
// associated renderer WebFrame will close.
|
|
|
|
class CefFrameImpl : public CefFrame {
|
|
|
|
public:
|
2018-07-09 20:36:37 +02:00
|
|
|
CefFrameImpl(CefBrowserImpl* browser,
|
|
|
|
blink::WebLocalFrame* frame,
|
|
|
|
int64_t frame_id);
|
2014-11-12 20:25:15 +01:00
|
|
|
~CefFrameImpl() override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// CefFrame implementation.
|
2014-11-12 20:25:15 +01:00
|
|
|
bool IsValid() override;
|
|
|
|
void Undo() override;
|
|
|
|
void Redo() override;
|
|
|
|
void Cut() override;
|
|
|
|
void Copy() override;
|
|
|
|
void Paste() override;
|
|
|
|
void Delete() override;
|
|
|
|
void SelectAll() override;
|
|
|
|
void ViewSource() override;
|
|
|
|
void GetSource(CefRefPtr<CefStringVisitor> visitor) override;
|
|
|
|
void GetText(CefRefPtr<CefStringVisitor> visitor) override;
|
|
|
|
void LoadRequest(CefRefPtr<CefRequest> request) override;
|
|
|
|
void LoadURL(const CefString& url) override;
|
|
|
|
void ExecuteJavaScript(const CefString& jsCode,
|
|
|
|
const CefString& scriptUrl,
|
|
|
|
int startLine) override;
|
|
|
|
bool IsMain() override;
|
|
|
|
bool IsFocused() override;
|
|
|
|
CefString GetName() override;
|
|
|
|
int64 GetIdentifier() override;
|
|
|
|
CefRefPtr<CefFrame> GetParent() override;
|
|
|
|
CefString GetURL() override;
|
|
|
|
CefRefPtr<CefBrowser> GetBrowser() override;
|
|
|
|
CefRefPtr<CefV8Context> GetV8Context() override;
|
|
|
|
void VisitDOM(CefRefPtr<CefDOMVisitor> visitor) override;
|
2019-05-11 00:14:48 +02:00
|
|
|
CefRefPtr<CefURLRequest> CreateURLRequest(
|
|
|
|
CefRefPtr<CefRequest> request,
|
|
|
|
CefRefPtr<CefURLRequestClient> client) override;
|
2019-05-24 22:23:43 +02:00
|
|
|
void SendProcessMessage(CefProcessId target_process,
|
|
|
|
CefRefPtr<CefProcessMessage> message) override;
|
2019-05-11 00:14:48 +02:00
|
|
|
|
|
|
|
// Used by CefRenderURLRequest.
|
2020-12-02 23:31:49 +01:00
|
|
|
std::unique_ptr<blink::WebURLLoader> CreateURLLoader();
|
|
|
|
std::unique_ptr<blink::ResourceLoadInfoNotifierWrapper>
|
|
|
|
CreateResourceLoadInfoNotifierWrapper();
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2019-05-24 22:23:43 +02:00
|
|
|
// Forwarded from CefRenderFrameObserver.
|
|
|
|
void OnAttached();
|
|
|
|
bool OnMessageReceived(const IPC::Message& message);
|
|
|
|
void OnDidFinishLoad();
|
|
|
|
void OnDraggableRegionsChanged();
|
|
|
|
void OnDetached();
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2017-07-27 01:19:27 +02:00
|
|
|
blink::WebLocalFrame* web_frame() const { return frame_; }
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2016-07-21 23:21:32 +02:00
|
|
|
private:
|
|
|
|
void ExecuteCommand(const std::string& command);
|
|
|
|
|
2019-05-24 22:23:43 +02:00
|
|
|
// Avoids unnecessary string type conversions.
|
|
|
|
void SendProcessMessage(CefProcessId target_process,
|
|
|
|
const std::string& name,
|
|
|
|
base::ListValue* arguments,
|
|
|
|
bool user_initiated);
|
|
|
|
|
|
|
|
// Send a message to the RenderFrame associated with this frame.
|
|
|
|
void Send(IPC::Message* message);
|
|
|
|
|
|
|
|
// OnMessageReceived message handlers.
|
|
|
|
void OnRequest(const Cef_Request_Params& params);
|
|
|
|
void OnResponse(const Cef_Response_Params& params);
|
|
|
|
void OnResponseAck(int request_id);
|
|
|
|
void OnDidStopLoading();
|
2020-12-02 23:31:49 +01:00
|
|
|
void OnMoveOrResizeStarted();
|
2019-05-24 22:23:43 +02:00
|
|
|
void OnLoadRequest(const CefMsg_LoadRequest_Params& params);
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
CefBrowserImpl* browser_;
|
2017-07-27 01:19:27 +02:00
|
|
|
blink::WebLocalFrame* frame_;
|
2019-05-24 22:23:43 +02:00
|
|
|
const int64 frame_id_;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2019-05-11 00:14:48 +02:00
|
|
|
std::unique_ptr<blink::WebURLLoaderFactory> url_loader_factory_;
|
|
|
|
|
2019-05-24 22:23:43 +02:00
|
|
|
// Manages response registrations.
|
|
|
|
std::unique_ptr<CefResponseManager> response_manager_;
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
IMPLEMENT_REFCOUNTING(CefFrameImpl);
|
2015-12-09 17:10:16 +01:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefFrameImpl);
|
2012-04-03 03:34:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_RENDERER_FRAME_IMPL_H_
|