summaryrefslogtreecommitdiffstats
path: root/content/browser/browser_plugin
diff options
context:
space:
mode:
Diffstat (limited to 'content/browser/browser_plugin')
-rw-r--r--content/browser/browser_plugin/browser_plugin_embedder.cc26
-rw-r--r--content/browser/browser_plugin/browser_plugin_embedder.h13
-rw-r--r--content/browser/browser_plugin/browser_plugin_guest.cc9
-rw-r--r--content/browser/browser_plugin/browser_plugin_guest.h8
4 files changed, 54 insertions, 2 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
diff --git a/content/browser/browser_plugin/browser_plugin_embedder.h b/content/browser/browser_plugin/browser_plugin_embedder.h
index a35a764..e8b249c 100644
--- a/content/browser/browser_plugin/browser_plugin_embedder.h
+++ b/content/browser/browser_plugin/browser_plugin_embedder.h
@@ -70,6 +70,12 @@ class CONTENT_EXPORT BrowserPluginEmbedder : public WebContentsObserver {
// Used to handle special keyboard events.
bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event);
+ // Find the given |search_text| in the page. Returns true if the find request
+ // is handled by this browser plugin embedder.
+ bool Find(int request_id,
+ const base::string16& search_text,
+ const blink::WebFindOptions& options);
+
private:
explicit BrowserPluginEmbedder(WebContentsImpl* web_contents);
@@ -79,10 +85,13 @@ class CONTENT_EXPORT BrowserPluginEmbedder : public WebContentsObserver {
bool DidSendScreenRectsCallback(WebContents* guest_web_contents);
- bool SetZoomLevelCallback(double level, WebContents* guest_web_contents);
-
bool UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, WebContents* guest);
+ bool FindInGuest(int request_id,
+ const base::string16& search_text,
+ const blink::WebFindOptions& options,
+ WebContents* guest);
+
// Message handlers.
void OnAttach(int instance_id,
const BrowserPluginHostMsg_Attach_Params& params);
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index 9fed412..09326d1 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -81,6 +81,7 @@ BrowserPluginGuest::BrowserPluginGuest(bool has_render_view,
pending_lock_request_(false),
guest_visible_(false),
embedder_visible_(true),
+ is_full_page_plugin_(false),
copy_request_id_(0),
has_render_view_(has_render_view),
is_in_destruction_(false),
@@ -202,6 +203,7 @@ void BrowserPluginGuest::Initialize(
browser_plugin_instance_id_ = browser_plugin_instance_id;
focused_ = params.focused;
guest_visible_ = params.visible;
+ is_full_page_plugin_ = params.is_full_page_plugin;
guest_window_rect_ = gfx::Rect(params.origin,
params.resize_guest_params.view_size);
@@ -354,6 +356,13 @@ void BrowserPluginGuest::SetContentsOpaque(bool opaque) {
browser_plugin_instance_id(), opaque));
}
+bool BrowserPluginGuest::Find(int request_id,
+ const base::string16& search_text,
+ const blink::WebFindOptions& options) {
+ return delegate_->Find(request_id, search_text, options,
+ is_full_page_plugin_);
+}
+
WebContentsImpl* BrowserPluginGuest::GetWebContents() const {
return static_cast<WebContentsImpl*>(web_contents());
}
diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h
index a556546..4f44a70 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.h
+++ b/content/browser/browser_plugin/browser_plugin_guest.h
@@ -204,6 +204,12 @@ class CONTENT_EXPORT BrowserPluginGuest : public WebContentsObserver {
void SetContentsOpaque(bool opaque);
+ // Find the given |search_text| in the page. Returns true if the find request
+ // is handled by this browser plugin guest.
+ bool Find(int request_id,
+ const base::string16& search_text,
+ const blink::WebFindOptions& options);
+
private:
class EmbedderWebContentsObserver;
@@ -339,6 +345,8 @@ class CONTENT_EXPORT BrowserPluginGuest : public WebContentsObserver {
bool pending_lock_request_;
bool guest_visible_;
bool embedder_visible_;
+ // Whether the browser plugin is inside a plugin document.
+ bool is_full_page_plugin_;
// Each copy-request is identified by a unique number. The unique number is
// used to keep track of the right callback.