summaryrefslogtreecommitdiffstats
path: root/components/guest_view/browser
diff options
context:
space:
mode:
authorpaulmeyer <paulmeyer@chromium.org>2015-08-10 10:38:47 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-10 17:39:33 +0000
commit95703b99631af63f8923a4665b142fc5f23b8774 (patch)
tree870d5775d34710203c9c5ec90547535f1b35dd17 /components/guest_view/browser
parent3033d1de7158836f0d51df83bc7a901d551b31e7 (diff)
downloadchromium_src-95703b99631af63f8923a4665b142fc5f23b8774.zip
chromium_src-95703b99631af63f8923a4665b142fc5f23b8774.tar.gz
chromium_src-95703b99631af63f8923a4665b142fc5f23b8774.tar.bz2
This patch allows find-in-page to work on the Chrome signin page.
This is done by allowing any page with a single guest the possibility of handling a find request, and by implementing a way for different GuestView types to specify exactly when a guest of that type should handle a find request in place of its embedder. Right now, only MimeHandlerViews (in the case of PDFs) and WebViews (in the case of the chrome signin page) will potentially handle these requests. BUG=463799 Review URL: https://codereview.chromium.org/1279833004 Cr-Commit-Position: refs/heads/master@{#342643}
Diffstat (limited to 'components/guest_view/browser')
-rw-r--r--components/guest_view/browser/guest_view_base.cc22
-rw-r--r--components/guest_view/browser/guest_view_base.h9
2 files changed, 31 insertions, 0 deletions
diff --git a/components/guest_view/browser/guest_view_base.cc b/components/guest_view/browser/guest_view_base.cc
index 20443d3..5b4fa13 100644
--- a/components/guest_view/browser/guest_view_base.cc
+++ b/components/guest_view/browser/guest_view_base.cc
@@ -407,6 +407,24 @@ void GuestViewBase::DidDetach() {
element_instance_id_ = kInstanceIDNone;
}
+bool GuestViewBase::Find(int request_id,
+ const base::string16& search_text,
+ const blink::WebFindOptions& options) {
+ if (ShouldHandleFindRequestsForEmbedder()) {
+ web_contents()->Find(request_id, search_text, options);
+ return true;
+ }
+ return false;
+}
+
+bool GuestViewBase::StopFinding(content::StopFindAction action) {
+ if (ShouldHandleFindRequestsForEmbedder()) {
+ web_contents()->StopFinding(action);
+ return true;
+ }
+ return false;
+}
+
WebContents* GuestViewBase::GetOwnerWebContents() const {
return owner_web_contents_;
}
@@ -513,6 +531,10 @@ void GuestViewBase::SignalWhenReady(const base::Closure& callback) {
callback.Run();
}
+bool GuestViewBase::ShouldHandleFindRequestsForEmbedder() const {
+ return false;
+}
+
int GuestViewBase::LogicalPixelsToPhysicalPixels(double logical_pixels) const {
DCHECK(logical_pixels >= 0);
double zoom_factor = GetEmbedderZoomFactor();
diff --git a/components/guest_view/browser/guest_view_base.h b/components/guest_view/browser/guest_view_base.h
index 2e7862d..77f1398 100644
--- a/components/guest_view/browser/guest_view_base.h
+++ b/components/guest_view/browser/guest_view_base.h
@@ -277,6 +277,10 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate,
void DidAttach(int guest_proxy_routing_id) final;
void DidDetach() final;
content::WebContents* GetOwnerWebContents() const final;
+ bool Find(int request_id,
+ const base::string16& search_text,
+ const blink::WebFindOptions& options) final;
+ bool StopFinding(content::StopFindAction action) final;
void GuestSizeChanged(const gfx::Size& new_size) final;
void SetGuestHost(content::GuestHost* guest_host) final;
void WillAttach(content::WebContents* embedder_web_contents,
@@ -354,6 +358,11 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate,
// asynchronous setup.
virtual void SignalWhenReady(const base::Closure& callback);
+ // Returns true if this guest should handle find requests for its
+ // embedder. This should generally be true for guests that make up the
+ // entirety of the embedder's content.
+ virtual bool ShouldHandleFindRequestsForEmbedder() const;
+
private:
class OwnerContentsObserver;