diff options
Diffstat (limited to 'chromium/components/plugins')
-rw-r--r-- | chromium/components/plugins/renderer/BUILD.gn | 2 | ||||
-rw-r--r-- | chromium/components/plugins/renderer/DEPS | 1 | ||||
-rw-r--r-- | chromium/components/plugins/renderer/webview_plugin.cc | 25 | ||||
-rw-r--r-- | chromium/components/plugins/renderer/webview_plugin.h | 24 |
4 files changed, 37 insertions, 15 deletions
diff --git a/chromium/components/plugins/renderer/BUILD.gn b/chromium/components/plugins/renderer/BUILD.gn index 7a2ebb9c61e..890cd83c899 100644 --- a/chromium/components/plugins/renderer/BUILD.gn +++ b/chromium/components/plugins/renderer/BUILD.gn @@ -19,7 +19,7 @@ static_library("renderer") { ] } - public_deps = [ "//ui/base/cursor" ] + public_deps = [ "//ui/base/cursor:cursor_base" ] deps = [ "//content/public/child", diff --git a/chromium/components/plugins/renderer/DEPS b/chromium/components/plugins/renderer/DEPS index 1aeb13b810b..9257d696573 100644 --- a/chromium/components/plugins/renderer/DEPS +++ b/chromium/components/plugins/renderer/DEPS @@ -12,4 +12,5 @@ include_rules = [ "+third_party/re2", "+skia", "+ui/base/cursor", + "+ui/base/ime/mojom", ] diff --git a/chromium/components/plugins/renderer/webview_plugin.cc b/chromium/components/plugins/renderer/webview_plugin.cc index 28f8accaf2b..5ac3ac97c00 100644 --- a/chromium/components/plugins/renderer/webview_plugin.cc +++ b/chromium/components/plugins/renderer/webview_plugin.cc @@ -277,14 +277,15 @@ WebViewPlugin::WebViewHelper::WebViewHelper(WebViewPlugin* plugin, blink::mojom::FrameWidgetHostInterfaceBase>(), blink::CrossVariantMojoAssociatedReceiver< blink::mojom::FrameWidgetInterfaceBase>(), - blink::CrossVariantMojoAssociatedRemote< - blink::mojom::WidgetHostInterfaceBase>(), - blink::CrossVariantMojoAssociatedReceiver< - blink::mojom::WidgetInterfaceBase>()); - - // The WebFrame created here was already attached to the Page as its - // main frame, and the WebFrameWidget has been initialized, so we can call - // WebViewImpl's DidAttachLocalMainFrame(). + // TODO(dtapuska): https://crbug.com/1085031. Have the suffix ForTesting + // removed. + blink_widget_host_receiver_ + .BindNewEndpointAndPassDedicatedRemoteForTesting(), + blink_widget_.BindNewEndpointAndPassDedicatedReceiverForTesting()); + + // The WebFrame created here was already attached to the Page as its main + // frame, and the WebFrameWidget has been initialized, so we can call + // WebView's DidAttachLocalMainFrame(). web_view_->DidAttachLocalMainFrame(); } @@ -311,10 +312,12 @@ blink::WebScreenInfo WebViewPlugin::WebViewHelper::GetScreenInfo() { } void WebViewPlugin::WebViewHelper::SetToolTipText( - const WebString& text, + const base::string16& tooltip_text, base::i18n::TextDirection hint) { - if (plugin_->container_) - plugin_->container_->GetElement().SetAttribute("title", text); + if (plugin_->container_) { + plugin_->container_->GetElement().SetAttribute( + "title", WebString::FromUTF16(tooltip_text)); + } } void WebViewPlugin::WebViewHelper::StartDragging(network::mojom::ReferrerPolicy, diff --git a/chromium/components/plugins/renderer/webview_plugin.h b/chromium/components/plugins/renderer/webview_plugin.h index 34aaeda6bfc..b615db6841d 100644 --- a/chromium/components/plugins/renderer/webview_plugin.h +++ b/chromium/components/plugins/renderer/webview_plugin.h @@ -11,7 +11,10 @@ #include "base/memory/weak_ptr.h" #include "base/sequenced_task_runner_helpers.h" #include "content/public/renderer/render_view_observer.h" +#include "mojo/public/cpp/bindings/associated_receiver.h" +#include "mojo/public/cpp/bindings/associated_remote.h" #include "third_party/blink/public/mojom/input/focus_type.mojom-forward.h" +#include "third_party/blink/public/mojom/page/widget.mojom.h" #include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/public/platform/web_url_response.h" #include "third_party/blink/public/web/blink.h" @@ -21,6 +24,7 @@ #include "third_party/blink/public/web/web_view_client.h" #include "third_party/blink/public/web/web_widget_client.h" #include "ui/base/cursor/cursor.h" +#include "ui/base/ime/mojom/text_input_state.mojom.h" namespace blink { class WebLocalFrame; @@ -154,7 +158,8 @@ class WebViewPlugin : public blink::WebPlugin, // A helper that handles interaction from WebViewPlugin's internal WebView. class WebViewHelper : public blink::WebViewClient, public blink::WebWidgetClient, - public blink::WebLocalFrameClient { + public blink::WebLocalFrameClient, + public blink::mojom::WidgetHost { public: WebViewHelper(WebViewPlugin* plugin, const content::WebPreferences& preferences); @@ -171,8 +176,6 @@ class WebViewPlugin : public blink::WebPlugin, void DidInvalidateRect(const blink::WebRect&) override; // WebWidgetClient methods: - void SetToolTipText(const blink::WebString&, - base::i18n::TextDirection) override; void StartDragging(network::mojom::ReferrerPolicy, const blink::WebDragData&, blink::WebDragOperationsMask, @@ -188,12 +191,27 @@ class WebViewPlugin : public blink::WebPlugin, std::unique_ptr<blink::WebURLLoaderFactory> CreateURLLoaderFactory() override; + // blink::mojom::WidgetHost implementation. + void SetCursor(const ui::Cursor& cursor) override {} + void SetToolTipText(const base::string16& tooltip_text, + base::i18n::TextDirection hint) override; + void TextInputStateChanged(ui::mojom::TextInputStatePtr state) override {} + void SelectionBoundsChanged(const gfx::Rect& anchor_rect, + base::i18n::TextDirection anchor_dir, + const gfx::Rect& focus_rect, + base::i18n::TextDirection focus_dir, + bool is_anchor_first) override {} + private: WebViewPlugin* plugin_; blink::WebNavigationControl* frame_ = nullptr; // Owned by us, deleted via |close()|. blink::WebView* web_view_; + + mojo::AssociatedReceiver<blink::mojom::WidgetHost> + blink_widget_host_receiver_{this}; + mojo::AssociatedRemote<blink::mojom::Widget> blink_widget_; }; WebViewHelper web_view_helper_; |