diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-10 05:46:45 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-10 05:46:45 +0000 |
commit | dd7daa80d25deb78ab365e28df4d93437357793b (patch) | |
tree | fb4dd2331820f5e32ddeb7e2bfb731f0604fbc0d /chrome/renderer | |
parent | 64c40aa34646a198a04029ee6b78dd9559595dc5 (diff) | |
download | chromium_src-dd7daa80d25deb78ab365e28df4d93437357793b.zip chromium_src-dd7daa80d25deb78ab365e28df4d93437357793b.tar.gz chromium_src-dd7daa80d25deb78ab365e28df4d93437357793b.tar.bz2 |
Switch to WebFrame from the WebKit API.
I tried to avoid unnecessary changes in this CL to help make it easier to
review.
As part of this CL, glue/webtextinput* are folded into WebFrame / WebFrameImpl.
R=dglazkov
BUG=10034
TEST=none
Review URL: http://codereview.chromium.org/164225
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22896 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
21 files changed, 281 insertions, 238 deletions
diff --git a/chrome/renderer/extensions/bindings_utils.cc b/chrome/renderer/extensions/bindings_utils.cc index 13738ca..3d29f4b 100644 --- a/chrome/renderer/extensions/bindings_utils.cc +++ b/chrome/renderer/extensions/bindings_utils.cc @@ -6,7 +6,9 @@ #include "base/string_util.h" #include "chrome/renderer/render_view.h" -#include "webkit/glue/webframe.h" +#include "webkit/api/public/WebFrame.h" + +using WebKit::WebFrame; namespace bindings_utils { @@ -78,12 +80,12 @@ PendingRequestMap& GetPendingRequestMap() { } RenderView* GetRenderViewForCurrentContext() { - WebFrame* webframe = WebFrame::RetrieveFrameForCurrentContext(); + WebFrame* webframe = WebFrame::frameForCurrentContext(); DCHECK(webframe) << "RetrieveCurrentFrame called when not in a V8 context."; if (!webframe) return NULL; - WebView* webview = webframe->GetView(); + WebView* webview = webframe->view(); if (!webview) return NULL; // can happen during closing diff --git a/chrome/renderer/extensions/bindings_utils.h b/chrome/renderer/extensions/bindings_utils.h index 324a73c..604cb2c 100644 --- a/chrome/renderer/extensions/bindings_utils.h +++ b/chrome/renderer/extensions/bindings_utils.h @@ -15,7 +15,6 @@ #include <string> class RenderView; -class WebFrame; namespace bindings_utils { diff --git a/chrome/renderer/extensions/event_bindings.cc b/chrome/renderer/extensions/event_bindings.cc index d771580..fcc0bcf 100644 --- a/chrome/renderer/extensions/event_bindings.cc +++ b/chrome/renderer/extensions/event_bindings.cc @@ -15,8 +15,8 @@ #include "chrome/renderer/render_view.h" #include "grit/renderer_resources.h" #include "webkit/api/public/WebDataSource.h" +#include "webkit/api/public/WebFrame.h" #include "webkit/api/public/WebURLRequest.h" -#include "webkit/glue/webframe.h" using bindings_utils::CallFunctionInContext; using bindings_utils::ContextInfo; @@ -26,6 +26,7 @@ using bindings_utils::GetStringResource; using bindings_utils::ExtensionBase; using bindings_utils::GetPendingRequestMap; using bindings_utils::PendingRequestMap; +using WebKit::WebFrame; namespace { @@ -199,17 +200,17 @@ void EventBindings::HandleContextCreated(WebFrame* frame, bool content_script) { v8::HandleScope handle_scope; ContextList& contexts = GetContexts(); - v8::Local<v8::Context> frame_context = frame->GetMainWorldScriptContext(); + v8::Local<v8::Context> frame_context = frame->mainWorldScriptContext(); v8::Local<v8::Context> context = v8::Context::GetCurrent(); DCHECK(!context.IsEmpty()); DCHECK(bindings_utils::FindContext(context) == contexts.end()); // Figure out the URL for the toplevel frame. If the top frame is loading, // use its provisional URL, since we get this notification before commit. - WebFrame* main_frame = frame->GetView()->GetMainFrame(); - WebKit::WebDataSource* ds = main_frame->GetProvisionalDataSource(); + WebFrame* main_frame = frame->view()->GetMainFrame(); + WebKit::WebDataSource* ds = main_frame->provisionalDataSource(); if (!ds) - ds = main_frame->GetDataSource(); + ds = main_frame->dataSource(); GURL url = ds->request().url(); std::string extension_id; if (url.SchemeIs(chrome::kExtensionScheme)) { @@ -238,8 +239,8 @@ void EventBindings::HandleContextCreated(WebFrame* frame, bool content_script) { } RenderView* render_view = NULL; - if (frame->GetView() && frame->GetView()->GetDelegate()) - render_view = static_cast<RenderView*>(frame->GetView()->GetDelegate()); + if (frame->view() && frame->view()->GetDelegate()) + render_view = static_cast<RenderView*>(frame->view()->GetDelegate()); contexts.push_back(linked_ptr<ContextInfo>( new ContextInfo(persistent_context, extension_id, parent_context, @@ -256,7 +257,7 @@ void EventBindings::HandleContextDestroyed(WebFrame* frame) { return; v8::HandleScope handle_scope; - v8::Local<v8::Context> context = frame->GetMainWorldScriptContext(); + v8::Local<v8::Context> context = frame->mainWorldScriptContext(); DCHECK(!context.IsEmpty()); ContextList::iterator context_iter = bindings_utils::FindContext(context); diff --git a/chrome/renderer/extensions/event_bindings.h b/chrome/renderer/extensions/event_bindings.h index c9f81da..022fe09 100644 --- a/chrome/renderer/extensions/event_bindings.h +++ b/chrome/renderer/extensions/event_bindings.h @@ -5,13 +5,16 @@ #ifndef CHROME_RENDERER_EXTENSIONS_EVENT_BINDINGS_H_ #define CHROME_RENDERER_EXTENSIONS_EVENT_BINDINGS_H_ -#include "v8/include/v8.h" - #include <string> +#include "v8/include/v8.h" + class RenderThreadBase; class RenderView; + +namespace WebKit { class WebFrame; +} // This class deals with the javascript bindings related to Event objects. class EventBindings { @@ -24,8 +27,9 @@ class EventBindings { static RenderThreadBase* GetRenderThread(); // Handle a script context coming / going away. - static void HandleContextCreated(WebFrame* frame, bool content_script); - static void HandleContextDestroyed(WebFrame* frame); + static void HandleContextCreated(WebKit::WebFrame* frame, + bool content_script); + static void HandleContextDestroyed(WebKit::WebFrame* frame); // Calls the given function in each registered context which is listening for // events. If render_view is non-NULL, only call the function in contexts diff --git a/chrome/renderer/extensions/extension_process_bindings.cc b/chrome/renderer/extensions/extension_process_bindings.cc index 09a1311..78afca5 100644 --- a/chrome/renderer/extensions/extension_process_bindings.cc +++ b/chrome/renderer/extensions/extension_process_bindings.cc @@ -15,7 +15,7 @@ #include "chrome/renderer/render_view.h" #include "grit/common_resources.h" #include "grit/renderer_resources.h" -#include "webkit/glue/webframe.h" +#include "webkit/api/public/WebFrame.h" using bindings_utils::GetStringResource; using bindings_utils::ContextInfo; @@ -82,7 +82,7 @@ class ExtensionImpl : public ExtensionBase { static std::string ExtensionIdForCurrentContext() { RenderView* renderview = bindings_utils::GetRenderViewForCurrentContext(); DCHECK(renderview); - GURL url = renderview->webview()->GetMainFrame()->GetURL(); + GURL url = renderview->webview()->GetMainFrame()->url(); if (url.SchemeIs(chrome::kExtensionScheme)) return url.host(); return std::string(); @@ -192,7 +192,7 @@ class ExtensionImpl : public ExtensionBase { if (!renderview) return v8::Undefined(); - if (args.Length() != 4 || !args[0]->IsString() || !args[1]->IsString() || + if (args.Length() != 4 || !args[0]->IsString() || !args[1]->IsString() || !args[2]->IsInt32() || !args[3]->IsBoolean()) return v8::Undefined(); diff --git a/chrome/renderer/external_extension.cc b/chrome/renderer/external_extension.cc index 100f311..777e883 100644 --- a/chrome/renderer/external_extension.cc +++ b/chrome/renderer/external_extension.cc @@ -4,7 +4,9 @@ #include "chrome/renderer/external_extension.h" #include "chrome/renderer/render_view.h" -#include "webkit/glue/webframe.h" +#include "webkit/api/public/WebFrame.h" + +using WebKit::WebFrame; namespace extensions_v8 { @@ -35,12 +37,12 @@ class ExternalExtensionWrapper : public v8::Extension { if (!args.Length()) return v8::Undefined(); - WebFrame* webframe = WebFrame::RetrieveFrameForEnteredContext(); + WebFrame* webframe = WebFrame::frameForEnteredContext(); DCHECK(webframe) << "There should be an active frame since we just got " "a native function called."; if (!webframe) return v8::Undefined(); - WebView* webview = webframe->GetView(); + WebView* webview = webframe->view(); if (!webview) return v8::Undefined(); // can happen during closing RenderView* renderview = static_cast<RenderView*>(webview->GetDelegate()); diff --git a/chrome/renderer/external_host_bindings.cc b/chrome/renderer/external_host_bindings.cc index 7aaf139..70b867c 100644 --- a/chrome/renderer/external_host_bindings.cc +++ b/chrome/renderer/external_host_bindings.cc @@ -7,7 +7,6 @@ #include "base/values.h" #include "chrome/common/render_messages.h" #include "webkit/api/public/WebBindings.h" -#include "webkit/glue/webframe.h" using WebKit::WebBindings; @@ -45,7 +44,7 @@ void ExternalHostBindings::postMessage( } std::string origin; - GURL origin_url(frame_->GetURL().GetOrigin()); + GURL origin_url(GURL(frame_->url()).GetOrigin()); if (origin_url.is_empty()) { // If the origin is not a scheme/host/port tuple, then return the literal // string "null". @@ -67,7 +66,7 @@ bool ExternalHostBindings::ForwardMessageFromExternalHost( bool status = false; if (target.compare("*") != 0) { - GURL frame_url(frame_->GetURL()); + GURL frame_url(frame_->url()); GURL frame_origin(frame_url.GetOrigin()); GURL target_origin(GURL(target).GetOrigin()); @@ -141,9 +140,9 @@ bool ExternalHostBindings::CreateMessageEvent(NPObject** message_event) { DCHECK(message_event != NULL); DCHECK(frame_ != NULL); - NPObject* window = frame_->GetWindowNPObject(); + NPObject* window = frame_->windowObject(); if (!window) { - NOTREACHED() << "frame_->GetWindowNPObject"; + NOTREACHED() << "frame_->windowObject"; return false; } diff --git a/chrome/renderer/external_host_bindings.h b/chrome/renderer/external_host_bindings.h index d995975..1e7f6d2 100644 --- a/chrome/renderer/external_host_bindings.h +++ b/chrome/renderer/external_host_bindings.h @@ -29,7 +29,8 @@ class ExternalHostBindings : public DOMBoundBrowserObject { const std::string& target); // Overridden to hold onto a pointer back to the web frame. - void BindToJavascript(WebFrame* frame, const std::wstring& classname) { + void BindToJavascript(WebKit::WebFrame* frame, + const std::wstring& classname) { frame_ = frame; DOMBoundBrowserObject::BindToJavascript(frame, classname); } @@ -42,7 +43,7 @@ class ExternalHostBindings : public DOMBoundBrowserObject { private: CppVariant on_message_handler_; - WebFrame* frame_; + WebKit::WebFrame* frame_; DISALLOW_COPY_AND_ASSIGN(ExternalHostBindings); }; diff --git a/chrome/renderer/loadtimes_extension_bindings.cc b/chrome/renderer/loadtimes_extension_bindings.cc index a8afe17..f98993b 100644 --- a/chrome/renderer/loadtimes_extension_bindings.cc +++ b/chrome/renderer/loadtimes_extension_bindings.cc @@ -8,10 +8,11 @@ #include "base/time.h" #include "chrome/renderer/navigation_state.h" +#include "webkit/api/public/WebFrame.h" #include "v8/include/v8.h" -#include "webkit/glue/webframe.h" using WebKit::WebDataSource; +using WebKit::WebFrame; using WebKit::WebNavigationType; // Values for CSI "tran" property @@ -94,9 +95,9 @@ class LoadTimesExtensionWrapper : public v8::Extension { } static v8::Handle<v8::Value> GetLoadTimes(const v8::Arguments& args) { - WebFrame* frame = WebFrame::RetrieveFrameForEnteredContext(); + WebFrame* frame = WebFrame::frameForEnteredContext(); if (frame) { - WebDataSource* data_source = frame->GetDataSource(); + WebDataSource* data_source = frame->dataSource(); if (data_source) { NavigationState* navigation_state = NavigationState::FromDataSource(data_source); @@ -135,9 +136,9 @@ class LoadTimesExtensionWrapper : public v8::Extension { } static v8::Handle<v8::Value> GetCSI(const v8::Arguments& args) { - WebFrame* frame = WebFrame::RetrieveFrameForEnteredContext(); + WebFrame* frame = WebFrame::frameForEnteredContext(); if (frame) { - WebDataSource* data_source = frame->GetDataSource(); + WebDataSource* data_source = frame->dataSource(); if (data_source) { NavigationState* navigation_state = NavigationState::FromDataSource(data_source); diff --git a/chrome/renderer/print_web_view_helper.cc b/chrome/renderer/print_web_view_helper.cc index a0803ba..3d4a336 100644 --- a/chrome/renderer/print_web_view_helper.cc +++ b/chrome/renderer/print_web_view_helper.cc @@ -10,12 +10,13 @@ #include "chrome/renderer/render_view.h" #include "grit/generated_resources.h" #include "printing/units.h" +#include "webkit/api/public/WebFrame.h" #include "webkit/api/public/WebRect.h" #include "webkit/api/public/WebScreenInfo.h" #include "webkit/api/public/WebSize.h" #include "webkit/api/public/WebURLRequest.h" -#include "webkit/glue/webframe.h" +using WebKit::WebFrame; using WebKit::WebRect; using WebKit::WebScreenInfo; using WebKit::WebString; @@ -50,11 +51,11 @@ PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint( web_view->resize(print_layout_size); - expected_pages_count_ = frame->PrintBegin(print_canvas_size_); + expected_pages_count_ = frame->printBegin(print_canvas_size_); } PrepareFrameAndViewForPrint::~PrepareFrameAndViewForPrint() { - frame_->PrintEnd(); + frame_->printEnd(); web_view_->resize(prev_view_size_); } @@ -88,7 +89,7 @@ bool PrintWebViewHelper::CopyAndPrint(const ViewMsg_PrintPages_Params& params, // Create a new WebView with the same settings as the current display one. // Except that we disable javascript (don't want any active content running // on the page). - WebPreferences prefs = web_frame->GetView()->GetPreferences(); + WebPreferences prefs = web_frame->view()->GetPreferences(); prefs.javascript_enabled = false; prefs.java_enabled = false; print_web_view_.reset(WebView::Create(this, prefs)); @@ -96,14 +97,14 @@ bool PrintWebViewHelper::CopyAndPrint(const ViewMsg_PrintPages_Params& params, print_pages_params_.reset(new ViewMsg_PrintPages_Params(params)); print_pages_params_->pages.clear(); // Print all pages of selection. - std::string html = web_frame->GetSelection(true); + std::string html = web_frame->selectionAsMarkup().utf8(); std::string url_str = "data:text/html;charset=utf-8,"; url_str.append(html); GURL url(url_str); // When loading is done this will call DidStopLoading that will do the // actual printing. - print_web_view_->GetMainFrame()->LoadRequest(WebURLRequest(url)); + print_web_view_->GetMainFrame()->loadRequest(WebURLRequest(url)); return true; } @@ -112,7 +113,7 @@ void PrintWebViewHelper::PrintPages(const ViewMsg_PrintPages_Params& params, WebFrame* frame) { PrepareFrameAndViewForPrint prep_frame_view(params.params, frame, - frame->GetView()); + frame->view()); int page_count = prep_frame_view.GetExpectedPageCount(); Send(new ViewHostMsg_DidGetPrintedPagesCount(routing_id(), diff --git a/chrome/renderer/print_web_view_helper.h b/chrome/renderer/print_web_view_helper.h index efa6ee0..0c2f0ff 100644 --- a/chrome/renderer/print_web_view_helper.h +++ b/chrome/renderer/print_web_view_helper.h @@ -34,7 +34,7 @@ struct ViewMsg_PrintPages_Params; class PrepareFrameAndViewForPrint { public: PrepareFrameAndViewForPrint(const ViewMsg_Print_Params& print_params, - WebFrame* frame, + WebKit::WebFrame* frame, WebView* web_view); ~PrepareFrameAndViewForPrint(); @@ -47,7 +47,7 @@ class PrepareFrameAndViewForPrint { } private: - WebFrame* frame_; + WebKit::WebFrame* frame_; WebView* web_view_; gfx::Size print_canvas_size_; gfx::Size prev_view_size_; @@ -65,7 +65,7 @@ class PrintWebViewHelper : public WebViewDelegate { explicit PrintWebViewHelper(RenderView* render_view); virtual ~PrintWebViewHelper(); - void Print(WebFrame* frame, bool script_initiated); + void Print(WebKit::WebFrame* frame, bool script_initiated); // Is there a background print in progress? bool IsPrinting() { @@ -77,16 +77,17 @@ class PrintWebViewHelper : public WebViewDelegate { protected: bool CopyAndPrint(const ViewMsg_PrintPages_Params& params, - WebFrame* web_frame); + WebKit::WebFrame* web_frame); // Prints the page listed in |params|. void PrintPage(const ViewMsg_PrintPage_Params& params, const gfx::Size& canvas_size, - WebFrame* frame); + WebKit::WebFrame* frame); // Prints all the pages listed in |params|. // It will implicitly revert the document to display CSS media type. - void PrintPages(const ViewMsg_PrintPages_Params& params, WebFrame* frame); + void PrintPages(const ViewMsg_PrintPages_Params& params, + WebKit::WebFrame* frame); // IPC::Message::Sender bool Send(IPC::Message* msg); diff --git a/chrome/renderer/print_web_view_helper_linux.cc b/chrome/renderer/print_web_view_helper_linux.cc index 52b997d..0fb7ffc 100644 --- a/chrome/renderer/print_web_view_helper_linux.cc +++ b/chrome/renderer/print_web_view_helper_linux.cc @@ -7,8 +7,9 @@ #include "base/logging.h" #include "chrome/common/render_messages.h" #include "skia/ext/vector_canvas.h" -#include "webkit/glue/webframe.h" +#include "webkit/api/public/WebFrame.h" +using WebKit::WebFrame; void PrintWebViewHelper::Print(WebFrame* frame, bool script_initiated) { // If still not finished with earlier print request simply ignore. @@ -39,7 +40,7 @@ void PrintWebViewHelper::Print(WebFrame* frame, bool script_initiated) { // Calculate the estimated page count. PrepareFrameAndViewForPrint prep_frame_view(default_settings, frame, - frame->GetView()); + frame->view()); int expected_pages_count = prep_frame_view.GetExpectedPageCount(); DCHECK(expected_pages_count); @@ -74,7 +75,7 @@ void PrintWebViewHelper::PrintPage(const ViewMsg_PrintPage_Params& params, // each page in printing. We might also need to create a metafile class // on Linux. skia::VectorCanvas canvas(size_x, size_y); - float webkit_shrink = frame->PrintPage(params.page_number, &canvas); + float webkit_shrink = frame->printPage(params.page_number, &canvas); if (shrink <= 0) { NOTREACHED() << "Printing page " << params.page_number << " failed."; } else { diff --git a/chrome/renderer/print_web_view_helper_mac.cc b/chrome/renderer/print_web_view_helper_mac.cc index ce07add..87a5517 100644 --- a/chrome/renderer/print_web_view_helper_mac.cc +++ b/chrome/renderer/print_web_view_helper_mac.cc @@ -6,6 +6,8 @@ #include "base/logging.h" +using WebKit::WebFrame; + void PrintWebViewHelper::Print(WebFrame* frame, bool script_initiated) { // TODO(port): print not implemented NOTIMPLEMENTED(); diff --git a/chrome/renderer/print_web_view_helper_win.cc b/chrome/renderer/print_web_view_helper_win.cc index e4e372a..fe7a8db 100644 --- a/chrome/renderer/print_web_view_helper_win.cc +++ b/chrome/renderer/print_web_view_helper_win.cc @@ -12,9 +12,10 @@ #include "grit/generated_resources.h" #include "printing/native_metafile.h" #include "webkit/api/public/WebConsoleMessage.h" -#include "webkit/glue/webframe.h" +#include "webkit/api/public/WebFrame.h" using WebKit::WebConsoleMessage; +using WebKit::WebFrame; using WebKit::WebString; #include "skia/ext/vector_canvas.h" @@ -42,7 +43,7 @@ void PrintWebViewHelper::Print(WebFrame* frame, bool script_initiated) { if (diff.InSeconds() < min_wait_seconds) { WebString message(WebString::fromUTF8( "Ignoring too frequent calls to print().")); - frame->AddMessageToConsole(WebConsoleMessage( + frame->addMessageToConsole(WebConsoleMessage( WebConsoleMessage::LevelWarning, message)); return; @@ -77,7 +78,7 @@ void PrintWebViewHelper::Print(WebFrame* frame, bool script_initiated) { { PrepareFrameAndViewForPrint prep_frame_view(default_settings, frame, - frame->GetView()); + frame->view()); expected_pages_count = prep_frame_view.GetExpectedPageCount(); DCHECK(expected_pages_count); } @@ -96,7 +97,7 @@ void PrintWebViewHelper::Print(WebFrame* frame, bool script_initiated) { // of this message has to deal with this. params.host_window_id = render_view_->host_window(); params.cookie = default_settings.document_cookie; - params.has_selection = frame->HasSelection(); + params.has_selection = frame->hasSelection(); params.expected_pages_count = expected_pages_count; msg = new ViewHostMsg_ScriptedPrint(params, @@ -195,7 +196,7 @@ void PrintWebViewHelper::PrintPage(const ViewMsg_PrintPage_Params& params, #else // 100% GDI based. skia::VectorCanvas canvas(hdc, size_x, size_y); - float webkit_shrink = frame->PrintPage(params.page_number, &canvas); + float webkit_shrink = frame->printPage(params.page_number, &canvas); if (shrink <= 0) { NOTREACHED() << "Printing page " << params.page_number << " failed."; } else { diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index e82f7fc..add2fc1 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -58,6 +58,7 @@ #include "webkit/api/public/WebDataSource.h" #include "webkit/api/public/WebDragData.h" #include "webkit/api/public/WebForm.h" +#include "webkit/api/public/WebFrame.h" #include "webkit/api/public/WebHistoryItem.h" #include "webkit/api/public/WebNode.h" #include "webkit/api/public/WebPoint.h" @@ -82,12 +83,10 @@ #include "webkit/glue/webaccessibilitymanager_impl.h" #include "webkit/glue/webdevtoolsagent_delegate.h" #include "webkit/glue/webdropdata.h" -#include "webkit/glue/webframe.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/webmediaplayer_impl.h" #include "webkit/glue/webpreferences.h" #include "webkit/glue/webplugin_delegate.h" -#include "webkit/glue/webtextinput.h" #include "webkit/glue/webview.h" #if defined(OS_WIN) @@ -108,6 +107,7 @@ using WebKit::WebData; using WebKit::WebDataSource; using WebKit::WebDragData; using WebKit::WebForm; +using WebKit::WebFrame; using WebKit::WebHistoryItem; using WebKit::WebNavigationPolicy; using WebKit::WebNavigationType; @@ -337,7 +337,7 @@ void RenderView::Init(gfx::NativeViewId parent_hwnd, void RenderView::OnMessageReceived(const IPC::Message& message) { WebFrame* main_frame = webview() ? webview()->GetMainFrame() : NULL; child_process_logging::ScopedActiveURLSetter url_setter( - main_frame ? main_frame->GetURL() : GURL()); + main_frame ? main_frame->url() : WebURL()); // If this is developer tools renderer intercept tools messages first. if (devtools_client_.get() && devtools_client_->OnMessageReceived(message)) @@ -441,7 +441,7 @@ void RenderView::SendThumbnail() { return; // get the URL for this page - GURL url(main_frame->GetURL()); + GURL url(main_frame->url()); if (url.is_empty()) return; @@ -463,7 +463,7 @@ void RenderView::OnPrintPages() { if (webview()) { // If the user has selected text in the currently focused frame we print // only that frame (this makes print selection work for multiple frames). - if (webview()->GetFocusedFrame()->HasSelection()) + if (webview()->GetFocusedFrame()->hasSelection()) Print(webview()->GetFocusedFrame(), false); else Print(webview()->GetMainFrame(), false); @@ -493,12 +493,12 @@ void RenderView::CapturePageInfo(int load_id, bool preliminary_capture) { return; // Don't index/capture pages that are in view source mode. - if (main_frame->GetInViewSourceMode()) + if (main_frame->isViewSourceModeEnabled()) return; // Don't index/capture pages that failed to load. This only checks the top // level frame so the thumbnail may contain a frame that failed to load. - WebDataSource* ds = main_frame->GetDataSource(); + WebDataSource* ds = main_frame->dataSource(); if (ds && ds->hasUnreachableURL()) return; @@ -506,7 +506,7 @@ void RenderView::CapturePageInfo(int load_id, bool preliminary_capture) { last_indexed_page_id_ = load_id; // get the URL for this page - GURL url(main_frame->GetURL()); + GURL url(main_frame->url()); if (url.is_empty()) return; @@ -539,7 +539,7 @@ void RenderView::CaptureText(WebFrame* frame, std::wstring* contents) { // TODO(brettw) we may want to consider more elaborate heuristics such as // the cachability of the page. We may also want to consider subframes (this // test will still index subframes if the subframe is SSL). - if (frame->GetURL().SchemeIsSecure()) + if (GURL(frame->url()).SchemeIsSecure()) return; #ifdef TIME_TEXT_RETRIEVAL @@ -547,7 +547,7 @@ void RenderView::CaptureText(WebFrame* frame, std::wstring* contents) { #endif // get the contents of the frame - frame->GetContentAsPlainText(kMaxIndexChars, contents); + *contents = UTF16ToWideHack(frame->contentAsText(kMaxIndexChars)); #ifdef TIME_TEXT_RETRIEVAL double end = time_util::GetHighResolutionTimeNow(); @@ -621,7 +621,7 @@ bool RenderView::CaptureThumbnail(WebView* view, } } - score->at_top = (view->GetMainFrame()->ScrollOffset().height == 0); + score->at_top = (view->GetMainFrame()->scrollOffset().height == 0); SkBitmap subset; device.accessBitmap(false).extractSubset(&subset, src_rect); @@ -664,7 +664,7 @@ void RenderView::OnNavigate(const ViewMsg_Navigate_Params& params) { bool is_reload = params.reload; WebFrame* main_frame = webview()->GetMainFrame(); - if (is_reload && main_frame->GetCurrentHistoryItem().isNull()) { + if (is_reload && main_frame->currentHistoryItem().isNull()) { // We cannot reload if we do not have any history state. This happens, for // example, when recovering from a crash. Our workaround here is a bit of // a hack since it means that reload after a crashed tab does not cause an @@ -685,11 +685,11 @@ void RenderView::OnNavigate(const ViewMsg_Navigate_Params& params) { // have history state, then we need to navigate to it, which corresponds to a // back/forward navigation event. if (is_reload) { - main_frame->Reload(); + main_frame->reload(); } else if (!params.state.empty()) { // We must know the page ID of the page we are navigating back to. DCHECK_NE(params.page_id, -1); - main_frame->LoadHistoryItem( + main_frame->loadHistoryItem( webkit_glue::HistoryItemFromString(params.state)); } else { // Navigate to the given URL. @@ -698,7 +698,7 @@ void RenderView::OnNavigate(const ViewMsg_Navigate_Params& params) { // A session history navigation should have been accompanied by state. DCHECK_EQ(params.page_id, -1); - if (main_frame->GetInViewSourceMode()) + if (main_frame->isViewSourceModeEnabled()) request.setCachePolicy(WebURLRequest::ReturnCacheDataElseLoad); if (params.referrer.is_valid()) { @@ -706,7 +706,7 @@ void RenderView::OnNavigate(const ViewMsg_Navigate_Params& params) { WebString::fromUTF8(params.referrer.spec())); } - main_frame->LoadRequest(request); + main_frame->loadRequest(request); } // In case LoadRequest failed before DidCreateDataSource was called. @@ -730,7 +730,7 @@ void RenderView::OnLoadAlternateHTMLText(const std::string& html, new_navigation ? -1 : page_id_, PageTransition::LINK, Time::Now())); pending_navigation_state_->set_security_info(security_info); - webview()->GetMainFrame()->LoadHTMLString(html, + webview()->GetMainFrame()->loadHTMLString(html, GURL(kUnreachableWebDataURL), display_url, !new_navigation); @@ -747,7 +747,8 @@ void RenderView::OnExecuteEditCommand(const std::string& name, if (!webview() || !webview()->GetFocusedFrame()) return; - webview()->GetFocusedFrame()->ExecuteEditCommandByName(name, value); + webview()->GetFocusedFrame()->executeCommand( + WebString::fromUTF8(name), WebString::fromUTF8(value)); } void RenderView::OnSetupDevToolsClient() { @@ -761,11 +762,11 @@ void RenderView::OnStopFinding(bool clear_selection) { return; if (clear_selection) - view->GetFocusedFrame()->ClearSelection(); + view->GetFocusedFrame()->clearSelection(); WebFrame* frame = view->GetMainFrame(); while (frame) { - frame->StopFinding(clear_selection); + frame->stopFinding(clear_selection); frame = view->GetNextFrameAfter(frame, false); } } @@ -793,63 +794,71 @@ void RenderView::OnUndo() { if (!webview()) return; - webview()->GetFocusedFrame()->Undo(); + webview()->GetFocusedFrame()->executeCommand(WebString::fromUTF8("Undo")); + UserMetricsRecordAction(L"Undo"); } void RenderView::OnRedo() { if (!webview()) return; - webview()->GetFocusedFrame()->Redo(); + webview()->GetFocusedFrame()->executeCommand(WebString::fromUTF8("Redo")); + UserMetricsRecordAction(L"Redo"); } void RenderView::OnCut() { if (!webview()) return; - webview()->GetFocusedFrame()->Cut(); + webview()->GetFocusedFrame()->executeCommand(WebString::fromUTF8("Cut")); + UserMetricsRecordAction(L"Cut"); } void RenderView::OnCopy() { if (!webview()) return; - webview()->GetFocusedFrame()->Copy(); + webview()->GetFocusedFrame()->executeCommand(WebString::fromUTF8("Copy")); + UserMetricsRecordAction(L"Copy"); } void RenderView::OnPaste() { if (!webview()) return; - webview()->GetFocusedFrame()->Paste(); + webview()->GetFocusedFrame()->executeCommand(WebString::fromUTF8("Paste")); + UserMetricsRecordAction(L"Paste"); } void RenderView::OnReplace(const std::wstring& text) { if (!webview()) return; - webview()->GetFocusedFrame()->Replace(text); + webview()->GetFocusedFrame()->replaceSelection(WideToUTF16Hack(text)); } void RenderView::OnToggleSpellCheck() { if (!webview()) return; - webview()->GetFocusedFrame()->ToggleSpellCheck(); + WebFrame* frame = webview()->GetFocusedFrame(); + frame->enableContinuousSpellChecking( + !frame->isContinuousSpellCheckingEnabled()); } void RenderView::OnDelete() { if (!webview()) return; - webview()->GetFocusedFrame()->Delete(); + webview()->GetFocusedFrame()->executeCommand(WebString::fromUTF8("Delete")); + UserMetricsRecordAction(L"DeleteSelection"); } void RenderView::OnSelectAll() { if (!webview()) return; - webview()->GetFocusedFrame()->SelectAll(); + webview()->GetFocusedFrame()->selectAll(); } void RenderView::OnSetInitialFocus(bool reverse) { @@ -862,7 +871,7 @@ void RenderView::OnSetInitialFocus(bool reverse) { // Tell the embedding application that the URL of the active page has changed void RenderView::UpdateURL(WebFrame* frame) { - WebDataSource* ds = frame->GetDataSource(); + WebDataSource* ds = frame->dataSource(); DCHECK(ds); const WebURLRequest& request = ds->request(); @@ -914,7 +923,7 @@ void RenderView::UpdateURL(WebFrame* frame) { params.gesture = navigation_gesture_; navigation_gesture_ = NavigationGestureUnknown; - if (!frame->GetParent()) { + if (!frame->parent()) { // Top-level navigation. // Update contents MIME type for main frame. @@ -1022,7 +1031,7 @@ void RenderView::UpdateSessionHistory(WebFrame* frame) { return; const WebHistoryItem& item = - webview()->GetMainFrame()->GetPreviousHistoryItem(); + webview()->GetMainFrame()->previousHistoryItem(); if (item.isNull()) return; @@ -1064,11 +1073,11 @@ void RenderView::DidStopLoading(WebView* webview) { // displayed when done loading. Ideally we would send notification when // finished parsing the head, but webkit doesn't support that yet. // The feed discovery code would also benefit from access to the head. - GURL favicon_url(webview->GetMainFrame()->GetFavIconURL()); + GURL favicon_url(webview->GetMainFrame()->favIconURL()); if (!favicon_url.is_empty()) Send(new ViewHostMsg_UpdateFavIconURL(routing_id_, page_id_, favicon_url)); - AddGURLSearchProvider(webview->GetMainFrame()->GetOSDDURL(), + AddGURLSearchProvider(webview->GetMainFrame()->openSearchDescriptionURL(), true); // autodetected Send(new ViewHostMsg_DidStopLoading(routing_id_)); @@ -1099,13 +1108,13 @@ void RenderView::DidCreateDataSource(WebFrame* frame, WebDataSource* ds) { void RenderView::DidPaint() { WebFrame* main_frame = webview()->GetMainFrame(); - if (main_frame->GetProvisionalDataSource()) { + if (main_frame->provisionalDataSource()) { // If we have a provisional frame we are between the start // and commit stages of loading...ignore this paint. return; } - WebDataSource* ds = main_frame->GetDataSource(); + WebDataSource* ds = main_frame->dataSource(); NavigationState* navigation_state = NavigationState::FromDataSource(ds); DCHECK(navigation_state); @@ -1123,7 +1132,7 @@ void RenderView::DidStartProvisionalLoadForFrame( WebView* webview, WebFrame* frame, NavigationGesture gesture) { - WebDataSource* ds = frame->GetProvisionalDataSource(); + WebDataSource* ds = frame->provisionalDataSource(); NavigationState* navigation_state = NavigationState::FromDataSource(ds); navigation_state->set_start_load_time(Time::Now()); @@ -1135,13 +1144,13 @@ void RenderView::DidStartProvisionalLoadForFrame( navigation_state->set_request_time(Time::FromDoubleT(event_time)); } - bool is_top_most = !frame->GetParent(); + bool is_top_most = !frame->parent(); if (is_top_most) { navigation_gesture_ = gesture; // Make sure redirect tracking state is clear for the new load. completed_client_redirect_src_ = GURL(); - } else if (frame->GetParent()->IsLoading()) { + } else if (frame->parent()->isLoading()) { // Take note of AUTO_SUBFRAME loads here, so that we can know how to // load an error page. See DidFailProvisionalLoadWithError. navigation_state->set_transition_type(PageTransition::AUTO_SUBFRAME); @@ -1157,9 +1166,11 @@ bool RenderView::DidLoadResourceFromMemoryCache(WebView* webview, WebFrame* frame) { // Let the browser know we loaded a resource from the memory cache. This // message is needed to display the correct SSL indicators. - Send(new ViewHostMsg_DidLoadResourceFromMemoryCache(routing_id_, - request.url(), frame->GetSecurityOrigin(), - frame->GetTop()->GetSecurityOrigin(), + Send(new ViewHostMsg_DidLoadResourceFromMemoryCache( + routing_id_, + request.url(), + frame->securityOrigin().utf8(), + frame->top()->securityOrigin().utf8(), response.securityInfo())); return false; @@ -1170,7 +1181,7 @@ void RenderView::DidReceiveProvisionalLoadServerRedirect(WebView* webview, if (frame == webview->GetMainFrame()) { // Received a redirect on the main frame. WebDataSource* data_source = - webview->GetMainFrame()->GetProvisionalDataSource(); + webview->GetMainFrame()->provisionalDataSource(); if (!data_source) { // Should only be invoked when we have a data source. NOTREACHED(); @@ -1195,7 +1206,7 @@ void RenderView::DidFailProvisionalLoadWithError(WebView* webview, // SSL manager can react to the provisional load failure before being // notified the load stopped. // - WebDataSource* ds = frame->GetProvisionalDataSource(); + WebDataSource* ds = frame->provisionalDataSource(); DCHECK(ds); const WebURLRequest& failed_request = ds->request(); @@ -1204,8 +1215,7 @@ void RenderView::DidFailProvisionalLoadWithError(WebView* webview, (error.reason == net::ERR_CACHE_MISS && EqualsASCII(failed_request.httpMethod(), "POST")); Send(new ViewHostMsg_DidFailProvisionalLoadWithError( - routing_id_, !frame->GetParent(), - error.reason, error.unreachableURL, + routing_id_, !frame->parent(), error.reason, error.unreachableURL, show_repost_interstitial)); // Don't display an error page if this is simply a cancelled load. Aside @@ -1214,7 +1224,7 @@ void RenderView::DidFailProvisionalLoadWithError(WebView* webview, return; // Make sure we never show errors in view source mode. - frame->SetInViewSourceMode(false); + frame->enableViewSourceMode(false); NavigationState* navigation_state = NavigationState::FromDataSource(ds); @@ -1277,7 +1287,7 @@ void RenderView::LoadNavigationErrorPage(WebFrame* frame, alt_html = html; } - frame->LoadHTMLString(alt_html, + frame->loadHTMLString(alt_html, GURL(kUnreachableWebDataURL), failed_url, replace); @@ -1286,9 +1296,9 @@ void RenderView::LoadNavigationErrorPage(WebFrame* frame, void RenderView::DidReceiveDocumentData(WebFrame* frame, const char* data, size_t data_len) { NavigationState* navigation_state = - NavigationState::FromDataSource(frame->GetDataSource()); + NavigationState::FromDataSource(frame->dataSource()); if (!navigation_state->postpone_loading_data()) { - frame->CommitDocumentData(data, data_len); + frame->commitDocumentData(data, data_len); return; } @@ -1297,7 +1307,7 @@ void RenderView::DidReceiveDocumentData(WebFrame* frame, const char* data, navigation_state->append_postponed_data(data, data_len); if (navigation_state->postponed_data().size() >= 512) { navigation_state->set_postpone_loading_data(false); - frame->CommitDocumentData(navigation_state->postponed_data().data(), + frame->commitDocumentData(navigation_state->postponed_data().data(), navigation_state->postponed_data().size()); navigation_state->clear_postponed_data(); } @@ -1306,7 +1316,7 @@ void RenderView::DidReceiveDocumentData(WebFrame* frame, const char* data, void RenderView::DidCommitLoadForFrame(WebView *webview, WebFrame* frame, bool is_new_navigation) { NavigationState* navigation_state = - NavigationState::FromDataSource(frame->GetDataSource()); + NavigationState::FromDataSource(frame->dataSource()); navigation_state->set_commit_load_time(Time::Now()); if (is_new_navigation) { @@ -1368,7 +1378,7 @@ void RenderView::DidReceiveTitle(WebView* webview, } void RenderView::DidFinishLoadForFrame(WebView* webview, WebFrame* frame) { - WebDataSource* ds = frame->GetDataSource(); + WebDataSource* ds = frame->dataSource(); NavigationState* navigation_state = NavigationState::FromDataSource(ds); DCHECK(navigation_state); navigation_state->set_finish_load_time(Time::Now()); @@ -1384,7 +1394,7 @@ void RenderView::DidFailLoadWithError(WebView* webview, void RenderView::DidFinishDocumentLoadForFrame(WebView* webview, WebFrame* frame) { - WebDataSource* ds = frame->GetDataSource(); + WebDataSource* ds = frame->dataSource(); NavigationState* navigation_state = NavigationState::FromDataSource(ds); DCHECK(navigation_state); navigation_state->set_finish_document_load_time(Time::Now()); @@ -1417,12 +1427,12 @@ void RenderView::DidChangeLocationWithinPageForFrame(WebView* webview, // initiate this navigation, then we need to take care to reset any pre- // existing navigation state to a content-initiated navigation state. // DidCreateDataSource conveniently takes care of this for us. - DidCreateDataSource(frame, frame->GetDataSource()); + DidCreateDataSource(frame, frame->dataSource()); DidCommitLoadForFrame(webview, frame, is_new_navigation); const string16& title = - webview->GetMainFrame()->GetDataSource()->pageTitle(); + webview->GetMainFrame()->dataSource()->pageTitle(); UpdateTitle(frame, UTF16ToWideHack(title)); } @@ -1434,8 +1444,8 @@ void RenderView::DidCompleteClientRedirect(WebView* webview, } void RenderView::WillCloseFrame(WebView* webview, WebFrame* frame) { - if (!frame->GetParent()) { - const GURL& url = frame->GetURL(); + if (!frame->parent()) { + const GURL& url = frame->url(); if (url.SchemeIs("http") || url.SchemeIs("https")) DumpLoadHistograms(); } @@ -1444,7 +1454,7 @@ void RenderView::WillCloseFrame(WebView* webview, WebFrame* frame) { void RenderView::WillSubmitForm(WebView* webview, WebFrame* frame, const WebForm& form) { NavigationState* navigation_state = - NavigationState::FromDataSource(frame->GetProvisionalDataSource()); + NavigationState::FromDataSource(frame->provisionalDataSource()); if (navigation_state->transition_type() == PageTransition::LINK) navigation_state->set_transition_type(PageTransition::FORM_SUBMIT); @@ -1478,12 +1488,12 @@ void RenderView::DidReceiveResponse(WebFrame* frame, uint32 identifier, // of the top-most frame. If we have a provisional data source, then we // can't have any sub-resources yet, so we know that this response must // correspond to a frame load. - if (!frame->GetProvisionalDataSource() || frame->GetParent()) + if (!frame->provisionalDataSource() || frame->parent()) return; // If we are in view source mode, then just let the user see the source of // the server's 404 error page. - if (frame->GetInViewSourceMode()) + if (frame->isViewSourceModeEnabled()) return; // Can we even load an alternate error page for this URL? @@ -1491,21 +1501,21 @@ void RenderView::DidReceiveResponse(WebFrame* frame, uint32 identifier, return; NavigationState* navigation_state = - NavigationState::FromDataSource(frame->GetProvisionalDataSource()); + NavigationState::FromDataSource(frame->provisionalDataSource()); navigation_state->set_postpone_loading_data(true); navigation_state->clear_postponed_data(); } void RenderView::DidFinishLoading(WebFrame* frame, uint32 identifier) { NavigationState* navigation_state = - NavigationState::FromDataSource(frame->GetDataSource()); + NavigationState::FromDataSource(frame->dataSource()); if (!navigation_state->postpone_loading_data()) return; // The server returned a 404 and the content was < 512 bytes (which we // suppressed). Go ahead and fetch the alternate page content. - const GURL& frame_url = frame->GetURL(); + const GURL& frame_url = frame->url(); const GURL& error_page_url = GetAlternateErrorPageURL(frame_url, HTTP_404); DCHECK(error_page_url.is_valid()); @@ -1546,9 +1556,9 @@ void RenderView::DocumentElementAvailable(WebFrame* frame) { // HACK. This is a temporary workaround to allow cross-origin XHR for Chrome // extensions. It grants full access to every origin, when we really want // to be able to restrict them more specifically. - GURL url = frame->GetURL(); + GURL url = frame->url(); if (url.SchemeIs(chrome::kExtensionScheme)) - frame->GrantUniversalAccess(); + frame->grantUniversalAccess(); if (RenderThread::current()) // Will be NULL during unit tests. RenderThread::current()->user_script_slave()->InjectScripts( @@ -1593,9 +1603,9 @@ WebNavigationPolicy RenderView::PolicyForNavigationAction( // Not interested in reloads. type != WebKit::WebNavigationTypeReload && // Must be a top level frame. - frame->GetParent() == NULL) { + frame->parent() == NULL) { // Skip if navigation is on the same page (using '#'). - GURL frame_origin = frame->GetURL().GetOrigin(); + GURL frame_origin = GURL(frame->url()).GetOrigin(); if (url.GetOrigin() != frame_origin || url.ref().empty()) { last_top_level_navigation_page_id_ = page_id_; OpenURL(webview, url, GURL(), default_policy); @@ -1606,7 +1616,7 @@ WebNavigationPolicy RenderView::PolicyForNavigationAction( // A content initiated navigation may have originated from a link-click, // script, drag-n-drop operation, etc. bool is_content_initiated = - NavigationState::FromDataSource(frame->GetProvisionalDataSource())-> + NavigationState::FromDataSource(frame->provisionalDataSource())-> is_content_initiated(); // We only care about navigations that are within the current tab (as opposed @@ -1614,13 +1624,13 @@ WebNavigationPolicy RenderView::PolicyForNavigationAction( // But we sometimes navigate to about:blank to clear a tab, and we want to // still allow that. if (default_policy == WebKit::WebNavigationPolicyCurrentTab && - is_content_initiated && frame->GetParent() == NULL && + is_content_initiated && frame->parent() == NULL && !url.SchemeIs(chrome::kAboutScheme)) { // When we received such unsolicited navigations, we sometimes want to // punt them up to the browser to handle. if (BindingsPolicy::is_dom_ui_enabled(enabled_bindings_) || BindingsPolicy::is_extension_enabled(enabled_bindings_) || - frame->GetInViewSourceMode() || + frame->isViewSourceModeEnabled() || url.SchemeIs(chrome::kViewSourceScheme) || url.SchemeIs(chrome::kPrintScheme)) { OpenURL(webview, url, GURL(), default_policy); @@ -1641,15 +1651,15 @@ WebNavigationPolicy RenderView::PolicyForNavigationAction( // JavaScript. bool is_fork = // Must start from a tab showing about:blank, which is later redirected. - frame->GetURL() == GURL("about:blank") && + GURL(frame->url()) == GURL("about:blank") && // Must be the first real navigation of the tab. GetHistoryBackListCount() < 1 && GetHistoryForwardListCount() < 1 && // The parent page must have set the child's window.opener to null before // redirecting to the desired URL. - frame->GetOpener() == NULL && + frame->opener() == NULL && // Must be a top-level frame. - frame->GetParent() == NULL && + frame->parent() == NULL && // Must not have issued the request from this page. is_content_initiated && // Must be targeted at the current tab. @@ -1670,7 +1680,7 @@ void RenderView::RunJavaScriptAlert(WebFrame* webframe, RunJavaScriptMessage(MessageBoxFlags::kIsJavascriptAlert, message, std::wstring(), - webframe->GetURL(), + webframe->url(), NULL); } @@ -1679,7 +1689,7 @@ bool RenderView::RunJavaScriptConfirm(WebFrame* webframe, return RunJavaScriptMessage(MessageBoxFlags::kIsJavascriptConfirm, message, std::wstring(), - webframe->GetURL(), + webframe->url(), NULL); } @@ -1690,7 +1700,7 @@ bool RenderView::RunJavaScriptPrompt(WebFrame* webframe, return RunJavaScriptMessage(MessageBoxFlags::kIsJavascriptPrompt, message, default_value, - webframe->GetURL(), + webframe->url(), result); } @@ -1725,7 +1735,7 @@ bool RenderView::RunBeforeUnloadConfirm(WebFrame* webframe, // response as RunJavaScriptMessage. std::wstring ignored_result; IPC::SyncMessage* msg = new ViewHostMsg_RunBeforeUnloadConfirm( - routing_id_, webframe->GetURL(), message, &success, &ignored_result); + routing_id_, webframe->url(), message, &success, &ignored_result); msg->set_pump_messages_event(modal_dialog_event_.get()); Send(msg); @@ -1903,7 +1913,7 @@ WebPluginDelegate* RenderView::CreatePluginDelegate( GURL policy_url; if (webview->GetMainFrame()) - policy_url = webview->GetMainFrame()->GetURL(); + policy_url = webview->GetMainFrame()->url(); FilePath path; render_thread_->Send( @@ -2022,7 +2032,7 @@ void RenderView::DidContentsSizeChange(WebWidget* webwidget, // WebCore likes to tell us things have changed even when they haven't, so // cache the width and only send the IPC message when we're sure the // width is different. - int width = webview()->GetMainFrame()->GetContentsPreferredWidth(); + int width = webview()->GetMainFrame()->contentsPreferredWidth(); if (width != preferred_width_) { Send(new ViewHostMsg_DidContentsPreferredWidthChange(routing_id_, width)); preferred_width_ = width; @@ -2072,8 +2082,7 @@ void RenderView::SyncNavigationState() { if (!webview()) return; - const WebHistoryItem& item = - webview()->GetMainFrame()->GetCurrentHistoryItem(); + const WebHistoryItem& item = webview()->GetMainFrame()->currentHistoryItem(); if (item.isNull()) return; @@ -2108,7 +2117,7 @@ void RenderView::ShowContextMenu(WebView* webview, params.selection_text = selection_text; params.misspelled_word = misspelled_word; params.spellcheck_enabled = - webview->GetFocusedFrame()->SpellCheckEnabled(); + webview->GetFocusedFrame()->isContinuousSpellCheckingEnabled(); params.edit_flags = edit_flags; params.security_info = security_info; params.frame_charset = frame_charset; @@ -2255,12 +2264,12 @@ void RenderView::OnFind(int request_id, bool result = false; do { - result = search_frame->Find( + 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. - search_frame->ClearSelection(); + search_frame->clearSelection(); // Find the next frame, but skip the invisible ones. do { @@ -2269,10 +2278,11 @@ void RenderView::OnFind(int request_id, search_frame = options.forward ? webview()->GetNextFrameAfter(search_frame, true) : webview()->GetPreviousFrameBefore(search_frame, true); - } while (!search_frame->Visible() && search_frame != focused_frame); + } while (!search_frame->hasVisibleContent() && + search_frame != focused_frame); // Make sure selection doesn't affect the search operation in new frame. - search_frame->ClearSelection(); + search_frame->clearSelection(); // If we have multiple frames and we have wrapped back around to the // focused frame, we need to search it once more allowing wrap within @@ -2280,7 +2290,7 @@ void RenderView::OnFind(int request_id, // 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( + result = search_frame->find( request_id, search_text, options, true, // Force wrapping. &selection_rect); } @@ -2291,7 +2301,7 @@ void RenderView::OnFind(int request_id, if (options.findNext) { // Force the main_frame to report the actual count. - main_frame->IncreaseMatchCount(0, request_id); + 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 @@ -2314,18 +2324,18 @@ void RenderView::OnFind(int request_id, // Scoping effort begins, starting with the mainframe. search_frame = main_frame; - main_frame->ResetMatchCount(); + main_frame->resetMatchCount(); do { // Cancel all old scoping requests before starting a new one. - search_frame->CancelPendingScopingEffort(); + search_frame->cancelPendingScopingEffort(); // We don't start another scoping effort unless at least one match has // been found. 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_id, + search_frame->scopeStringMatches(request_id, search_text, options, true); // reset the tickmarks @@ -2462,9 +2472,7 @@ void RenderView::OnInsertText(const string16& text) { WebFrame* frame = webview()->GetFocusedFrame(); if (!frame) return; - WebTextInput* text_input = frame->GetTextInput(); - if (text_input) - text_input->InsertText(text); + frame->insertText(text); } void RenderView::OnSetPageEncoding(const std::wstring& encoding_name) { @@ -2510,7 +2518,7 @@ void RenderView::DidChangeSelection(bool is_empty_selection) { // the selection hasn't actually changed. We don't want to report these // because it will cause us to continually claim the X clipboard. const std::string& this_selection = - webview()->GetFocusedFrame()->GetSelection(false); + webview()->GetFocusedFrame()->selectionAsText().utf8(); if (this_selection == last_selection_) return; @@ -2539,15 +2547,32 @@ void RenderView::PasteFromSelectionClipboard() { Send(new ViewHostMsg_PasteFromSelectionClipboard(routing_id_)); } -WebFrame* RenderView::GetChildFrame(const std::wstring& frame_xpath) const { - WebFrame* web_frame; - if (frame_xpath.empty()) { - web_frame = webview()->GetMainFrame(); - } else { - web_frame = webview()->GetMainFrame()->GetChildFrame(frame_xpath); +WebFrame* RenderView::GetChildFrame(const std::wstring& xpath) const { + if (xpath.empty()) + return webview()->GetMainFrame(); + + // xpath string can represent a frame deep down the tree (across multiple + // frame DOMs). + // Example, /html/body/table/tbody/tr/td/iframe\n/frameset/frame[0] + // should break into 2 xpaths + // /html/body/table/tbody/tr/td/iframe & /frameset/frame[0] + + WebFrame* frame = webview()->GetMainFrame(); + + std::wstring xpath_remaining = xpath; + while (!xpath_remaining.empty()) { + std::wstring::size_type delim_pos = xpath_remaining.find_first_of(L'\n'); + std::wstring xpath_child; + if (delim_pos != std::wstring::npos) { + xpath_child = xpath_remaining.substr(0, delim_pos); + xpath_remaining.erase(0, delim_pos + 1); + } else { + xpath_remaining.swap(xpath_child); + } + frame = frame->findChildByExpression(WideToUTF16Hack(xpath_child)); } - return web_frame; + return frame; } void RenderView::EvaluateScript(const std::wstring& frame_xpath, @@ -2556,7 +2581,7 @@ void RenderView::EvaluateScript(const std::wstring& frame_xpath, if (!web_frame) return; - web_frame->ExecuteScript(WebScriptSource(WideToUTF16Hack(script))); + web_frame->executeScript(WebScriptSource(WideToUTF16Hack(script))); } void RenderView::InsertCSS(const std::wstring& frame_xpath, @@ -2565,7 +2590,7 @@ void RenderView::InsertCSS(const std::wstring& frame_xpath, if (!web_frame) return; - web_frame->InsertCSSStyles(css); + web_frame->insertStyleText(WebString::fromUTF8(css)); } void RenderView::OnScriptEvalRequest(const std::wstring& frame_xpath, @@ -2587,7 +2612,7 @@ void RenderView::OnAddMessageToConsole( const WebConsoleMessage::Level& level) { WebFrame* web_frame = GetChildFrame(UTF16ToWideHack(frame_xpath)); if (web_frame) - web_frame->AddMessageToConsole(WebConsoleMessage(level, message)); + web_frame->addMessageToConsole(WebConsoleMessage(level, message)); } void RenderView::OnAllowBindings(int enabled_bindings_flags) { @@ -2728,7 +2753,7 @@ void RenderView::OnEnableViewSourceMode() { if (!main_frame) return; - main_frame->SetInViewSourceMode(true); + main_frame->enableViewSourceMode(true); } void RenderView::OnEnableIntrinsicWidthChangedMode() { @@ -2851,11 +2876,12 @@ void RenderView::OnClosePage(const ViewMsg_ClosePage_Params& params) { // http://b/issue?id=753080. WebFrame* main_frame = webview()->GetMainFrame(); if (main_frame) { - const GURL& url = main_frame->GetURL(); + const GURL& url = main_frame->url(); // TODO(davemoore) this code should be removed once WillCloseFrame() gets // called when a page is destroyed. DumpLoadHistograms() is safe to call // multiple times for the same frame, but it will simplify things. - if (url.SchemeIs(chrome::kHttpScheme) || url.SchemeIs(chrome::kHttpsScheme)) + if (url.SchemeIs(chrome::kHttpScheme) || + url.SchemeIs(chrome::kHttpsScheme)) DumpLoadHistograms(); } webview()->ClosePage(); @@ -2881,7 +2907,7 @@ void RenderView::DidAddHistoryItem() { WebFrame* main_frame = webview()->GetMainFrame(); DCHECK(main_frame != NULL); - WebDataSource* ds = main_frame->GetDataSource(); + WebDataSource* ds = main_frame->dataSource(); DCHECK(ds != NULL); NavigationState* navigation_state = NavigationState::FromDataSource(ds); @@ -2918,7 +2944,7 @@ bool RenderView::MaybeLoadAlternateErrorPage(WebFrame* frame, // value in showing them for failed subframes. Ideally, we would be // able to use the TYPED transition type for this, but that flag is // not preserved across page reloads. - if (frame->GetParent()) + if (frame->parent()) return false; // Use the alternate error page service if this is a DNS failure or @@ -2938,7 +2964,7 @@ bool RenderView::MaybeLoadAlternateErrorPage(WebFrame* frame, // Load an empty page first so there is an immediate response to the error, // and then kick off a request for the alternate error page. - frame->LoadHTMLString(std::string(), + frame->loadHTMLString(std::string(), GURL(kUnreachableWebDataURL), error.unreachableURL, replace); @@ -2947,7 +2973,7 @@ bool RenderView::MaybeLoadAlternateErrorPage(WebFrame* frame, // source we just created via the LoadHTMLString call. That way if another // navigation occurs, the fetcher will get destroyed. NavigationState* navigation_state = - NavigationState::FromDataSource(frame->GetProvisionalDataSource()); + NavigationState::FromDataSource(frame->provisionalDataSource()); navigation_state->set_alt_error_page_fetcher( new AltErrorPageResourceFetcher( error_page_url, frame, error, @@ -2982,7 +3008,7 @@ void RenderView::AltErrorPageFinished(WebFrame* frame, const std::string* html_to_load = &html; if (html.empty()) { NavigationState* navigation_state = - NavigationState::FromDataSource(frame->GetDataSource()); + NavigationState::FromDataSource(frame->dataSource()); html_to_load = &navigation_state->postponed_data(); } LoadNavigationErrorPage( @@ -3074,7 +3100,7 @@ void RenderView::OnExtensionMessageInvoke(const std::string& function_name, void RenderView::DumpLoadHistograms() const { WebFrame* main_frame = webview()->GetMainFrame(); NavigationState* navigation_state = - NavigationState::FromDataSource(main_frame->GetDataSource()); + NavigationState::FromDataSource(main_frame->dataSource()); Time finish = navigation_state->finish_load_time(); // If we've already dumped or we haven't finished loading, do nothing. @@ -3250,8 +3276,8 @@ void RenderView::WillDestroyPluginWindow(gfx::PluginWindowHandle window) { } void RenderView::SendPasswordForms(WebFrame* frame) { - std::vector<WebForm> forms; - frame->GetForms(&forms); + WebVector<WebForm> forms; + frame->forms(forms); std::vector<PasswordForm> password_forms; for (size_t i = 0; i < forms.size(); ++i) { diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index cc2eb98..3fe509b 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -51,7 +51,6 @@ class GURL; class ListValue; class NavigationState; class PrintWebViewHelper; -class WebFrame; class WebPluginDelegate; class WebPluginDelegateProxy; class WebDevToolsAgentDelegate; @@ -141,15 +140,15 @@ class RenderView : public RenderWidget, virtual void ShowModalHTMLDialog(const GURL& url, int width, int height, const std::string& json_arguments, std::string* json_retval); - virtual void RunJavaScriptAlert(WebFrame* webframe, + virtual void RunJavaScriptAlert(WebKit::WebFrame* webframe, const std::wstring& message); - virtual bool RunJavaScriptConfirm(WebFrame* webframe, + virtual bool RunJavaScriptConfirm(WebKit::WebFrame* webframe, const std::wstring& message); - virtual bool RunJavaScriptPrompt(WebFrame* webframe, + virtual bool RunJavaScriptPrompt(WebKit::WebFrame* webframe, const std::wstring& message, const std::wstring& default_value, std::wstring* result); - virtual bool RunBeforeUnloadConfirm(WebFrame* webframe, + virtual bool RunBeforeUnloadConfirm(WebKit::WebFrame* webframe, const std::wstring& message); virtual void QueryFormFieldAutofill(const std::wstring& field_name, const std::wstring& text, @@ -169,73 +168,74 @@ class RenderView : public RenderWidget, virtual void DidStartLoading(WebView* webview); virtual void DidStopLoading(WebView* webview); - virtual void DidCreateDataSource(WebFrame* frame, WebKit::WebDataSource* ds); + virtual void DidCreateDataSource(WebKit::WebFrame* frame, + WebKit::WebDataSource* ds); virtual void DidStartProvisionalLoadForFrame( WebView* webview, - WebFrame* frame, + WebKit::WebFrame* frame, NavigationGesture gesture); virtual void DidReceiveProvisionalLoadServerRedirect(WebView* webview, - WebFrame* frame); + WebKit::WebFrame* frame); virtual void DidFailProvisionalLoadWithError( WebView* webview, const WebKit::WebURLError& error, - WebFrame* frame); + WebKit::WebFrame* frame); virtual void LoadNavigationErrorPage( - WebFrame* frame, + WebKit::WebFrame* frame, const WebKit::WebURLRequest& failed_request, const WebKit::WebURLError& error, const std::string& html, bool replace); - virtual void DidReceiveDocumentData(WebFrame* frame, const char* data, + virtual void DidReceiveDocumentData(WebKit::WebFrame* frame, const char* data, size_t data_len); - virtual void DidCommitLoadForFrame(WebView* webview, WebFrame* frame, + virtual void DidCommitLoadForFrame(WebView* webview, WebKit::WebFrame* frame, bool is_new_navigation); virtual void DidReceiveTitle(WebView* webview, const std::wstring& title, - WebFrame* frame); + WebKit::WebFrame* frame); virtual void DidFinishLoadForFrame(WebView* webview, - WebFrame* frame); + WebKit::WebFrame* frame); virtual void DidFailLoadWithError(WebView* webview, const WebKit::WebURLError& error, - WebFrame* forFrame); - virtual void DidFinishDocumentLoadForFrame(WebView* webview, WebFrame* frame); + WebKit::WebFrame* forFrame); + virtual void DidFinishDocumentLoadForFrame(WebView* webview, WebKit::WebFrame* frame); virtual bool DidLoadResourceFromMemoryCache( WebView* webview, const WebKit::WebURLRequest& request, const WebKit::WebURLResponse& response, - WebFrame* frame); - virtual void DidHandleOnloadEventsForFrame(WebView* webview, WebFrame* frame); + WebKit::WebFrame* frame); + virtual void DidHandleOnloadEventsForFrame(WebView* webview, WebKit::WebFrame* frame); virtual void DidChangeLocationWithinPageForFrame(WebView* webview, - WebFrame* frame, + WebKit::WebFrame* frame, bool is_new_navigation); virtual void DidContentsSizeChange(WebKit::WebWidget* webwidget, int new_width, int new_height); virtual void DidCompleteClientRedirect(WebView* webview, - WebFrame* frame, + WebKit::WebFrame* frame, const GURL& source); - virtual void WillCloseFrame(WebView* webview, WebFrame* frame); - virtual void WillSubmitForm(WebView* webview, WebFrame* frame, + virtual void WillCloseFrame(WebView* webview, WebKit::WebFrame* frame); + virtual void WillSubmitForm(WebView* webview, WebKit::WebFrame* frame, const WebKit::WebForm& form); - virtual void WillSendRequest(WebFrame* webframe, + virtual void WillSendRequest(WebKit::WebFrame* webframe, uint32 identifier, WebKit::WebURLRequest* request, const WebKit::WebURLResponse& redirect_response); - virtual void DidReceiveResponse(WebFrame* webframe, + virtual void DidReceiveResponse(WebKit::WebFrame* webframe, uint32 identifier, const WebKit::WebURLResponse& response); - virtual void DidFinishLoading(WebFrame* webframe, uint32 identifier); + virtual void DidFinishLoading(WebKit::WebFrame* webframe, uint32 identifier); - virtual void WindowObjectCleared(WebFrame* webframe); - virtual void DocumentElementAvailable(WebFrame* webframe); - virtual void DidCreateScriptContextForFrame(WebFrame* webframe); - virtual void DidDestroyScriptContextForFrame(WebFrame* webframe); - virtual void DidCreateIsolatedScriptContext(WebFrame* webframe); + virtual void WindowObjectCleared(WebKit::WebFrame* webframe); + virtual void DocumentElementAvailable(WebKit::WebFrame* webframe); + virtual void DidCreateScriptContextForFrame(WebKit::WebFrame* webframe); + virtual void DidDestroyScriptContextForFrame(WebKit::WebFrame* webframe); + virtual void DidCreateIsolatedScriptContext(WebKit::WebFrame* webframe); virtual WebKit::WebNavigationPolicy PolicyForNavigationAction( WebView* webview, - WebFrame* frame, + WebKit::WebFrame* frame, const WebKit::WebURLRequest& request, WebKit::WebNavigationType type, WebKit::WebNavigationPolicy default_policy, @@ -320,7 +320,7 @@ class RenderView : public RenderWidget, int* misspell_length); virtual std::wstring GetAutoCorrectWord(const std::wstring& word); virtual void SetInputMethodState(bool enabled); - virtual void ScriptedPrint(WebFrame* frame); + virtual void ScriptedPrint(WebKit::WebFrame* frame); virtual void UserMetricsRecordAction(const std::wstring& action); virtual void DnsPrefetch(const std::vector<std::string>& host_names); @@ -413,9 +413,9 @@ class RenderView : public RenderWidget, SharedRenderViewCounter* counter, int32 routing_id); - void UpdateURL(WebFrame* frame); - void UpdateTitle(WebFrame* frame, const std::wstring& title); - void UpdateSessionHistory(WebFrame* frame); + void UpdateURL(WebKit::WebFrame* frame); + void UpdateTitle(WebKit::WebFrame* frame, const std::wstring& title); + void UpdateSessionHistory(WebKit::WebFrame* frame); // Update current main frame's encoding and send it to browser window. // Since we want to let users see the right encoding info from menu @@ -430,7 +430,7 @@ class RenderView : public RenderWidget, // c) function:DidFinishDocumentLoadForFrame. When this function is // called, that means we have got whole html page. In here we should // finally get right encoding of page. - void UpdateEncoding(WebFrame* frame, const std::wstring& encoding_name); + void UpdateEncoding(WebKit::WebFrame* frame, const std::wstring& encoding_name); // Captures the thumbnail and text contents for indexing for the given load // ID. If the view's load ID is different than the parameter, this call is @@ -440,7 +440,7 @@ class RenderView : public RenderWidget, // Called to retrieve the text from the given frame contents, the page text // up to the maximum amount will be placed into the given buffer - void CaptureText(WebFrame* frame, std::wstring* contents); + void CaptureText(WebKit::WebFrame* frame, std::wstring* contents); // Creates a thumbnail of |frame|'s contents resized to (|w|, |h|) // and puts that in |thumbnail|. Thumbnail metadata goes in |score|. @@ -606,14 +606,14 @@ class RenderView : public RenderWidget, // Exposes the DOMAutomationController object that allows JS to send // information to the browser process. - void BindDOMAutomationController(WebFrame* webframe); + void BindDOMAutomationController(WebKit::WebFrame* webframe); // Creates DevToolsClient and sets up JavaScript bindings for developer tools // UI that is going to be hosted by this RenderView. void CreateDevToolsClient(); // Locates a sub frame with given xpath - WebFrame* GetChildFrame(const std::wstring& frame_xpath) const; + WebKit::WebFrame* GetChildFrame(const std::wstring& frame_xpath) const; enum ErrorPageType { DNS_ERROR, @@ -625,11 +625,11 @@ class RenderView : public RenderWidget, GURL GetAlternateErrorPageURL( const GURL& failed_url, ErrorPageType error_type); bool MaybeLoadAlternateErrorPage( - WebFrame* frame, const WebKit::WebURLError& error, bool replace); + WebKit::WebFrame* frame, const WebKit::WebURLError& error, bool replace); std::string GetAltHTMLForTemplate( const DictionaryValue& error_strings, int template_resource_id) const; void AltErrorPageFinished( - WebFrame* frame, const WebKit::WebURLError& original_error, + WebKit::WebFrame* frame, const WebKit::WebURLError& original_error, const std::string& html); virtual void DidAddHistoryItem(); @@ -640,9 +640,9 @@ class RenderView : public RenderWidget, void DumpLoadHistograms() const; // Scan the given frame for password forms and send them up to the browser. - void SendPasswordForms(WebFrame* frame); + void SendPasswordForms(WebKit::WebFrame* frame); - void Print(WebFrame* frame, bool script_initiated); + void Print(WebKit::WebFrame* frame, bool script_initiated); #if defined(OS_LINUX) void UpdateFontRenderingFromRendererPrefs(); diff --git a/chrome/renderer/render_view_unittest.cc b/chrome/renderer/render_view_unittest.cc index 135c78d..24bfe2d 100644 --- a/chrome/renderer/render_view_unittest.cc +++ b/chrome/renderer/render_view_unittest.cc @@ -14,6 +14,7 @@ #include "webkit/api/public/WebURLError.h" using WebKit::WebCompositionCommand; +using WebKit::WebFrame; using WebKit::WebTextDirection; using WebKit::WebURLError; @@ -247,8 +248,8 @@ TEST_F(RenderViewTest, ImeComposition) { // Retrieve the content of this page and compare it with the expected // result. const int kMaxOutputCharacters = 128; - std::wstring output; - GetMainFrame()->GetContentAsPlainText(kMaxOutputCharacters, &output); + std::wstring output = UTF16ToWideHack( + GetMainFrame()->contentAsText(kMaxOutputCharacters)); EXPECT_EQ(output, ime_message->result); } } @@ -296,8 +297,8 @@ TEST_F(RenderViewTest, OnSetTextDirection) { // Copy the document content to std::wstring and compare with the // expected result. const int kMaxOutputCharacters = 16; - std::wstring output; - GetMainFrame()->GetContentAsPlainText(kMaxOutputCharacters, &output); + std::wstring output = UTF16ToWideHack( + GetMainFrame()->contentAsText(kMaxOutputCharacters)); EXPECT_EQ(output, kTextDirection[i].expected_result); } } @@ -612,9 +613,8 @@ TEST_F(RenderViewTest, OnHandleKeyboardEvent) { // text created from a virtual-key code, a character code, and the // modifier-key status. const int kMaxOutputCharacters = 1024; - std::wstring output; - GetMainFrame()->GetContentAsPlainText(kMaxOutputCharacters, &output); - + std::wstring output = UTF16ToWideHack( + GetMainFrame()->contentAsText(kMaxOutputCharacters)); EXPECT_EQ(expected_result, output); } } @@ -825,8 +825,8 @@ TEST_F(RenderViewTest, InsertCharacters) { // text created from a virtual-key code, a character code, and the // modifier-key status. const int kMaxOutputCharacters = 4096; - std::wstring output; - GetMainFrame()->GetContentAsPlainText(kMaxOutputCharacters, &output); + std::wstring output = UTF16ToWideHack( + GetMainFrame()->contentAsText(kMaxOutputCharacters)); EXPECT_EQ(kLayouts[i].expected_result, output); } #else @@ -852,15 +852,15 @@ TEST_F(RenderViewTest, DidFailProvisionalLoadWithErrorForError) { #endif TEST_F(RenderViewTest, DidFailProvisionalLoadWithErrorForCancellation) { - GetMainFrame()->SetInViewSourceMode(true); + GetMainFrame()->enableViewSourceMode(true); WebURLError error; error.domain.fromUTF8("test_domain"); error.reason = net::ERR_ABORTED; error.unreachableURL = GURL("http://foo"); WebFrame* web_frame = GetMainFrame(); - WebView* web_view = web_frame->GetView(); + WebView* web_view = web_frame->view(); // A cancellation occurred. view_->DidFailProvisionalLoadWithError(web_view, error, web_frame); // Frame should stay in view-source mode. - EXPECT_TRUE(web_frame->GetInViewSourceMode()); + EXPECT_TRUE(web_frame->isViewSourceModeEnabled()); } diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc index 5f31444..12ec6fa 100644 --- a/chrome/renderer/renderer_glue.cc +++ b/chrome/renderer/renderer_glue.cc @@ -30,10 +30,8 @@ #include "webkit/api/public/WebKitClient.h" #include "webkit/api/public/WebString.h" #include "webkit/glue/scoped_clipboard_writer_glue.h" -#include "webkit/glue/webframe.h" #include "webkit/glue/webkit_glue.h" - #if defined(OS_WIN) #include <strsafe.h> // note: per msdn docs, this must *follow* other includes #endif diff --git a/chrome/renderer/user_script_slave.cc b/chrome/renderer/user_script_slave.cc index f6a8f13..4b2eb2f 100644 --- a/chrome/renderer/user_script_slave.cc +++ b/chrome/renderer/user_script_slave.cc @@ -13,11 +13,12 @@ #include "base/string_util.h" #include "chrome/renderer/extension_groups.h" #include "googleurl/src/gurl.h" +#include "webkit/api/public/WebFrame.h" #include "webkit/api/public/WebScriptSource.h" -#include "webkit/glue/webframe.h" #include "grit/renderer_resources.h" +using WebKit::WebFrame; using WebKit::WebScriptSource; using WebKit::WebString; @@ -111,7 +112,7 @@ bool UserScriptSlave::UpdateScripts(base::SharedMemoryHandle shared_memory) { bool UserScriptSlave::InjectScripts(WebFrame* frame, UserScript::RunLocation location) { // Don't bother if this is not a URL we inject script into. - if (!URLPattern::IsValidScheme(frame->GetURL().scheme())) + if (!URLPattern::IsValidScheme(GURL(frame->url()).scheme())) return true; PerfTimer timer; @@ -120,7 +121,7 @@ bool UserScriptSlave::InjectScripts(WebFrame* frame, for (size_t i = 0; i < scripts_.size(); ++i) { std::vector<WebScriptSource> sources; UserScript* script = scripts_[i]; - if (!script->MatchesUrl(frame->GetURL())) + if (!script->MatchesUrl(frame->url())) continue; // This frame doesn't match the script url pattern, skip it. ++num_matched; @@ -128,7 +129,8 @@ bool UserScriptSlave::InjectScripts(WebFrame* frame, if (location == UserScript::DOCUMENT_START) { for (size_t j = 0; j < script->css_scripts().size(); ++j) { UserScript::File& file = script->css_scripts()[j]; - frame->InsertCSSStyles(file.GetContent().as_string()); + frame->insertStyleText( + WebString::fromUTF8(file.GetContent().as_string())); } } if (script->run_location() == location) { @@ -161,7 +163,7 @@ bool UserScriptSlave::InjectScripts(WebFrame* frame, StringPrintf(kInitExtension, script->extension_id().c_str())))); } - frame->ExecuteScriptInNewWorld(&sources.front(), sources.size(), + frame->executeScriptInNewWorld(&sources.front(), sources.size(), EXTENSION_GROUP_CONTENT_SCRIPTS); } } @@ -176,6 +178,6 @@ bool UserScriptSlave::InjectScripts(WebFrame* frame, } LOG(INFO) << "Injected " << num_matched << " user scripts into " << - frame->GetURL().spec(); + frame->url().spec().data(); return true; } diff --git a/chrome/renderer/user_script_slave.h b/chrome/renderer/user_script_slave.h index dcc1c7d..8f1fc9b 100644 --- a/chrome/renderer/user_script_slave.h +++ b/chrome/renderer/user_script_slave.h @@ -14,7 +14,9 @@ #include "base/string_piece.h" #include "chrome/common/extensions/user_script.h" +namespace WebKit { class WebFrame; +} // Manages installed UserScripts for a render process. class UserScriptSlave { @@ -27,7 +29,7 @@ class UserScriptSlave { // Inject the appropriate scripts into a frame based on its URL. // TODO(aa): Extract a UserScriptFrame interface out of this to improve // testability. - bool InjectScripts(WebFrame* frame, UserScript::RunLocation location); + bool InjectScripts(WebKit::WebFrame* frame, UserScript::RunLocation location); private: // Shared memory containing raw script data. diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index 283c405..e36126d 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -35,9 +35,9 @@ #include "webkit/api/public/WebBindings.h" #include "webkit/api/public/WebCursorInfo.h" #include "webkit/api/public/WebDragData.h" +#include "webkit/api/public/WebFrame.h" #include "webkit/api/public/WebString.h" #include "webkit/api/public/WebVector.h" -#include "webkit/glue/webframe.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/webplugin.h" #include "webkit/glue/webview.h" @@ -180,7 +180,7 @@ WebPluginDelegateProxy::WebPluginDelegateProxy(const std::string& mime_type, sad_plugin_(NULL), invalidate_pending_(false), transparent_(false), - page_url_(render_view_->webview()->GetMainFrame()->GetURL()) { + page_url_(render_view_->webview()->GetMainFrame()->url()) { } WebPluginDelegateProxy::~WebPluginDelegateProxy() { |