blob: 389a6bfd2499428c89c82e68cfe67bc0708488b1 [file] [log] [blame]
// Copyright 2014 The Chromium 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 ANDROID_WEBVIEW_RENDERER_AW_RENDER_FRAME_EXT_H_
#define ANDROID_WEBVIEW_RENDERER_AW_RENDER_FRAME_EXT_H_
#include "base/macros.h"
#include "content/public/renderer/render_frame_observer.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/geometry/size_f.h"
#include "url/origin.h"
namespace blink {
enum WebMeaningfulLayout;
class WebFrameWidget;
class WebView;
}
namespace android_webview {
// Render process side of AwRenderViewHostExt, this provides cross-process
// implementation of miscellaneous WebView functions that we need to poke
// WebKit directly to implement (and that aren't needed in the chrome app).
class AwRenderFrameExt : public content::RenderFrameObserver {
public:
explicit AwRenderFrameExt(content::RenderFrame* render_frame);
static AwRenderFrameExt* FromRenderFrame(content::RenderFrame* render_frame);
bool GetWillSuppressErrorPage();
private:
~AwRenderFrameExt() override;
// RenderFrameObserver:
bool OnAssociatedInterfaceRequestForFrame(
const std::string& interface_name,
mojo::ScopedInterfaceEndpointHandle* handle) override;
void DidCommitProvisionalLoad(bool is_same_document_navigation,
ui::PageTransition transition) override;
bool OnMessageReceived(const IPC::Message& message) override;
void FocusedElementChanged(const blink::WebElement& element) override;
void OnDestruct() override;
void OnDocumentHasImagesRequest(uint32_t id);
void OnDoHitTest(const gfx::PointF& touch_center,
const gfx::SizeF& touch_area);
void OnSetTextZoomFactor(float zoom_factor);
void OnResetScrollAndScaleState();
void OnSetInitialPageScale(double page_scale_factor);
void OnSetBackgroundColor(SkColor c);
void OnSmoothScroll(int target_x, int target_y, uint64_t duration_ms);
void OnSetWillSuppressErrorPage(bool suppress);
blink::WebView* GetWebView();
blink::WebFrameWidget* GetWebFrameWidget();
url::Origin last_origin_;
blink::AssociatedInterfaceRegistry registry_;
// Some WebView users might want to show their own error pages / logic
bool will_suppress_error_page_ = false;
DISALLOW_COPY_AND_ASSIGN(AwRenderFrameExt);
};
} // namespace android_webview
#endif // ANDROID_WEBVIEW_RENDERER_AW_RENDER_FRAME_EXT_H_