summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-31 18:08:40 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-31 18:08:40 +0000
commit4f999134a2e270792abc8b5ac6ad70aa500dcef4 (patch)
treee90d972ee2f29d10d6e22220d54cd142925bb2bb /chrome
parentb5cd43eb964e452d7a0245b9e14bd9a9d1e89b4a (diff)
downloadchromium_src-4f999134a2e270792abc8b5ac6ad70aa500dcef4.zip
chromium_src-4f999134a2e270792abc8b5ac6ad70aa500dcef4.tar.gz
chromium_src-4f999134a2e270792abc8b5ac6ad70aa500dcef4.tar.bz2
Use WebScriptSource and WebFindInPageRequest from the WebKit API.
This change introduces some helper functions in glue_util.cc for efficient conversion between WebString and WebCore::String when inside the implementation of webkit/glue. This is a temporary change since eventually all code in glue that uses WebCore will be moved into the WebKit API implementation. Instead of making the Chrome automation use WebFindInPageRequest, I decided to introduce AutomationMsg_Find_Params as a copy of the old FindInPageRequest structure. That preserves the IPC protocol and avoids making the automation library depend on WebKit. R=dglazkov Review URL: http://codereview.chromium.org/57060 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12881 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/automation/automation_provider.cc12
-rw-r--r--chrome/browser/automation/automation_provider.h3
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc12
-rw-r--r--chrome/common/ipc_message_utils.h25
-rw-r--r--chrome/common/render_messages.h45
-rw-r--r--chrome/common/render_messages_internal.h2
-rw-r--r--chrome/renderer/extensions/extension_process_bindings.cc8
-rwxr-xr-xchrome/renderer/extensions/renderer_extension_bindings.cc6
-rw-r--r--chrome/renderer/render_view.cc14
-rw-r--r--chrome/renderer/render_view.h9
-rw-r--r--chrome/renderer/render_view_unittest.cc7
-rw-r--r--chrome/renderer/user_script_slave.cc16
-rw-r--r--chrome/test/automation/automation_messages.h40
-rw-r--r--chrome/test/automation/automation_messages_internal.h13
-rw-r--r--chrome/test/automation/tab_proxy.cc15
15 files changed, 152 insertions, 75 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index b3699b8..d80401d 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -23,7 +23,6 @@
#include "chrome/browser/tab_contents/web_contents.h"
#include "chrome/browser/tab_contents/web_contents_view.h"
#include "chrome/common/chrome_paths.h"
-#include "chrome/common/ipc_message_utils.h"
#include "chrome/common/notification_registrar.h"
#include "chrome/common/pref_service.h"
#include "chrome/test/automation/automation_messages.h"
@@ -1914,9 +1913,10 @@ void AutomationProvider::HandleFindInPageRequest(
return;
}
-void AutomationProvider::HandleFindRequest(int handle,
- const FindInPageRequest& request,
- IPC::Message* reply_message) {
+void AutomationProvider::HandleFindRequest(
+ int handle,
+ const AutomationMsg_Find_Params& params,
+ IPC::Message* reply_message) {
if (!tab_tracker_->ContainsHandle(handle)) {
AutomationMsg_FindInPage::WriteReplyParams(reply_message, -1, -1);
Send(reply_message);
@@ -1937,8 +1937,8 @@ void AutomationProvider::HandleFindRequest(int handle,
FindInPageNotificationObserver::kFindInPageRequestId);
web_contents->render_view_host()->StartFinding(
FindInPageNotificationObserver::kFindInPageRequestId,
- request.search_string, request.forward, request.match_case,
- request.find_next);
+ params.search_string, params.forward, params.match_case,
+ params.find_next);
}
}
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index 38008d0..1bf0892 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -26,7 +26,6 @@
#include "chrome/common/notification_observer.h"
#include "chrome/test/automation/automation_messages.h"
#include "chrome/views/event.h"
-#include "webkit/glue/find_in_page_request.h"
#if defined(OS_WIN)
// TODO(port): enable these.
@@ -234,7 +233,7 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
// Responds to the FindInPage request, retrieves the search query parameters,
// launches an observer to listen for results and issues a StartFind request.
void HandleFindRequest(int handle,
- const FindInPageRequest& request,
+ const AutomationMsg_Find_Params& params,
IPC::Message* reply_message);
// Responds to requests to open the FindInPage window.
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index 8222ec3..0f0a889 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -34,9 +34,11 @@
#include "chrome/common/thumbnail_score.h"
#include "net/base/net_util.h"
#include "skia/include/SkBitmap.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebFindInPageRequest.h"
#include "webkit/glue/autofill_form.h"
using base::TimeDelta;
+using WebKit::WebFindInPageRequest;
using WebKit::WebInputEvent;
namespace {
@@ -351,12 +353,12 @@ void RenderViewHost::StartFinding(int request_id,
if (search_string.empty())
return;
- FindInPageRequest request;
- request.request_id = request_id;
- request.search_string = search_string;
+ WebFindInPageRequest request;
+ request.identifier = request_id;
+ request.text = search_string;
request.forward = forward;
- request.match_case = match_case;
- request.find_next = find_next;
+ request.matchCase = match_case;
+ request.findNext = find_next;
Send(new ViewMsg_Find(routing_id(), request));
// This call is asynchronous and returns immediately.
diff --git a/chrome/common/ipc_message_utils.h b/chrome/common/ipc_message_utils.h
index e016074..bfdc54d 100644
--- a/chrome/common/ipc_message_utils.h
+++ b/chrome/common/ipc_message_utils.h
@@ -20,7 +20,6 @@
#include "chrome/common/thumbnail_score.h"
#include "chrome/common/transport_dib.h"
#include "webkit/glue/console_message_level.h"
-#include "webkit/glue/find_in_page_request.h"
#include "webkit/glue/webcursor.h"
#include "webkit/glue/window_open_disposition.h"
@@ -1390,30 +1389,6 @@ class MessageWithReply : public SyncMessage {
}
};
-// Traits for ViewMsg_FindInPageMsg_Request structure to pack/unpack.
-template <>
-struct ParamTraits<FindInPageRequest> {
- typedef FindInPageRequest param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.request_id);
- WriteParam(m, p.search_string);
- WriteParam(m, p.forward);
- WriteParam(m, p.match_case);
- WriteParam(m, p.find_next);
- }
- static bool Read(const Message* m, void** iter, param_type* p) {
- return
- ReadParam(m, iter, &p->request_id) &&
- ReadParam(m, iter, &p->search_string) &&
- ReadParam(m, iter, &p->forward) &&
- ReadParam(m, iter, &p->match_case) &&
- ReadParam(m, iter, &p->find_next);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"<FindInPageRequest>");
- }
-};
-
//-----------------------------------------------------------------------------
} // namespace IPC
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 284ac51..e144a3a 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -25,6 +25,7 @@
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request_status.h"
#include "third_party/WebKit/WebKit/chromium/public/WebCache.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebFindInPageRequest.h"
#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
#include "webkit/glue/autofill_form.h"
#include "webkit/glue/context_menu.h"
@@ -370,6 +371,27 @@ struct ViewHostMsg_Audio_CreateStream {
namespace IPC {
template <>
+struct ParamTraits<WebKit::WebString> {
+ typedef WebKit::WebString param_type;
+ static void Write(Message* m, const param_type& p) {
+ m->WriteData(reinterpret_cast<const char*>(p.data()),
+ static_cast<int>(p.length()));
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ const char* data;
+ int length;
+ if (!m->ReadData(iter, &data, &length))
+ return false;
+ p->assign(reinterpret_cast<const WebKit::WebUChar*>(data),
+ static_cast<size_t>(length));
+ return true;
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(UTF16ToWideHack(p));
+ }
+};
+
+template <>
struct ParamTraits<ResourceType::Type> {
typedef ResourceType::Type param_type;
static void Write(Message* m, const param_type& p) {
@@ -1923,6 +1945,29 @@ struct ParamTraits<AudioOutputStream::State> {
}
};
+template <>
+struct ParamTraits<WebKit::WebFindInPageRequest> {
+ typedef WebKit::WebFindInPageRequest param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.identifier);
+ WriteParam(m, p.text);
+ WriteParam(m, p.forward);
+ WriteParam(m, p.matchCase);
+ WriteParam(m, p.findNext);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return
+ ReadParam(m, iter, &p->identifier) &&
+ ReadParam(m, iter, &p->text) &&
+ ReadParam(m, iter, &p->forward) &&
+ ReadParam(m, iter, &p->matchCase) &&
+ ReadParam(m, iter, &p->findNext);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"<FindInPageRequest>");
+ }
+};
+
} // namespace IPC
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index cc0ad9e..2dda292 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -160,7 +160,7 @@ IPC_BEGIN_MESSAGES(View)
// Sent when the user wants to search for a word on the page (find in page).
// Request parameters are passed in as a FindInPageMsg_Request struct.
- IPC_MESSAGE_ROUTED1(ViewMsg_Find, FindInPageRequest)
+ IPC_MESSAGE_ROUTED1(ViewMsg_Find, WebKit::WebFindInPageRequest)
// Sent when the headers are available for a resource request.
IPC_MESSAGE_ROUTED2(ViewMsg_Resource_ReceivedResponse,
diff --git a/chrome/renderer/extensions/extension_process_bindings.cc b/chrome/renderer/extensions/extension_process_bindings.cc
index 1802a66..7b9533d 100644
--- a/chrome/renderer/extensions/extension_process_bindings.cc
+++ b/chrome/renderer/extensions/extension_process_bindings.cc
@@ -8,8 +8,12 @@
#include "chrome/common/resource_bundle.h"
#include "chrome/renderer/render_view.h"
#include "grit/renderer_resources.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h"
#include "webkit/glue/webframe.h"
+using WebKit::WebScriptSource;
+using WebKit::WebString;
+
namespace extensions_v8 {
const char kExtensionProcessExtensionName[] = "v8/ExtensionProcess";
@@ -108,14 +112,14 @@ void ExtensionProcessBindings::ExecuteCallbackInFrame(
std::string code = "chromium._dispatchCallback(";
code += IntToString(callback_id);
code += ", '";
-
+
size_t offset = code.length();
code += response;
ReplaceSubstringsAfterOffset(&code, offset, "\\", "\\\\");
ReplaceSubstringsAfterOffset(&code, offset, "'", "\\'");
code += "')";
- frame->ExecuteScript(webkit_glue::WebScriptSource(code));
+ frame->ExecuteScript(WebScriptSource(WebString::fromUTF8(code)));
}
} // namespace extensions_v8
diff --git a/chrome/renderer/extensions/renderer_extension_bindings.cc b/chrome/renderer/extensions/renderer_extension_bindings.cc
index 4a095ac..9301579 100755
--- a/chrome/renderer/extensions/renderer_extension_bindings.cc
+++ b/chrome/renderer/extensions/renderer_extension_bindings.cc
@@ -6,8 +6,12 @@
#include "chrome/common/render_messages.h"
#include "chrome/renderer/render_thread.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h"
#include "webkit/glue/webframe.h"
+using WebKit::WebScriptSource;
+using WebKit::WebString;
+
namespace {
const char* kExtensionName = "v8/RendererExtensionBindings";
@@ -94,7 +98,7 @@ void RendererExtensionBindings::HandleExtensionMessage(
std::string script = StringPrintf(
"void(chromium.Extension.dispatchOnMessage(\"%s\", %d))",
message.c_str(), channel_id);
- webframe->ExecuteScript(webkit_glue::WebScriptSource(script));
+ webframe->ExecuteScript(WebScriptSource(WebString::fromUTF8(script)));
}
} // namespace extensions_v8
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index faf8d7c..8cc7c43 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -49,6 +49,7 @@
#include "printing/units.h"
#include "skia/ext/bitmap_platform_device.h"
#include "skia/ext/image_operations.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h"
#include "webkit/default_plugin/default_plugin_shared.h"
#include "webkit/glue/dom_operations.h"
#include "webkit/glue/dom_serializer.h"
@@ -84,6 +85,7 @@
using base::TimeDelta;
using webkit_glue::WebAccessibility;
+using WebKit::WebScriptSource;
//-----------------------------------------------------------------------------
@@ -2083,7 +2085,7 @@ GURL RenderView::GetAlternateErrorPageURL(const GURL& failedURL,
return url;
}
-void RenderView::OnFind(const FindInPageRequest& request) {
+void RenderView::OnFind(const WebKit::WebFindInPageRequest& request) {
WebFrame* main_frame = webview()->GetMainFrame();
WebFrame* frame_after_main = webview()->GetNextFrameAfter(main_frame, true);
WebFrame* focused_frame = webview()->GetFocusedFrame();
@@ -2143,9 +2145,9 @@ void RenderView::OnFind(const FindInPageRequest& request) {
// fix for 792423.
webview()->SetFocusedFrame(NULL);
- if (request.find_next) {
+ if (request.findNext) {
// Force the main_frame to report the actual count.
- main_frame->IncreaseMatchCount(0, request.request_id);
+ main_frame->IncreaseMatchCount(0, request.identifier);
} else {
// If nothing is found, set result to "0 of 0", otherwise, set it to
// "-1 of 1" to indicate that we found at least one item, but we don't know
@@ -2158,7 +2160,8 @@ void RenderView::OnFind(const FindInPageRequest& request) {
bool final_status_update = !result;
// Send the search result over to the browser process.
- Send(new ViewHostMsg_Find_Reply(routing_id_, request.request_id,
+ Send(new ViewHostMsg_Find_Reply(routing_id_,
+ request.identifier,
match_count,
selection_rect,
ordinal,
@@ -2434,8 +2437,7 @@ void RenderView::EvaluateScript(const std::wstring& frame_xpath,
if (!web_frame)
return;
- web_frame->ExecuteScript(
- webkit_glue::WebScriptSource(WideToUTF8(script)));
+ web_frame->ExecuteScript(WebScriptSource(WideToUTF16Hack(script)));
}
void RenderView::InsertCSS(const std::wstring& frame_xpath,
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index b2a7759..a9b4b9a 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -72,9 +72,10 @@ class WaitableEvent;
namespace webkit_glue {
struct FileUploadData;
-//class WebAccessibility;
-//struct InParams;
-//struct OutParams;
+}
+
+namespace WebKit {
+struct WebFindInPageRequest;
}
// We need to prevent a page from trying to create infinite popups. It is not
@@ -484,7 +485,7 @@ class RenderView : public RenderWidget,
void OnShowJavaScriptConsole();
void OnSetupDevToolsClient();
void OnCancelDownload(int32 download_id);
- void OnFind(const FindInPageRequest& request);
+ void OnFind(const WebKit::WebFindInPageRequest& request);
void OnZoom(int function);
void OnSetPageEncoding(const std::wstring& encoding_name);
void OnGetAllSavableResourceLinksForCurrentPage(const GURL& page_url);
diff --git a/chrome/renderer/render_view_unittest.cc b/chrome/renderer/render_view_unittest.cc
index fa26b44..88c4fa7 100644
--- a/chrome/renderer/render_view_unittest.cc
+++ b/chrome/renderer/render_view_unittest.cc
@@ -10,11 +10,14 @@
#include "chrome/renderer/renderer_webkitclient_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h"
#include "webkit/glue/webframe.h"
-#include "webkit/glue/webscriptsource.h"
#include "webkit/glue/weburlrequest.h"
#include "webkit/glue/webview.h"
+using WebKit::WebScriptSource;
+using WebKit::WebString;
+
namespace {
const int32 kRouteId = 5;
@@ -42,7 +45,7 @@ class RenderViewTest : public testing::Test {
// Executes the given JavaScript in the context of the main frame. The input
// is a NULL-terminated UTF-8 string.
void ExecuteJavaScript(const char* js) {
- GetMainFrame()->ExecuteScript(webkit_glue::WebScriptSource(js));
+ GetMainFrame()->ExecuteScript(WebScriptSource(WebString::fromUTF8(js)));
}
// Loads the given HTML into the main frame as a data: URL.
diff --git a/chrome/renderer/user_script_slave.cc b/chrome/renderer/user_script_slave.cc
index 04957ad..9b424f0 100644
--- a/chrome/renderer/user_script_slave.cc
+++ b/chrome/renderer/user_script_slave.cc
@@ -9,13 +9,17 @@
#include "base/perftimer.h"
#include "base/pickle.h"
#include "base/shared_memory.h"
+#include "base/string_util.h"
#include "chrome/common/resource_bundle.h"
#include "googleurl/src/gurl.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h"
#include "webkit/glue/webframe.h"
-#include "webkit/glue/webscriptsource.h"
#include "grit/renderer_resources.h"
+using WebKit::WebScriptSource;
+using WebKit::WebString;
+
// These two strings are injected before and after the Greasemonkey API and
// user script to wrap it in an anonymous scope.
static const char kUserScriptHead[] = "(function (unsafeWindow) {\n";
@@ -104,7 +108,7 @@ bool UserScriptSlave::InjectScripts(WebFrame* frame,
PerfTimer timer;
int num_matched = 0;
- std::vector<webkit_glue::WebScriptSource> sources;
+ std::vector<WebScriptSource> sources;
for (size_t i = 0; i < scripts_.size(); ++i) {
UserScript* script = scripts_[i];
if (!script->MatchesUrl(frame->GetURL()))
@@ -121,15 +125,15 @@ bool UserScriptSlave::InjectScripts(WebFrame* frame,
if (script->run_location() == location) {
for (size_t j = 0; j < script->js_scripts().size(); ++j) {
UserScript::File &file = script->js_scripts()[j];
- sources.push_back(webkit_glue::WebScriptSource(
- file.GetContent().as_string(), file.url()));
+ sources.push_back(WebScriptSource(
+ WebString::fromUTF8(file.GetContent()), file.url()));
}
}
}
if (!sources.empty()) {
- sources.insert(sources.begin(),
- webkit_glue::WebScriptSource(api_js_.as_string()));
+ sources.insert(
+ sources.begin(), WebScriptSource(WebString::fromUTF8(api_js_)));
frame->ExecuteScriptInNewContext(&sources.front(), sources.size());
}
diff --git a/chrome/test/automation/automation_messages.h b/chrome/test/automation/automation_messages.h
index 52a9945..5968f78 100644
--- a/chrome/test/automation/automation_messages.h
+++ b/chrome/test/automation/automation_messages.h
@@ -13,9 +13,49 @@
#include "chrome/common/ipc_message_utils.h"
#include "chrome/test/automation/automation_constants.h"
+struct AutomationMsg_Find_Params {
+ // Unused value, which exists only for backwards compat.
+ int unused;
+
+ // The word(s) to find on the page.
+ string16 search_string;
+
+ // Whether to search forward or backward within the page.
+ bool forward;
+
+ // Whether search should be Case sensitive.
+ bool match_case;
+
+ // Whether this operation is first request (Find) or a follow-up (FindNext).
+ bool find_next;
+};
+
namespace IPC {
template <>
+struct ParamTraits<AutomationMsg_Find_Params> {
+ typedef AutomationMsg_Find_Params param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.unused);
+ WriteParam(m, p.search_string);
+ WriteParam(m, p.forward);
+ WriteParam(m, p.match_case);
+ WriteParam(m, p.find_next);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return
+ ReadParam(m, iter, &p->unused) &&
+ ReadParam(m, iter, &p->search_string) &&
+ ReadParam(m, iter, &p->forward) &&
+ ReadParam(m, iter, &p->match_case) &&
+ ReadParam(m, iter, &p->find_next);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"<AutomationMsg_Find_Params>");
+ }
+};
+
+template <>
struct ParamTraits<AutomationMsg_NavigationResponseValues> {
typedef AutomationMsg_NavigationResponseValues param_type;
static void Write(Message* m, const param_type& p) {
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h
index 89e401b..59599b1 100644
--- a/chrome/test/automation/automation_messages_internal.h
+++ b/chrome/test/automation/automation_messages_internal.h
@@ -13,11 +13,11 @@
#include "base/basictypes.h"
#include "base/gfx/rect.h"
+#include "base/string16.h"
#include "chrome/common/ipc_message_macros.h"
#include "chrome/common/navigation_types.h"
#include "chrome/test/automation/autocomplete_edit_proxy.h"
#include "googleurl/src/gurl.h"
-#include "webkit/glue/find_in_page_request.h"
// NOTE: All IPC messages have either a routing_id of 0 (for asynchronous
// messages), or one that's been assigned by the proxy (for calls
@@ -299,8 +299,8 @@ IPC_BEGIN_MESSAGES(Automation)
// (1=case sensitive, 0=case insensitive). If an error occurs, matches_found
// will be -1.
//
- // NOTE: These two messages have been deprecated, please use the new messages
- // AutomationMsg_FindRequest and AutomationMsg_FindInPageResponse2 below.
+ // NOTE: This message has been deprecated, please use the new message
+ // AutomationMsg_Find below.
//
IPC_SYNC_MESSAGE_ROUTED4_2(AutomationMsg_FindInPage, // DEPRECATED.
int, /* tab_handle */
@@ -746,12 +746,11 @@ IPC_BEGIN_MESSAGES(Automation)
// This message starts a find within a tab corresponding to the supplied
// tab handle. The parameter |request| specifies what to search for.
- // If an error occurs, |matches_found| will be -1 (see response message
- // AutomationMsg_FindInPageResponse2).
+ // If an error occurs, |matches_found| will be -1.
//
IPC_SYNC_MESSAGE_ROUTED2_2(AutomationMsg_Find,
- int, /* tab_handle */
- FindInPageRequest /* request */,
+ int /* tab_handle */,
+ AutomationMsg_Find_Params /* params */,
int /* active_ordinal */,
int /* matches_found */)
diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc
index 550dc5d..bf69a78 100644
--- a/chrome/test/automation/tab_proxy.cc
+++ b/chrome/test/automation/tab_proxy.cc
@@ -51,17 +51,17 @@ int TabProxy::FindInPage(const std::wstring& search_string,
if (!is_valid())
return -1;
- FindInPageRequest request = {0};
- request.search_string = WideToUTF16(search_string);
- request.find_next = find_next;
- // The explicit comparison to TRUE avoids a warning (C4800).
- request.match_case = match_case == TRUE;
- request.forward = forward == TRUE;
+ AutomationMsg_Find_Params params;
+ params.unused = 0;
+ params.search_string = WideToUTF16Hack(search_string);
+ params.find_next = find_next;
+ params.match_case = (match_case == CASE_SENSITIVE);
+ params.forward = (forward == FWD);
int matches = 0;
int ordinal2 = 0;
bool succeeded = sender_->Send(new AutomationMsg_Find(0, handle_,
- request,
+ params,
&ordinal2,
&matches));
if (!succeeded)
@@ -622,4 +622,3 @@ void TabProxy::Reposition(HWND window, HWND window_insert_after, int left,
sender_->Send(new AutomationMsg_TabReposition(0, handle_, params));
}
#endif // defined(OS_WIN)
-