summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DEPS2
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc28
-rw-r--r--chrome/browser/renderer_host/render_view_host.h10
-rw-r--r--chrome/browser/ssl/ssl_manager.cc6
-rw-r--r--chrome/browser/ssl/ssl_manager.h8
-rw-r--r--chrome/browser/ssl/ssl_policy.cc7
-rw-r--r--chrome/common/render_messages_internal.h13
-rw-r--r--chrome/common/webkit_param_traits.h80
-rw-r--r--chrome/renderer/render_view.cc34
-rw-r--r--chrome/renderer/render_view.h11
-rw-r--r--webkit/build/WebKit/WebKit.vcproj2
-rw-r--r--webkit/glue/webframe.h10
-rw-r--r--webkit/glue/webframe_impl.cc64
-rw-r--r--webkit/glue/webframe_impl.h12
-rw-r--r--webkit/webkit.gyp2
15 files changed, 142 insertions, 147 deletions
diff --git a/DEPS b/DEPS
index de1cd06..48b61e3 100644
--- a/DEPS
+++ b/DEPS
@@ -19,7 +19,7 @@ deps = {
"http://googletest.googlecode.com/svn/trunk@214",
"src/third_party/WebKit":
- "/trunk/deps/third_party/WebKit@13160",
+ "/trunk/deps/third_party/WebKit@13180",
"src/third_party/icu38":
"/trunk/deps/third_party/icu38@13083",
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index 749f93c..0f80652 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -35,13 +35,12 @@
#include "chrome/common/thumbnail_score.h"
#include "net/base/net_util.h"
#include "skia/include/SkBitmap.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebFindInPageRequest.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h"
#include "webkit/glue/autofill_form.h"
using base::TimeDelta;
using WebKit::WebConsoleMessage;
-using WebKit::WebFindInPageRequest;
+using WebKit::WebFindOptions;
using WebKit::WebInputEvent;
namespace {
@@ -349,20 +348,18 @@ bool RenderViewHost::PrintPages() {
}
void RenderViewHost::StartFinding(int request_id,
- const string16& search_string,
+ const string16& search_text,
bool forward,
bool match_case,
bool find_next) {
- if (search_string.empty())
+ if (search_text.empty())
return;
- WebFindInPageRequest request;
- request.identifier = request_id;
- request.text = search_string;
- request.forward = forward;
- request.matchCase = match_case;
- request.findNext = find_next;
- Send(new ViewMsg_Find(routing_id(), request));
+ WebFindOptions options;
+ options.forward = forward;
+ options.matchCase = match_case;
+ options.findNext = find_next;
+ Send(new ViewMsg_Find(routing_id(), request_id, search_text, options));
// This call is asynchronous and returns immediately.
// The result of the search is sent as a notification message by the renderer.
@@ -437,8 +434,11 @@ void RenderViewHost::InsertCSSInWebFrame(
}
void RenderViewHost::AddMessageToConsole(
- const std::wstring& frame_xpath, const WebConsoleMessage& message) {
- Send(new ViewMsg_AddMessageToConsole(routing_id(), frame_xpath, message));
+ const string16& frame_xpath,
+ const string16& message,
+ const WebConsoleMessage::Level& level) {
+ Send(new ViewMsg_AddMessageToConsole(
+ routing_id(), frame_xpath, message, level));
}
void RenderViewHost::DebugCommand(const std::wstring& cmd) {
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index 1923aff..8813a2c 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -17,6 +17,7 @@
#ifdef CHROME_PERSONALIZATION
#include "chrome/personalization/personalization.h"
#endif
+#include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h"
#include "webkit/glue/autofill_form.h"
#include "webkit/glue/password_form_dom_manager.h"
#include "webkit/glue/window_open_disposition.h"
@@ -49,10 +50,6 @@ namespace webkit_glue {
struct WebApplicationInfo;
}
-namespace WebKit {
-struct WebConsoleMessage;
-}
-
//
// RenderViewHost
//
@@ -238,8 +235,9 @@ class RenderViewHost : public RenderWidgetHost {
const std::string& css);
// Logs a message to the console of a frame in the page.
- void AddMessageToConsole(const std::wstring& frame_xpath,
- const WebKit::WebConsoleMessage&);
+ void AddMessageToConsole(const string16& frame_xpath,
+ const string16& message,
+ const WebKit::WebConsoleMessage::Level&);
// Send command to the debugger
void DebugCommand(const std::wstring& cmd);
diff --git a/chrome/browser/ssl/ssl_manager.cc b/chrome/browser/ssl/ssl_manager.cc
index 42c6ec0..2d953eb 100644
--- a/chrome/browser/ssl/ssl_manager.cc
+++ b/chrome/browser/ssl/ssl_manager.cc
@@ -28,7 +28,6 @@
#include "net/base/cert_status_flags.h"
#include "net/base/net_errors.h"
#include "net/url_request/url_request.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h"
#include "webkit/glue/resource_type.h"
#if defined(OS_WIN)
@@ -179,14 +178,15 @@ bool SSLManager::SetMaxSecurityStyle(SecurityStyle style) {
}
// Delegate API method.
-void SSLManager::AddMessageToConsole(const WebConsoleMessage& message) {
+void SSLManager::AddMessageToConsole(const string16& message,
+ const WebConsoleMessage::Level& level) {
TabContents* tab_contents = controller_->tab_contents();
WebContents* web_contents = tab_contents->AsWebContents();
if (!web_contents)
return;
web_contents->render_view_host()->AddMessageToConsole(
- std::wstring(), message);
+ string16(), message, level);
}
// Delegate API method.
diff --git a/chrome/browser/ssl/ssl_manager.h b/chrome/browser/ssl/ssl_manager.h
index 14baf7a..d477e36 100644
--- a/chrome/browser/ssl/ssl_manager.h
+++ b/chrome/browser/ssl/ssl_manager.h
@@ -21,6 +21,7 @@
#include "net/base/net_errors.h"
#include "net/base/ssl_info.h"
#include "net/base/x509_certificate.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h"
#include "webkit/glue/resource_type.h"
class AutomationProvider;
@@ -37,10 +38,6 @@ class Task;
class URLRequest;
class WebContents;
-namespace WebKit {
-struct WebConsoleMessage;
-}
-
// The SSLManager SSLManager controls the SSL UI elements in a TabContents. It
// listens for various events that influence when these elements should or
// should not be displayed and adjusts them accordingly.
@@ -376,7 +373,8 @@ class SSLManager : public NotificationObserver {
bool SetMaxSecurityStyle(SecurityStyle style);
// Logs a message to the console of the page.
- void AddMessageToConsole(const WebKit::WebConsoleMessage&);
+ void AddMessageToConsole(const string16& message,
+ const WebKit::WebConsoleMessage::Level&);
// Records that |cert| is permitted to be used for |host| in the future.
void DenyCertForHost(net::X509Certificate* cert, const std::string& host);
diff --git a/chrome/browser/ssl/ssl_policy.cc b/chrome/browser/ssl/ssl_policy.cc
index 0b2bcfe..5edef80a 100644
--- a/chrome/browser/ssl/ssl_policy.cc
+++ b/chrome/browser/ssl/ssl_policy.cc
@@ -25,7 +25,6 @@
#include "grit/generated_resources.h"
#include "net/base/cert_status_flags.h"
#include "net/base/ssl_info.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h"
#include "webkit/glue/resource_type.h"
#if defined(OS_WIN)
@@ -165,10 +164,8 @@ static void AddMixedContentWarningToConsole(
IDS_MIXED_CONTENT_LOG_MESSAGE,
UTF8ToWide(handler->frame_origin()),
UTF8ToWide(handler->request_url().spec()));
- WebConsoleMessage message;
- message.text = WideToUTF16Hack(text);
- message.level = WebConsoleMessage::LevelWarning;
- handler->manager()->AddMessageToConsole(message);
+ handler->manager()->AddMessageToConsole(
+ WideToUTF16Hack(text), WebConsoleMessage::LevelWarning);
}
} // namespace
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 0020985..4b36a35 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -161,8 +161,10 @@ IPC_BEGIN_MESSAGES(View)
IPC_MESSAGE_CONTROL1(ViewMsg_UserScripts_NewScripts, base::SharedMemoryHandle)
// 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, WebKit::WebFindInPageRequest)
+ IPC_MESSAGE_ROUTED3(ViewMsg_Find,
+ int /* request_id */,
+ string16 /* search_text */,
+ WebKit::WebFindOptions)
// Sent when the headers are available for a resource request.
IPC_MESSAGE_ROUTED2(ViewMsg_Resource_ReceivedResponse,
@@ -230,9 +232,10 @@ IPC_BEGIN_MESSAGES(View)
std::string /* css string */)
// Log a message to the console of the target frame
- IPC_MESSAGE_ROUTED2(ViewMsg_AddMessageToConsole,
- std::wstring, /* frame_xpath */
- WebKit::WebConsoleMessage /* message */)
+ IPC_MESSAGE_ROUTED3(ViewMsg_AddMessageToConsole,
+ string16 /* frame_xpath */,
+ string16 /* message */,
+ WebKit::WebConsoleMessage::Level /* message_level */)
// Initialize the V8 debugger in the renderer.
IPC_MESSAGE_ROUTED0(ViewMsg_DebugAttach)
diff --git a/chrome/common/webkit_param_traits.h b/chrome/common/webkit_param_traits.h
index d41bccc..74f311a 100644
--- a/chrome/common/webkit_param_traits.h
+++ b/chrome/common/webkit_param_traits.h
@@ -4,6 +4,21 @@
//
// This file contains ParamTraits templates to support serialization of WebKit
// data types over IPC.
+//
+// NOTE: IT IS IMPORTANT THAT ONLY POD (plain old data) TYPES ARE SERIALIZED.
+//
+// There are several reasons for this restrictions:
+//
+// o We don't want inclusion of this file to imply linking to WebKit code.
+//
+// o Many WebKit structures are not thread-safe. WebString, for example,
+// contains a reference counted buffer, which does not use thread-safe
+// reference counting. If we allowed serializing WebString, then we may run
+// the risk of introducing subtle thread-safety bugs if people passed a
+// WebString across threads via PostTask(NewRunnableMethod(...)).
+//
+// o The WebKit API has redundant types for strings, and we should avoid using
+// those beyond code that interfaces with the WebKit API.
#ifndef CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_
#define CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_
@@ -11,7 +26,7 @@
#include "chrome/common/ipc_message_utils.h"
#include "third_party/WebKit/WebKit/chromium/public/WebCache.h"
#include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebFindInPageRequest.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h"
#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
#include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h"
@@ -80,27 +95,6 @@ struct ParamTraits<WebKit::WebScreenInfo> {
};
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() * sizeof(WebKit::WebUChar)));
- }
- static bool Read(const Message* m, void** iter, param_type* p) {
- const char* data;
- int data_len;
- if (!m->ReadData(iter, &data, &data_len))
- return false;
- p->assign(reinterpret_cast<const WebKit::WebUChar*>(data),
- static_cast<size_t>(data_len / sizeof(WebKit::WebUChar)));
- return true;
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(UTF16ToWideHack(p));
- }
-};
-
-template <>
struct ParamTraits<WebKit::WebConsoleMessage::Level> {
typedef WebKit::WebConsoleMessage::Level param_type;
static void Write(Message* m, const param_type& p) {
@@ -119,46 +113,27 @@ struct ParamTraits<WebKit::WebConsoleMessage::Level> {
};
template <>
-struct ParamTraits<WebKit::WebConsoleMessage> {
- typedef WebKit::WebConsoleMessage param_type;
+struct ParamTraits<WebKit::WebFindOptions> {
+ typedef WebKit::WebFindOptions param_type;
static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.level);
- WriteParam(m, p.text);
- }
- static bool Read(const Message* m, void** iter, param_type* r) {
- return
- ReadParam(m, iter, &r->level) &&
- ReadParam(m, iter, &r->text);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"(");
- LogParam(p.level, l);
- l->append(L", ");
- LogParam(p.text, l);
- l->append(L")");
- }
-};
-
-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>");
+ l->append(L"(");
+ LogParam(p.forward, l);
+ l->append(L", ");
+ LogParam(p.matchCase, l);
+ l->append(L", ");
+ LogParam(p.findNext, l);
+ l->append(L")");
}
};
@@ -176,7 +151,7 @@ struct ParamTraits<WebKit::WebInputEvent::Type> {
return true;
}
static void Log(const param_type& p, std::wstring* l) {
- std::wstring type;
+ const wchar_t* type;
switch (p) {
case WebKit::WebInputEvent::MouseDown:
type = L"MouseDown";
@@ -209,11 +184,10 @@ struct ParamTraits<WebKit::WebInputEvent::Type> {
type = L"None";
break;
}
- LogParam(type, l);
+ LogParam(std::wstring(type), l);
}
};
-// Traits for WebKit::WebCache::UsageStats
template <>
struct ParamTraits<WebKit::WebCache::UsageStats> {
typedef WebKit::WebCache::UsageStats param_type;
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index e94452e..0b36bd0 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -2131,7 +2131,9 @@ GURL RenderView::GetAlternateErrorPageURL(const GURL& failedURL,
return url;
}
-void RenderView::OnFind(const WebKit::WebFindInPageRequest& request) {
+void RenderView::OnFind(int request_id,
+ const string16& search_text,
+ const WebKit::WebFindOptions& options) {
WebFrame* main_frame = webview()->GetMainFrame();
WebFrame* frame_after_main = webview()->GetNextFrameAfter(main_frame, true);
WebFrame* focused_frame = webview()->GetFocusedFrame();
@@ -2147,7 +2149,8 @@ void RenderView::OnFind(const WebKit::WebFindInPageRequest& request) {
bool result = false;
do {
- result = search_frame->Find(request, wrap_within_frame, &selection_rect);
+ result = search_frame->Find(
+ request_id, search_text, options, wrap_within_frame, &selection_rect);
if (!result) {
// don't leave text selected as you move to the next frame.
@@ -2157,7 +2160,7 @@ void RenderView::OnFind(const WebKit::WebFindInPageRequest& request) {
do {
// What is the next frame to search? (we might be going backwards). Note
// that we specify wrap=true so that search_frame never becomes NULL.
- search_frame = request.forward ?
+ search_frame = options.forward ?
webview()->GetNextFrameAfter(search_frame, true) :
webview()->GetPreviousFrameBefore(search_frame, true);
} while (!search_frame->Visible() && search_frame != focused_frame);
@@ -2171,8 +2174,9 @@ void RenderView::OnFind(const WebKit::WebFindInPageRequest& request) {
// reported matches, but no frames after the focused_frame contain a
// match for the search word(s).
if (multi_frame && search_frame == focused_frame) {
- result = search_frame->Find(request, true, // Force wrapping.
- &selection_rect);
+ result = search_frame->Find(
+ request_id, search_text, options, true, // Force wrapping.
+ &selection_rect);
}
}
@@ -2191,9 +2195,9 @@ void RenderView::OnFind(const WebKit::WebFindInPageRequest& request) {
// fix for 792423.
webview()->SetFocusedFrame(NULL);
- if (request.findNext) {
+ if (options.findNext) {
// Force the main_frame to report the actual count.
- main_frame->IncreaseMatchCount(0, request.identifier);
+ main_frame->IncreaseMatchCount(0, request_id);
} 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
@@ -2207,7 +2211,7 @@ void RenderView::OnFind(const WebKit::WebFindInPageRequest& request) {
// Send the search result over to the browser process.
Send(new ViewHostMsg_Find_Reply(routing_id_,
- request.identifier,
+ request_id,
match_count,
selection_rect,
ordinal,
@@ -2227,7 +2231,9 @@ void RenderView::OnFind(const WebKit::WebFindInPageRequest& request) {
if (result) {
// Start new scoping request. If the scoping function determines that it
// needs to scope, it will defer until later.
- search_frame->ScopeStringMatches(request,
+ search_frame->ScopeStringMatches(request_id,
+ search_text,
+ options,
true); // reset the tickmarks
}
@@ -2524,11 +2530,13 @@ void RenderView::OnCSSInsertRequest(const std::wstring& frame_xpath,
InsertCSS(frame_xpath, css);
}
-void RenderView::OnAddMessageToConsole(const std::wstring& frame_xpath,
- const WebConsoleMessage& message) {
- WebFrame* web_frame = GetChildFrame(frame_xpath);
+void RenderView::OnAddMessageToConsole(
+ const string16& frame_xpath,
+ const string16& message,
+ const WebConsoleMessage::Level& level) {
+ WebFrame* web_frame = GetChildFrame(UTF16ToWideHack(frame_xpath));
if (web_frame)
- web_frame->AddMessageToConsole(message);
+ web_frame->AddMessageToConsole(WebConsoleMessage(level, message));
}
#if defined(OS_WIN)
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index 44dcbc4..7f19567 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -26,6 +26,7 @@
#include "chrome/renderer/render_widget.h"
#include "media/audio/audio_output.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h"
#include "webkit/glue/dom_serializer_delegate.h"
#include "webkit/glue/feed.h"
#include "webkit/glue/form_data.h"
@@ -75,8 +76,7 @@ struct FileUploadData;
}
namespace WebKit {
-struct WebConsoleMessage;
-struct WebFindInPageRequest;
+struct WebFindOptions;
}
// We need to prevent a page from trying to create infinite popups. It is not
@@ -494,7 +494,7 @@ class RenderView : public RenderWidget,
void OnShowJavaScriptConsole();
void OnSetupDevToolsClient();
void OnCancelDownload(int32 download_id);
- void OnFind(const WebKit::WebFindInPageRequest& request);
+ void OnFind(int request_id, const string16&, const WebKit::WebFindOptions&);
void OnZoom(int function);
void OnInsertText(const string16& text);
void OnSetPageEncoding(const std::wstring& encoding_name);
@@ -528,8 +528,9 @@ class RenderView : public RenderWidget,
const std::wstring& jscript);
void OnCSSInsertRequest(const std::wstring& frame_xpath,
const std::string& css);
- void OnAddMessageToConsole(const std::wstring& frame_xpath,
- const WebKit::WebConsoleMessage&);
+ void OnAddMessageToConsole(const string16& frame_xpath,
+ const string16& message,
+ const WebKit::WebConsoleMessage::Level&);
void OnDebugAttach();
void OnReservePageIDRange(int size_of_range);
diff --git a/webkit/build/WebKit/WebKit.vcproj b/webkit/build/WebKit/WebKit.vcproj
index b225b74..0d7f6fd 100644
--- a/webkit/build/WebKit/WebKit.vcproj
+++ b/webkit/build/WebKit/WebKit.vcproj
@@ -156,7 +156,7 @@
>
</File>
<File
- RelativePath="..\..\..\third_party\WebKit\WebKit\chromium\public\WebFindInPageRequest.h"
+ RelativePath="..\..\..\third_party\WebKit\WebKit\chromium\public\WebFindOptions.h"
>
</File>
<File
diff --git a/webkit/glue/webframe.h b/webkit/glue/webframe.h
index 93f5698d..23b12c5 100644
--- a/webkit/glue/webframe.h
+++ b/webkit/glue/webframe.h
@@ -25,7 +25,7 @@ class Size;
namespace WebKit {
struct WebConsoleMessage;
-struct WebFindInPageRequest;
+struct WebFindOptions;
struct WebScriptSource;
}
@@ -218,7 +218,9 @@ class WebFrame {
// If no match is found, this function clears all tickmarks and highlighting.
//
// Returns true if the search string was found, false otherwise.
- virtual bool Find(const WebKit::WebFindInPageRequest& request,
+ virtual bool Find(int request_id,
+ const string16& search_text,
+ const WebKit::WebFindOptions& options,
bool wrap_within_frame,
gfx::Rect* selection_rect) = 0;
@@ -241,7 +243,9 @@ class WebFrame {
// cancel at any time (see CancelPendingScopingEffort). The parameter Request
// specifies what to look for and Reset signals whether this is a brand new
// request or a continuation of the last scoping effort.
- virtual void ScopeStringMatches(const WebKit::WebFindInPageRequest& request,
+ virtual void ScopeStringMatches(int request_id,
+ const string16& search_text,
+ const WebKit::WebFindOptions& options,
bool reset) = 0;
// Cancels any outstanding requests for scoping string matches on a frame.
diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc
index 11bdf5e..b1bfff8 100644
--- a/webkit/glue/webframe_impl.cc
+++ b/webkit/glue/webframe_impl.cc
@@ -136,7 +136,7 @@ MSVC_POP_WARNING();
#include "skia/ext/bitmap_platform_device.h"
#include "skia/ext/platform_canvas.h"
#include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebFindInPageRequest.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h"
#include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h"
#include "webkit/glue/alt_error_page_resource_fetcher.h"
#include "webkit/glue/dom_operations.h"
@@ -162,6 +162,7 @@ MSVC_POP_WARNING();
#endif
using base::Time;
+
using WebCore::ChromeClientChromium;
using WebCore::Color;
using WebCore::Document;
@@ -194,8 +195,9 @@ using WebCore::SubstituteData;
using WebCore::TextIterator;
using WebCore::VisiblePosition;
using WebCore::XPathResult;
+
using WebKit::WebConsoleMessage;
-using WebKit::WebFindInPageRequest;
+using WebKit::WebFindOptions;
using WebKit::WebScriptSource;
// Key for a StatsCounter tracking how many WebFrames are active.
@@ -947,24 +949,25 @@ void WebFrameImpl::ResetMatchCount() {
frames_scoping_count_ = 0;
}
-bool WebFrameImpl::Find(const WebFindInPageRequest& request,
+bool WebFrameImpl::Find(int request_id,
+ const string16& search_text,
+ const WebFindOptions& options,
bool wrap_within_frame,
gfx::Rect* selection_rect) {
- WebCore::String webcore_string =
- webkit_glue::WebStringToString(request.text);
+ WebCore::String webcore_string = webkit_glue::String16ToString(search_text);
WebFrameImpl* const main_frame_impl =
static_cast<WebFrameImpl*>(GetView()->GetMainFrame());
- if (!request.findNext)
+ if (!options.findNext)
frame()->page()->unmarkAllTextMatches();
// Starts the search from the current selection.
bool start_in_selection = true;
DCHECK(frame() && frame()->view());
- bool found = frame()->findString(webcore_string, request.forward,
- request.matchCase, wrap_within_frame,
+ bool found = frame()->findString(webcore_string, options.forward,
+ options.matchCase, wrap_within_frame,
start_in_selection);
if (found) {
#if defined(OS_WIN)
@@ -993,7 +996,7 @@ bool WebFrameImpl::Find(const WebFindInPageRequest& request,
curr_selection_rect = active_match_->boundingBox();
}
- if (!request.findNext) {
+ if (!options.findNext) {
// This is a Find operation, so we set the flag to ask the scoping effort
// to find the active rect for us so we can update the ordinal (n of m).
locating_active_rect_ = true;
@@ -1002,14 +1005,14 @@ bool WebFrameImpl::Find(const WebFindInPageRequest& request,
// If the active frame has changed it means that we have a multi-frame
// page and we just switch to searching in a new frame. Then we just
// want to reset the index.
- if (request.forward)
+ if (options.forward)
active_match_index_ = 0;
else
active_match_index_ = last_match_count_ - 1;
} else {
// We are still the active frame, so increment (or decrement) the
// |active_match_index|, wrapping if needed (on single frame pages).
- request.forward ? ++active_match_index_ : --active_match_index_;
+ options.forward ? ++active_match_index_ : --active_match_index_;
if (active_match_index_ + 1 > last_match_count_)
active_match_index_ = 0;
if (active_match_index_ + 1 == 0)
@@ -1026,7 +1029,7 @@ bool WebFrameImpl::Find(const WebFindInPageRequest& request,
ReportFindInPageSelection(rect,
active_match_index_ + 1,
- request.identifier);
+ request_id);
}
#endif
}
@@ -1058,7 +1061,7 @@ int WebFrameImpl::OrdinalOfFirstMatchForFrame(WebFrameImpl* frame) const {
return ordinal;
}
-bool WebFrameImpl::ShouldScopeMatches(const WebFindInPageRequest& request) {
+bool WebFrameImpl::ShouldScopeMatches(const string16& search_text) {
// Don't scope if we can't find a frame or if the frame is not visible.
// The user may have closed the tab/application, so abort.
if (!frame() || !Visible())
@@ -1073,7 +1076,7 @@ bool WebFrameImpl::ShouldScopeMatches(const WebFindInPageRequest& request) {
!last_search_string_.empty() && last_match_count_ == 0) {
// Check to see if the search string prefixes match.
string16 previous_search_prefix =
- string16(request.text).substr(0, last_search_string_.length());
+ search_text.substr(0, last_search_string_.length());
if (previous_search_prefix == last_search_string_) {
return false; // Don't search this frame, it will be fruitless.
@@ -1134,9 +1137,11 @@ void WebFrameImpl::AddMarker(WebCore::Range* range) {
}
}
-void WebFrameImpl::ScopeStringMatches(const WebFindInPageRequest& request,
+void WebFrameImpl::ScopeStringMatches(int request_id,
+ const string16& search_text,
+ const WebFindOptions& options,
bool reset) {
- if (!ShouldScopeMatches(request))
+ if (!ShouldScopeMatches(search_text))
return;
WebFrameImpl* main_frame_impl =
@@ -1161,13 +1166,14 @@ void WebFrameImpl::ScopeStringMatches(const WebFindInPageRequest& request,
MessageLoop::current()->PostTask(FROM_HERE,
scope_matches_factory_.NewRunnableMethod(
&WebFrameImpl::ScopeStringMatches,
- request,
+ request_id,
+ search_text,
+ options,
false)); // false=we just reset, so don't do it again.
return;
}
- WebCore::String webcore_string =
- webkit_glue::WebStringToString(request.text);
+ WebCore::String webcore_string = webkit_glue::String16ToString(search_text);
RefPtr<Range> search_range(rangeOfContents(frame()->document()));
@@ -1202,7 +1208,7 @@ void WebFrameImpl::ScopeStringMatches(const WebFindInPageRequest& request,
RefPtr<Range> result_range(findPlainText(search_range.get(),
webcore_string,
true,
- request.matchCase));
+ options.matchCase));
if (result_range->collapsed(ec)) {
if (!result_range->startContainer()->isInShadowTree())
break;
@@ -1257,7 +1263,7 @@ void WebFrameImpl::ScopeStringMatches(const WebFindInPageRequest& request,
// To stop looking for the active tickmark, we set this flag.
locating_active_rect_ = false;
- #if defined(OS_WIN)
+#if defined(OS_WIN)
// TODO(pinkerton): Fix Mac invalidation to be more like Win ScrollView
// Notify browser of new location for the selected rectangle.
result_bounds.move(-frameview()->scrollOffset().width(),
@@ -1266,8 +1272,8 @@ void WebFrameImpl::ScopeStringMatches(const WebFindInPageRequest& request,
webkit_glue::FromIntRect(
frame()->view()->convertToContainingWindow(result_bounds)),
active_match_index_ + 1,
- request.identifier);
- #endif
+ request_id);
+#endif
}
}
@@ -1277,7 +1283,7 @@ void WebFrameImpl::ScopeStringMatches(const WebFindInPageRequest& request,
// Remember what we search for last time, so we can skip searching if more
// letters are added to the search string (and last outcome was 0).
- last_search_string_ = request.text;
+ last_search_string_ = search_text;
if (match_count > 0) {
frame()->setMarkedTextMatchesAreHighlighted(true);
@@ -1285,7 +1291,7 @@ void WebFrameImpl::ScopeStringMatches(const WebFindInPageRequest& request,
last_match_count_ += match_count;
// Let the mainframe know how much we found during this pass.
- main_frame_impl->IncreaseMatchCount(match_count, request.identifier);
+ main_frame_impl->IncreaseMatchCount(match_count, request_id);
}
if (timeout) {
@@ -1299,7 +1305,9 @@ void WebFrameImpl::ScopeStringMatches(const WebFindInPageRequest& request,
MessageLoop::current()->PostTask(FROM_HERE,
scope_matches_factory_.NewRunnableMethod(
&WebFrameImpl::ScopeStringMatches,
- request,
+ request_id,
+ search_text,
+ options,
false)); // don't reset.
return; // Done for now, resume work later.
@@ -1313,12 +1321,10 @@ void WebFrameImpl::ScopeStringMatches(const WebFindInPageRequest& request,
// If this is the last frame to finish scoping we need to trigger the final
// update to be sent.
if (main_frame_impl->frames_scoping_count_ == 0)
- main_frame_impl->IncreaseMatchCount(0, request.identifier);
+ main_frame_impl->IncreaseMatchCount(0, request_id);
// This frame is done, so show any scrollbar tickmarks we haven't drawn yet.
InvalidateArea(INVALIDATE_SCROLLBAR);
-
- return;
}
void WebFrameImpl::CancelPendingScopingEffort() {
diff --git a/webkit/glue/webframe_impl.h b/webkit/glue/webframe_impl.h
index 11d8731..81a5f7f 100644
--- a/webkit/glue/webframe_impl.h
+++ b/webkit/glue/webframe_impl.h
@@ -126,11 +126,17 @@ class WebFrameImpl : public WebFrame, public base::RefCounted<WebFrameImpl> {
virtual void GetContentAsPlainText(int max_chars, std::wstring* text) const;
virtual bool Find(
- const WebKit::WebFindInPageRequest& request, bool wrap_within_frame,
+ int request_id,
+ const string16& search_text,
+ const WebKit::WebFindOptions& options,
+ bool wrap_within_frame,
gfx::Rect* selection_rect);
virtual void StopFinding(bool clear_selection);
virtual void ScopeStringMatches(
- const WebKit::WebFindInPageRequest& request, bool reset);
+ int request_id,
+ const string16& search_text,
+ const WebKit::WebFindOptions& options,
+ bool reset);
virtual void CancelPendingScopingEffort();
virtual void ResetMatchCount();
virtual bool Visible();
@@ -387,7 +393,7 @@ class WebFrameImpl : public WebFrame, public base::RefCounted<WebFrameImpl> {
// It is not necessary if the frame is invisible, for example, or if this
// is a repeat search that already returned nothing last time the same prefix
// was searched.
- bool ShouldScopeMatches(const WebKit::WebFindInPageRequest& request);
+ bool ShouldScopeMatches(const string16& search_text);
// Only for test_shell
int PendingFrameUnloadEventCount() const;
diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp
index cc6ae99..d9682c1 100644
--- a/webkit/webkit.gyp
+++ b/webkit/webkit.gyp
@@ -4113,7 +4113,7 @@
'../third_party/WebKit/WebKit/chromium/public/WebCommon.h',
'../third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h',
'../third_party/WebKit/WebKit/chromium/public/WebCString.h',
- '../third_party/WebKit/WebKit/chromium/public/WebFindInPageRequest.h',
+ '../third_party/WebKit/WebKit/chromium/public/WebFindOptions.h',
'../third_party/WebKit/WebKit/chromium/public/WebImage.h',
'../third_party/WebKit/WebKit/chromium/public/WebInputEvent.h',
'../third_party/WebKit/WebKit/chromium/public/WebKit.h',