summaryrefslogtreecommitdiffstats
path: root/content/browser/browser_plugin/browser_plugin_embedder.cc
diff options
context:
space:
mode:
authorraymes <raymes@chromium.org>2014-10-13 13:38:09 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-13 20:38:27 +0000
commit0fa0be50a2ca75472c27113b43bd5b3bc42d7629 (patch)
tree2e9e290bb5227597a9df65563b5cb2ae85f325d1 /content/browser/browser_plugin/browser_plugin_embedder.cc
parent675a377e1e67de41b27d60ce4477d05efcb13675 (diff)
downloadchromium_src-0fa0be50a2ca75472c27113b43bd5b3bc42d7629.zip
chromium_src-0fa0be50a2ca75472c27113b43bd5b3bc42d7629.tar.gz
chromium_src-0fa0be50a2ca75472c27113b43bd5b3bc42d7629.tar.bz2
Implement find in page support for top level BrowserPlugins.
Right now BrowserPlugins don't handle find in page. This CL adds support for find in page in MIMEHandlerView BrowserPlugin instances. Find in page is only handled for "full page" plugins, that is when the BrowserPlugin as loaded at the top level. The reason is because supporting find in embedded BrowserPlugins would require recursively searching which is far more complicated to implement and we (jam@, fsamuel@) have decided to defer implementing for the time being. Detecting whether the BrowserPlugin is loaded at the top level requires detecting whether the main frame is a "plugin document" in blink, which needs to be sent to the browser from the renderer. It isn't sufficient to determine whether the BrowserPlugin is merely loaded in the main frame, because it may be <embed>ed inside a html document in the main frame. In that case we don't want find in page to search the document. BUG=303491 Review URL: https://codereview.chromium.org/597753003 Cr-Commit-Position: refs/heads/master@{#299358}
Diffstat (limited to 'content/browser/browser_plugin/browser_plugin_embedder.cc')
-rw-r--r--content/browser/browser_plugin/browser_plugin_embedder.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_embedder.cc b/content/browser/browser_plugin/browser_plugin_embedder.cc
index bbd690f..cb47159 100644
--- a/content/browser/browser_plugin/browser_plugin_embedder.cc
+++ b/content/browser/browser_plugin/browser_plugin_embedder.cc
@@ -22,6 +22,7 @@
#include "content/public/common/result_codes.h"
#include "content/public/common/url_constants.h"
#include "net/base/escape.h"
+#include "third_party/WebKit/public/web/WebFindOptions.h"
#include "ui/events/keycodes/keyboard_codes.h"
namespace content {
@@ -162,6 +163,18 @@ bool BrowserPluginEmbedder::HandleKeyboardEvent(
return event_consumed;
}
+bool BrowserPluginEmbedder::Find(int request_id,
+ const base::string16& search_text,
+ const blink::WebFindOptions& options) {
+ return GetBrowserPluginGuestManager()->ForEachGuest(
+ GetWebContents(),
+ base::Bind(&BrowserPluginEmbedder::FindInGuest,
+ base::Unretained(this),
+ request_id,
+ search_text,
+ options));
+}
+
bool BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback(bool* mouse_unlocked,
WebContents* guest) {
*mouse_unlocked |= static_cast<WebContentsImpl*>(guest)
@@ -173,4 +186,17 @@ bool BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback(bool* mouse_unlocked,
return false;
}
+bool BrowserPluginEmbedder::FindInGuest(int request_id,
+ const base::string16& search_text,
+ const blink::WebFindOptions& options,
+ WebContents* guest) {
+ if (static_cast<WebContentsImpl*>(guest)->GetBrowserPluginGuest()->Find(
+ request_id, search_text, options)) {
+ // There can only ever currently be one browser plugin that handles find so
+ // we can break the iteration at this point.
+ return true;
+ }
+ return false;
+}
+
} // namespace content