[unseasoned-pdf] Implement modal dialog methods
Fixed: 1221577 Change-Id: I0b32ec6868c75fa86d12a40597dd4d3ca85b8629 Bug: 1221577 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2973027 Auto-Submit: Daniel Hosseinian <dhoss@chromium.org> Commit-Queue: Hui Yingst <nigi@chromium.org> Reviewed-by: Hui Yingst <nigi@chromium.org> Cr-Commit-Position: refs/heads/master@{#894012}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
009cada961
commit
f27b80887f
@ -141,6 +141,19 @@ class BlinkContainerWrapper final : public PdfViewWebPlugin::ContainerWrapper {
|
||||
GetFrame()->SetReferrerForRequest(request, referrer_url);
|
||||
}
|
||||
|
||||
void Alert(const blink::WebString& message) override {
|
||||
GetFrame()->Alert(message);
|
||||
}
|
||||
|
||||
bool Confirm(const blink::WebString& message) override {
|
||||
return GetFrame()->Confirm(message);
|
||||
}
|
||||
|
||||
blink::WebString Prompt(const blink::WebString& message,
|
||||
const blink::WebString& default_value) override {
|
||||
return GetFrame()->Prompt(message, default_value);
|
||||
}
|
||||
|
||||
void TextSelectionChanged(const blink::WebString& selection_text,
|
||||
uint32_t offset,
|
||||
const gfx::Range& range) override {
|
||||
@ -449,15 +462,20 @@ void PdfViewWebPlugin::NotifyNumberOfFindResultsChanged(int total,
|
||||
void PdfViewWebPlugin::NotifySelectedFindResultChanged(int current_find_index) {
|
||||
}
|
||||
|
||||
void PdfViewWebPlugin::Alert(const std::string& message) {}
|
||||
void PdfViewWebPlugin::Alert(const std::string& message) {
|
||||
container_wrapper_->Alert(blink::WebString::FromUTF8(message));
|
||||
}
|
||||
|
||||
bool PdfViewWebPlugin::Confirm(const std::string& message) {
|
||||
return false;
|
||||
return container_wrapper_->Confirm(blink::WebString::FromUTF8(message));
|
||||
}
|
||||
|
||||
std::string PdfViewWebPlugin::Prompt(const std::string& question,
|
||||
const std::string& default_answer) {
|
||||
return "";
|
||||
return container_wrapper_
|
||||
->Prompt(blink::WebString::FromUTF8(question),
|
||||
blink::WebString::FromUTF8(default_answer))
|
||||
.Utf8();
|
||||
}
|
||||
|
||||
void PdfViewWebPlugin::Print() {}
|
||||
|
@ -65,6 +65,16 @@ class PdfViewWebPlugin final : public PdfViewPluginBase,
|
||||
virtual void SetReferrerForRequest(blink::WebURLRequest& request,
|
||||
const blink::WebURL& referrer_url) = 0;
|
||||
|
||||
// Calls underlying WebLocalFrame::Alert().
|
||||
virtual void Alert(const blink::WebString& message) = 0;
|
||||
|
||||
// Calls underlying WebLocalFrame::Confirm().
|
||||
virtual bool Confirm(const blink::WebString& message) = 0;
|
||||
|
||||
// Calls underlying WebLocalFrame::Prompt().
|
||||
virtual blink::WebString Prompt(const blink::WebString& message,
|
||||
const blink::WebString& default_value) = 0;
|
||||
|
||||
// Calls underlying WebLocalFrame::TextSelectionChanged().
|
||||
virtual void TextSelectionChanged(const blink::WebString& selection_text,
|
||||
uint32_t offset,
|
||||
|
@ -99,6 +99,15 @@ class FakeContainerWrapper final : public PdfViewWebPlugin::ContainerWrapper {
|
||||
(blink::WebURLRequest&, const blink::WebURL&),
|
||||
(override));
|
||||
|
||||
MOCK_METHOD(void, Alert, (const blink::WebString&), (override));
|
||||
|
||||
MOCK_METHOD(bool, Confirm, (const blink::WebString&), (override));
|
||||
|
||||
MOCK_METHOD(blink::WebString,
|
||||
Prompt,
|
||||
(const blink::WebString&, const blink::WebString&),
|
||||
(override));
|
||||
|
||||
MOCK_METHOD(void,
|
||||
TextSelectionChanged,
|
||||
(const blink::WebString&, uint32_t, const gfx::Range&),
|
||||
|
Reference in New Issue
Block a user