diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-30 16:55:27 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-30 16:55:27 +0000 |
commit | 26aa04898e37692f354a9f97df01ff1fc7bbb14e (patch) | |
tree | d83f599bdc5083646ea70aec4c6906707e671b71 | |
parent | fbc805556ed3f7e15718313907481821ef6908b4 (diff) | |
download | chromium_src-26aa04898e37692f354a9f97df01ff1fc7bbb14e.zip chromium_src-26aa04898e37692f354a9f97df01ff1fc7bbb14e.tar.gz chromium_src-26aa04898e37692f354a9f97df01ff1fc7bbb14e.tar.bz2 |
Hook up webkit/api/public/WebView.h
This change does not completely eliminate webkit/glue/webview.h. Instead,
the old WebView extends from the new WebView temporarily as we complete
the transition.
R=dglazkov
BUG=10033
TEST=none
Review URL: http://codereview.chromium.org/257001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27620 0039d316-1c4b-4281-b951-d872f2087c98
35 files changed, 391 insertions, 511 deletions
diff --git a/chrome/renderer/extensions/extension_process_bindings.cc b/chrome/renderer/extensions/extension_process_bindings.cc index 1a461a8..6603582 100644 --- a/chrome/renderer/extensions/extension_process_bindings.cc +++ b/chrome/renderer/extensions/extension_process_bindings.cc @@ -115,7 +115,7 @@ class ExtensionImpl : public ExtensionBase { static std::string ExtensionIdForCurrentContext() { RenderView* renderview = bindings_utils::GetRenderViewForCurrentContext(); DCHECK(renderview); - GURL url = renderview->webview()->GetMainFrame()->url(); + GURL url = renderview->webview()->mainFrame()->url(); if (url.SchemeIs(chrome::kExtensionScheme)) return url.host(); return std::string(); @@ -209,7 +209,7 @@ class ExtensionImpl : public ExtensionBase { if (!ViewTypeMatches((*it)->view_type(), view_type)) continue; - GURL url = (*it)->webview()->GetMainFrame()->url(); + GURL url = (*it)->webview()->mainFrame()->url(); if (!url.SchemeIs(chrome::kExtensionScheme)) continue; std::string extension_id = url.host(); @@ -222,7 +222,7 @@ class ExtensionImpl : public ExtensionBase { } v8::Local<v8::Context> context = - (*it)->webview()->GetMainFrame()->mainWorldScriptContext(); + (*it)->webview()->mainFrame()->mainWorldScriptContext(); if (!context.IsEmpty()) { v8::Local<v8::Value> window = context->Global(); DCHECK(!window.IsEmpty()); @@ -516,7 +516,7 @@ void ExtensionProcessBindings::SetViewType(WebView* view, return; v8::HandleScope handle_scope; - WebFrame* frame = view->GetMainFrame(); + WebFrame* frame = view->mainFrame(); v8::Local<v8::Context> context = frame->mainWorldScriptContext(); v8::Handle<v8::Value> argv[1]; argv[0] = v8::String::New(type_str); diff --git a/chrome/renderer/print_web_view_helper.cc b/chrome/renderer/print_web_view_helper.cc index 7a14eb4..c516c0e 100644 --- a/chrome/renderer/print_web_view_helper.cc +++ b/chrome/renderer/print_web_view_helper.cc @@ -75,7 +75,7 @@ void PrintWebViewHelper::DidFinishPrinting(bool success) { // TODO: Create an async alert (http://crbug.com/14918). render_view_->runModalAlertDialog( - web_view->GetMainFrame(), + web_view->mainFrame(), WideToUTF16Hack( l10n_util::GetString(IDS_PRINT_SPOOL_FAILED_ERROR_TEXT))); } @@ -110,7 +110,7 @@ bool PrintWebViewHelper::CopyAndPrint(const ViewMsg_PrintPages_Params& params, // When loading is done this will call DidStopLoading that will do the // actual printing. - print_web_view_->GetMainFrame()->loadRequest(WebURLRequest(url)); + print_web_view_->mainFrame()->loadRequest(WebURLRequest(url)); return true; } @@ -160,7 +160,7 @@ int32 PrintWebViewHelper::routing_id() { void PrintWebViewHelper::didStopLoading() { DCHECK(print_pages_params_.get() != NULL); - PrintPages(*print_pages_params_.get(), print_web_view_->GetMainFrame()); + PrintPages(*print_pages_params_.get(), print_web_view_->mainFrame()); } WebString PrintWebViewHelper::autoCorrectWord(const WebString& word) { diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 8bcc309..2861d9c 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -347,7 +347,7 @@ void RenderView::Init(gfx::NativeViewId parent_hwnd, } void RenderView::OnMessageReceived(const IPC::Message& message) { - WebFrame* main_frame = webview() ? webview()->GetMainFrame() : NULL; + WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; child_process_logging::ScopedActiveURLSetter url_setter( main_frame ? main_frame->url() : WebURL()); @@ -463,7 +463,7 @@ void RenderView::OnMessageReceived(const IPC::Message& message) { } void RenderView::SendThumbnail() { - WebFrame* main_frame = webview()->GetMainFrame(); + WebFrame* main_frame = webview()->mainFrame(); if (!main_frame) return; @@ -490,10 +490,10 @@ 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()) - Print(webview()->GetFocusedFrame(), false); + if (webview()->focusedFrame()->hasSelection()) + Print(webview()->focusedFrame(), false); else - Print(webview()->GetMainFrame(), false); + Print(webview()->mainFrame(), false); } } @@ -515,7 +515,7 @@ void RenderView::CapturePageInfo(int load_id, bool preliminary_capture) { if (!webview()) return; - WebFrame* main_frame = webview()->GetMainFrame(); + WebFrame* main_frame = webview()->mainFrame(); if (!main_frame) return; @@ -648,7 +648,7 @@ bool RenderView::CaptureThumbnail(WebView* view, } } - score->at_top = (view->GetMainFrame()->scrollOffset().height == 0); + score->at_top = (view->mainFrame()->scrollOffset().height == 0); SkBitmap subset; device.accessBitmap(false).extractSubset(&subset, src_rect); @@ -690,7 +690,7 @@ void RenderView::OnNavigate(const ViewMsg_Navigate_Params& params) { bool is_reload = params.reload; - WebFrame* main_frame = webview()->GetMainFrame(); + WebFrame* main_frame = webview()->mainFrame(); 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 @@ -757,24 +757,22 @@ 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, - GURL(kUnreachableWebDataURL), - display_url, - !new_navigation); + webview()->mainFrame()->loadHTMLString( + html, GURL(kUnreachableWebDataURL), display_url, !new_navigation); pending_navigation_state_.reset(); } void RenderView::OnCopyImageAt(int x, int y) { - webview()->CopyImageAt(x, y); + webview()->copyImageAt(WebPoint(x, y)); } void RenderView::OnExecuteEditCommand(const std::string& name, const std::string& value) { - if (!webview() || !webview()->GetFocusedFrame()) + if (!webview() || !webview()->focusedFrame()) return; - webview()->GetFocusedFrame()->executeCommand( + webview()->focusedFrame()->executeCommand( WebString::fromUTF8(name), WebString::fromUTF8(value)); } @@ -789,9 +787,9 @@ void RenderView::OnStopFinding(bool clear_selection) { return; if (clear_selection) - view->GetFocusedFrame()->executeCommand(WebString::fromUTF8("Unselect")); + view->focusedFrame()->executeCommand(WebString::fromUTF8("Unselect")); - WebFrame* frame = view->GetMainFrame(); + WebFrame* frame = view->mainFrame(); while (frame) { frame->stopFinding(clear_selection); frame = view->GetNextFrameAfter(frame, false); @@ -821,7 +819,7 @@ void RenderView::OnUndo() { if (!webview()) return; - webview()->GetFocusedFrame()->executeCommand(WebString::fromUTF8("Undo")); + webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Undo")); UserMetricsRecordAction(L"Undo"); } @@ -829,7 +827,7 @@ void RenderView::OnRedo() { if (!webview()) return; - webview()->GetFocusedFrame()->executeCommand(WebString::fromUTF8("Redo")); + webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Redo")); UserMetricsRecordAction(L"Redo"); } @@ -837,7 +835,7 @@ void RenderView::OnCut() { if (!webview()) return; - webview()->GetFocusedFrame()->executeCommand(WebString::fromUTF8("Cut")); + webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Cut")); UserMetricsRecordAction(L"Cut"); } @@ -845,7 +843,7 @@ void RenderView::OnCopy() { if (!webview()) return; - webview()->GetFocusedFrame()->executeCommand(WebString::fromUTF8("Copy")); + webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Copy")); UserMetricsRecordAction(L"Copy"); } @@ -856,7 +854,7 @@ void RenderView::OnCopyToFindPboard() { // Since the find pasteboard supports only plain text, this can be simpler // than the |OnCopy()| case. - WebFrame* frame = webview()->GetFocusedFrame(); + WebFrame* frame = webview()->focusedFrame(); if (frame->hasSelection()) { string16 selection = frame->selectionAsText(); RenderThread::current()->Send( @@ -871,7 +869,7 @@ void RenderView::OnPaste() { if (!webview()) return; - webview()->GetFocusedFrame()->executeCommand(WebString::fromUTF8("Paste")); + webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Paste")); UserMetricsRecordAction(L"Paste"); } @@ -879,13 +877,13 @@ void RenderView::OnReplace(const std::wstring& text) { if (!webview()) return; - webview()->GetFocusedFrame()->replaceSelection(WideToUTF16Hack(text)); + webview()->focusedFrame()->replaceSelection(WideToUTF16Hack(text)); } void RenderView::OnAdvanceToNextMisspelling() { if (!webview()) return; - webview()->GetFocusedFrame()->executeCommand( + webview()->focusedFrame()->executeCommand( WebString::fromUTF8("AdvanceToNextMisspelling")); } @@ -895,7 +893,7 @@ void RenderView::OnToggleSpellPanel(bool is_currently_visible) { // We need to tell the webView whether the spelling panel is visible or not so // that it won't need to make ipc calls later. webview()->SetSpellingPanelVisibility(is_currently_visible); - webview()->GetFocusedFrame()->executeCommand( + webview()->focusedFrame()->executeCommand( WebString::fromUTF8("ToggleSpellPanel")); } @@ -903,7 +901,7 @@ void RenderView::OnToggleSpellCheck() { if (!webview()) return; - WebFrame* frame = webview()->GetFocusedFrame(); + WebFrame* frame = webview()->focusedFrame(); frame->enableContinuousSpellChecking( !frame->isContinuousSpellCheckingEnabled()); } @@ -912,7 +910,7 @@ void RenderView::OnDelete() { if (!webview()) return; - webview()->GetFocusedFrame()->executeCommand(WebString::fromUTF8("Delete")); + webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Delete")); UserMetricsRecordAction(L"DeleteSelection"); } @@ -920,7 +918,7 @@ void RenderView::OnSelectAll() { if (!webview()) return; - webview()->GetFocusedFrame()->executeCommand( + webview()->focusedFrame()->executeCommand( WebString::fromUTF8("SelectAll")); UserMetricsRecordAction(L"SelectAll"); } @@ -928,7 +926,7 @@ void RenderView::OnSelectAll() { void RenderView::OnSetInitialFocus(bool reverse) { if (!webview()) return; - webview()->SetInitialFocus(reverse); + webview()->setInitialFocus(reverse); } /////////////////////////////////////////////////////////////////////////////// @@ -1080,7 +1078,7 @@ void RenderView::UpdateTitle(WebFrame* frame, const string16& title) { void RenderView::UpdateEncoding(WebFrame* frame, const std::string& encoding_name) { // Only update main frame's encoding_name. - if (webview()->GetMainFrame() == frame && + if (webview()->mainFrame() == frame && last_encoding_name_ != encoding_name) { // Save the encoding name for later comparing. last_encoding_name_ = encoding_name; @@ -1100,7 +1098,7 @@ void RenderView::UpdateSessionHistory(WebFrame* frame) { return; const WebHistoryItem& item = - webview()->GetMainFrame()->previousHistoryItem(); + webview()->mainFrame()->previousHistoryItem(); if (item.isNull()) return; @@ -1117,7 +1115,7 @@ void RenderView::OpenURL( // WebViewDelegate ------------------------------------------------------------ void RenderView::DidPaint() { - WebFrame* main_frame = webview()->GetMainFrame(); + WebFrame* main_frame = webview()->mainFrame(); if (main_frame->provisionalDataSource()) { // If we have a provisional frame we are between the start @@ -1396,11 +1394,11 @@ void RenderView::didStopLoading() { // 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()->favIconURL()); + GURL favicon_url(webview()->mainFrame()->favIconURL()); if (!favicon_url.is_empty()) Send(new ViewHostMsg_UpdateFavIconURL(routing_id_, page_id_, favicon_url)); - AddGURLSearchProvider(webview()->GetMainFrame()->openSearchDescriptionURL(), + AddGURLSearchProvider(webview()->mainFrame()->openSearchDescriptionURL(), true); // autodetected Send(new ViewHostMsg_DidStopLoading(routing_id_)); @@ -1485,7 +1483,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()->selectionAsText().utf8(); + webview()->focusedFrame()->selectionAsText().utf8(); if (this_selection == last_selection_) return; @@ -1511,7 +1509,7 @@ bool RenderView::handleCurrentKeyboardEvent() { if (edit_commands_.empty()) return false; - WebFrame* frame = webview()->GetFocusedFrame(); + WebFrame* frame = webview()->focusedFrame(); if (!frame) return false; @@ -1664,7 +1662,7 @@ int RenderView::historyForwardListCount() { void RenderView::didAddHistoryItem() { // We don't want to update the history length for the start page // navigation. - WebFrame* main_frame = webview()->GetMainFrame(); + WebFrame* main_frame = webview()->mainFrame(); DCHECK(main_frame != NULL); WebDataSource* ds = main_frame->dataSource(); @@ -2099,7 +2097,7 @@ void RenderView::didCommitProvisionalLoad( completed_client_redirect_src_ = GURL(); // Check whether we have new encoding name. - UpdateEncoding(frame, frame->view()->GetMainFrameEncodingName()); + UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); } void RenderView::didClearWindowObject(WebFrame* frame) { @@ -2139,7 +2137,7 @@ void RenderView::didCreateDocumentElement(WebFrame* frame) { // Notify the browser about non-blank documents loading in the top frame. GURL url = frame->url(); if (url.is_valid() && url.spec() != chrome::kAboutBlankURL) { - if (frame == webview()->GetMainFrame()) + if (frame == webview()->mainFrame()) Send(new ViewHostMsg_DocumentAvailableInMainFrame(routing_id_)); } } @@ -2148,7 +2146,7 @@ void RenderView::didReceiveTitle(WebFrame* frame, const WebString& title) { UpdateTitle(frame, title); // Also check whether we have new encoding name. - UpdateEncoding(frame, frame->view()->GetMainFrameEncodingName()); + UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); } void RenderView::didFinishDocumentLoad(WebFrame* frame) { @@ -2164,7 +2162,7 @@ void RenderView::didFinishDocumentLoad(WebFrame* frame) { SendPasswordForms(frame); // Check whether we have new encoding name. - UpdateEncoding(frame, frame->view()->GetMainFrameEncodingName()); + UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); if (RenderThread::current()) { // Will be NULL during unit tests. RenderThread::current()->user_script_slave()->InjectScripts( @@ -2200,7 +2198,7 @@ void RenderView::didChangeLocationWithinPage( didCommitProvisionalLoad(frame, is_new_navigation); - UpdateTitle(frame, frame->view()->GetMainFrame()->dataSource()->pageTitle()); + UpdateTitle(frame, frame->view()->mainFrame()->dataSource()->pageTitle()); } void RenderView::didUpdateCurrentHistoryItem(WebFrame* frame) { @@ -2315,7 +2313,7 @@ void RenderView::didChangeContentsSize(WebFrame* frame, const WebSize& size) { // 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()->contentsPreferredWidth(); + int width = webview()->mainFrame()->contentsPreferredWidth(); if (width != preferred_width_) { Send(new ViewHostMsg_DidContentsPreferredWidthChange(routing_id_, width)); preferred_width_ = width; @@ -2333,7 +2331,7 @@ webkit_glue::WebPluginDelegate* RenderView::CreatePluginDelegate( return NULL; GURL policy_url; - WebFrame* main_frame = webview()->GetMainFrame(); + WebFrame* main_frame = webview()->mainFrame(); if (main_frame) policy_url = main_frame->url(); @@ -2411,7 +2409,7 @@ void RenderView::SyncNavigationState() { if (!webview()) return; - const WebHistoryItem& item = webview()->GetMainFrame()->currentHistoryItem(); + const WebHistoryItem& item = webview()->mainFrame()->currentHistoryItem(); if (item.isNull()) return; @@ -2446,7 +2444,7 @@ void RenderView::ShowContextMenu(WebView* webview, params.selection_text = selection_text; params.misspelled_word = misspelled_word; params.spellcheck_enabled = - webview->GetFocusedFrame()->isContinuousSpellCheckingEnabled(); + webview->focusedFrame()->isContinuousSpellCheckingEnabled(); params.edit_flags = edit_flags; params.security_info = security_info; params.frame_charset = frame_charset; @@ -2459,7 +2457,7 @@ bool RenderView::DownloadImage(int id, const GURL& image_url, int image_size) { return false; // Create an image resource fetcher and assign it with a call back object. image_fetchers_.insert(new ImageResourceFetcher( - image_url, webview()->GetMainFrame(), id, image_size, + image_url, webview()->mainFrame(), id, image_size, NewCallback(this, &RenderView::DidDownloadImage))); return true; } @@ -2588,9 +2586,9 @@ GURL RenderView::GetAlternateErrorPageURL(const GURL& failed_url, void RenderView::OnFind(int request_id, const string16& search_text, const WebKit::WebFindOptions& options) { - WebFrame* main_frame = webview()->GetMainFrame(); + WebFrame* main_frame = webview()->mainFrame(); WebFrame* frame_after_main = webview()->GetNextFrameAfter(main_frame, true); - WebFrame* focused_frame = webview()->GetFocusedFrame(); + WebFrame* focused_frame = webview()->focusedFrame(); WebFrame* search_frame = focused_frame; // start searching focused frame. bool multi_frame = (frame_after_main != main_frame); @@ -2635,7 +2633,7 @@ void RenderView::OnFind(int request_id, } } - webview()->SetFocusedFrame(search_frame); + webview()->setFocusedFrame(search_frame); } while (!result && search_frame != focused_frame); if (options.findNext) { @@ -2691,7 +2689,7 @@ void RenderView::OnDeterminePageText() { if (!is_loading_) { if (!webview()) return; - WebFrame* main_frame = webview()->GetMainFrame(); + WebFrame* main_frame = webview()->mainFrame(); std::wstring contents; CaptureText(main_frame, &contents); Send(new ViewMsg_DeterminePageText_Reply(routing_id_, contents)); @@ -2754,13 +2752,13 @@ void RenderView::OnZoom(int function) { static const bool kZoomIsTextOnly = false; switch (function) { case PageZoom::SMALLER: - webview()->ZoomOut(kZoomIsTextOnly); + webview()->zoomOut(kZoomIsTextOnly); break; case PageZoom::STANDARD: - webview()->ResetZoom(); + webview()->zoomDefault(); break; case PageZoom::LARGER: - webview()->ZoomIn(kZoomIsTextOnly); + webview()->zoomIn(kZoomIsTextOnly); break; default: NOTREACHED(); @@ -2768,12 +2766,12 @@ void RenderView::OnZoom(int function) { } void RenderView::OnSetPageEncoding(const std::string& encoding_name) { - webview()->SetPageEncoding(encoding_name); + webview()->setPageEncoding(WebString::fromUTF8(encoding_name)); } void RenderView::OnResetPageEncodingToDefault() { - std::string no_encoding; - webview()->SetPageEncoding(no_encoding); + WebString no_encoding; + webview()->setPageEncoding(no_encoding); } void RenderView::UpdateInspectorSettings(const std::wstring& raw_settings) { @@ -2786,7 +2784,7 @@ WebDevToolsAgentDelegate* RenderView::GetWebDevToolsAgentDelegate() { WebFrame* RenderView::GetChildFrame(const std::wstring& xpath) const { if (xpath.empty()) - return webview()->GetMainFrame(); + return webview()->mainFrame(); // xpath string can represent a frame deep down the tree (across multiple // frame DOMs). @@ -2794,7 +2792,7 @@ WebFrame* RenderView::GetChildFrame(const std::wstring& xpath) const { // should break into 2 xpaths // /html/body/table/tbody/tr/td/iframe & /frameset/frame[0] - WebFrame* frame = webview()->GetMainFrame(); + WebFrame* frame = webview()->mainFrame(); std::wstring xpath_remaining = xpath; while (!xpath_remaining.empty()) { @@ -2873,14 +2871,14 @@ void RenderView::OnDragSourceEndedOrMoved(const gfx::Point& client_point, bool ended, WebDragOperation op) { if (ended) { - webview()->DragSourceEndedAt(client_point, screen_point, op); + webview()->dragSourceEndedAt(client_point, screen_point, op); } else { - webview()->DragSourceMovedTo(client_point, screen_point); + webview()->dragSourceMovedTo(client_point, screen_point); } } void RenderView::OnDragSourceSystemDragEnded() { - webview()->DragSourceSystemDragEnded(); + webview()->dragSourceSystemDragEnded(); } void RenderView::OnUploadFileRequest(const ViewMsg_UploadFile_Params& p) { @@ -2932,7 +2930,7 @@ void RenderView::OnDragTargetDragEnter(const WebDropData& drop_data, const gfx::Point& client_point, const gfx::Point& screen_point, WebDragOperationsMask ops) { - WebDragOperation operation = webview()->DragTargetDragEnter( + WebDragOperation operation = webview()->dragTargetDragEnter( drop_data.ToDragData(), drop_data.identity, client_point, @@ -2945,7 +2943,7 @@ void RenderView::OnDragTargetDragEnter(const WebDropData& drop_data, void RenderView::OnDragTargetDragOver(const gfx::Point& client_point, const gfx::Point& screen_point, WebDragOperationsMask ops) { - WebDragOperation operation = webview()->DragTargetDragOver( + WebDragOperation operation = webview()->dragTargetDragOver( client_point, screen_point, ops); @@ -2954,12 +2952,12 @@ void RenderView::OnDragTargetDragOver(const gfx::Point& client_point, } void RenderView::OnDragTargetDragLeave() { - webview()->DragTargetDragLeave(); + webview()->dragTargetDragLeave(); } void RenderView::OnDragTargetDrop(const gfx::Point& client_point, const gfx::Point& screen_point) { - webview()->DragTargetDrop(client_point, screen_point); + webview()->dragTargetDrop(client_point, screen_point); } void RenderView::OnUpdateWebPreferences(const WebPreferences& prefs) { @@ -2991,7 +2989,7 @@ void RenderView::OnFileChooserResponse( void RenderView::OnEnableViewSourceMode() { if (!webview()) return; - WebFrame* main_frame = webview()->GetMainFrame(); + WebFrame* main_frame = webview()->mainFrame(); if (!main_frame) return; @@ -3109,7 +3107,7 @@ void RenderView::OnGetSerializedHtmlDataForCurrentPageWithLocalLinks( const std::vector<GURL>& links, const std::vector<FilePath>& local_paths, const FilePath& local_directory_name) { - webkit_glue::DomSerializer dom_serializer(webview()->GetMainFrame(), + webkit_glue::DomSerializer dom_serializer(webview()->mainFrame(), true, this, links, @@ -3125,7 +3123,7 @@ void RenderView::DidSerializeDataForFrame(const GURL& frame_url, } void RenderView::OnMsgShouldClose() { - bool should_close = webview()->ShouldClose(); + bool should_close = webview()->dispatchBeforeUnloadEvent(); Send(new ViewHostMsg_ShouldClose_ACK(routing_id_, should_close)); } @@ -3137,7 +3135,7 @@ void RenderView::OnClosePage(const ViewMsg_ClosePage_Params& params) { // revisited to avoid having two ways to close a page. Having a single way // to close that can run onunload is also useful for fixing // http://b/issue?id=753080. - WebFrame* main_frame = webview()->GetMainFrame(); + WebFrame* main_frame = webview()->mainFrame(); if (main_frame) { const GURL& url = main_frame->url(); // TODO(davemoore) this code should be removed once willClose() gets @@ -3147,7 +3145,7 @@ void RenderView::OnClosePage(const ViewMsg_ClosePage_Params& params) { url.SchemeIs(chrome::kHttpsScheme)) DumpLoadHistograms(); } - webview()->ClosePage(); + webview()->dispatchUnloadEvent(); // Just echo back the params in the ACK. Send(new ViewHostMsg_ClosePage_ACK(routing_id_, params)); @@ -3274,7 +3272,7 @@ void RenderView::OnResize(const gfx::Size& new_size, void RenderView::OnClearFocusedNode() { if (webview()) - webview()->ClearFocusedNode(); + webview()->clearFocusedNode(); } void RenderView::OnSetBackground(const SkBitmap& background) { @@ -3354,7 +3352,7 @@ void RenderView::OnExtensionMessageInvoke(const std::string& function_name, // Also, it's possible to load a page without ever laying it out // so first_paint and first_paint_after_load can be 0. void RenderView::DumpLoadHistograms() const { - WebFrame* main_frame = webview()->GetMainFrame(); + WebFrame* main_frame = webview()->mainFrame(); NavigationState* navigation_state = NavigationState::FromDataSource(main_frame->dataSource()); Time finish = navigation_state->finish_load_time(); @@ -3576,7 +3574,7 @@ void RenderView::OnExecuteCode(int request_id, const std::string& extension_id, pending_code_execution_queue_.push(info); return; } - WebFrame* main_frame = webview() ? webview()->GetMainFrame() : NULL; + WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; if (!main_frame) { Send(new ViewMsg_ExecuteCodeFinished(routing_id_, request_id, false)); return; diff --git a/chrome/renderer/render_view_unittest.cc b/chrome/renderer/render_view_unittest.cc index 3119996..8bf7847 100644 --- a/chrome/renderer/render_view_unittest.cc +++ b/chrome/renderer/render_view_unittest.cc @@ -387,11 +387,11 @@ TEST_F(RenderViewTest, PrintWithIframe) { // Find the frame and set it as the focused one. This should mean that that // the printout should only contain the contents of that frame. WebFrame* sub1_frame = - view_->webview()->GetFrameWithName(WebString::fromUTF8("sub1")); + view_->webview()->findFrameByName(WebString::fromUTF8("sub1")); ASSERT_TRUE(sub1_frame); - view_->webview()->SetFocusedFrame(sub1_frame); - ASSERT_NE(view_->webview()->GetFocusedFrame(), - view_->webview()->GetMainFrame()); + view_->webview()->setFocusedFrame(sub1_frame); + ASSERT_NE(view_->webview()->focusedFrame(), + view_->webview()->mainFrame()); // Initiate printing. view_->OnPrintPages(); @@ -513,7 +513,7 @@ TEST_F(RenderViewTest, OnPrintPageAsBitmap) { // Fetch the image data from the web frame. std::vector<unsigned char> data; view_->print_helper()->PrintPageAsJPEG(page_params, - view_->webview()->GetMainFrame(), + view_->webview()->mainFrame(), 1.0f, &data); std::vector<unsigned char> decoded; diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index cdf5720..52ee244 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -169,7 +169,7 @@ WebPluginDelegateProxy::WebPluginDelegateProxy( sad_plugin_(NULL), invalidate_pending_(false), transparent_(false), - page_url_(render_view_->webview()->GetMainFrame()->url()) { + page_url_(render_view_->webview()->mainFrame()->url()) { } WebPluginDelegateProxy::~WebPluginDelegateProxy() { @@ -929,7 +929,7 @@ void WebPluginDelegateProxy::OnGetDragData(const NPVariant_Param& object, int event_id; WebDragData data; NPObject* event = reinterpret_cast<NPObject*>(object.npobject_pointer); - const int32 drag_id = webview->GetDragIdentity(); + const int32 drag_id = webview->dragIdentity(); if (!drag_id || !WebBindings::getDragData(event, &event_id, &data)) return; @@ -960,7 +960,7 @@ void WebPluginDelegateProxy::OnSetDropEffect(const NPVariant_Param& object, return; NPObject* event = reinterpret_cast<NPObject*>(object.npobject_pointer); - const int32 drag_id = webview->GetDragIdentity(); + const int32 drag_id = webview->dragIdentity(); if (!drag_id || !WebBindings::isDragEvent(event)) return; diff --git a/chrome/test/render_view_test.cc b/chrome/test/render_view_test.cc index e0321c7..2f8943d 100644 --- a/chrome/test/render_view_test.cc +++ b/chrome/test/render_view_test.cc @@ -38,7 +38,7 @@ void RenderViewTest::ProcessPendingMessages() { } WebFrame* RenderViewTest::GetMainFrame() { - return view_->webview()->GetMainFrame(); + return view_->webview()->mainFrame(); } void RenderViewTest::ExecuteJavaScript(const char* js) { diff --git a/webkit/api/public/WebView.h b/webkit/api/public/WebView.h index 70aa014..10d07c4 100644 --- a/webkit/api/public/WebView.h +++ b/webkit/api/public/WebView.h @@ -31,13 +31,13 @@ #ifndef WebView_h #define WebView_h -#error "This header file is still a work in progress; do not include!" - -#include "WebCommon.h" +#include "WebDragOperation.h" #include "WebWidget.h" namespace WebKit { - class WebPreferences; + class WebDragData; + class WebFrame; + class WebSettings; class WebString; class WebViewClient; struct WebPoint; @@ -47,9 +47,10 @@ namespace WebKit { WEBKIT_API WebView* create(WebViewClient*); - // Preferences --------------------------------------------------------- + // Options ------------------------------------------------------------- - virtual WebPreferences* preferences() = 0; + // The returned pointer is valid for the lifetime of the WebView. + virtual WebSettings* settings() = 0; // Corresponds to the encoding of the main frame. Setting the page // encoding may cause the main frame to reload. @@ -59,9 +60,11 @@ namespace WebKit { // Closing ------------------------------------------------------------- - // Returns false if any handler suppressed unloading. + // Runs beforeunload handlers for the current page, returning false if + // any handler suppressed unloading. virtual bool dispatchBeforeUnloadEvent() = 0; + // Runs unload handlers for the current page. virtual void dispatchUnloadEvent() = 0; @@ -81,12 +84,6 @@ namespace WebKit { virtual WebFrame* focusedFrame() = 0; virtual void setFocusedFrame(WebFrame*) = 0; - // Restores focus to the previously focused frame and element. This - // method is invoked when the WebView is shown after being hidden, and - // focus is to be restored. When a WebView loses focus, it remembers - // the frame and element that had focus. - virtual void restoreFocus() = 0; - // Focus the first (last if reverse is true) focusable node. virtual void setInitialFocus(bool reverse) = 0; @@ -96,19 +93,6 @@ namespace WebKit { virtual void clearFocusedNode() = 0; - // Capture ------------------------------------------------------------- - - // Fills the contents of this WebView's frames into the given string. - // If the text is longer than maxCharacters, it will be clipped to that - // length. Warning: this function may be slow depending on the number - // of characters retrieved and page complexity. For a typically sized - // page, expect it to take on the order of milliseconds. - // - // If there is room, subframe text will be recursively appended. Each - // frame will be separated by an empty line. - virtual WebString captureAsText(unsigned maxCharacters) = 0; - - // Zoom ---------------------------------------------------------------- // Change the text zoom level. It will make the zoom level 20% larger @@ -132,35 +116,36 @@ namespace WebKit { virtual void copyImageAt(const WebPoint&) = 0; // Notifies the WebView that a drag has terminated. - virtual void dragSourceEndedAt(const WebPoint& clientPoint, - const WebPoint& screenPoint) = 0; + virtual void dragSourceEndedAt( + const WebPoint& clientPoint, const WebPoint& screenPoint, + WebDragOperation operation) = 0; // Notifies the WebView that a drag and drop operation is in progress, with // dropable items over the view. - virtual void dragSourceMovedTo(const WebPoint& clientPoint, - const WebPoint& screenPoint) = 0; + virtual void dragSourceMovedTo( + const WebPoint& clientPoint, const WebPoint& screenPoint) = 0; // Notfies the WebView that the system drag and drop operation has ended. virtual void dragSourceSystemDragEnded() = 0; // Callback methods when a drag-and-drop operation is trying to drop // something on the WebView. - virtual bool dragTargetDragEnter(const WebDragData&, int identity, - const WebPoint& clientPoint, - const WebPoint& screenPoint) = 0; - virtual bool dragTargetDragOver(const WebPoint& clientPoint, - const WebPoint& screenPoint) = 0; + virtual WebDragOperation dragTargetDragEnter( + const WebDragData&, int identity, + const WebPoint& clientPoint, const WebPoint& screenPoint, + WebDragOperationsMask operationsAllowed) = 0; + virtual WebDragOperation dragTargetDragOver( + const WebPoint& clientPoint, const WebPoint& screenPoint, + WebDragOperationsMask operationsAllowed) = 0; virtual void dragTargetDragLeave() = 0; - virtual void dragTargetDrop(const WebPoint& clientPoint, - const WebPoint& screenPoint) = 0; + virtual void dragTargetDrop( + const WebPoint& clientPoint, const WebPoint& screenPoint) = 0; virtual int dragIdentity() = 0; // Developer tools ----------------------------------------------------- - virtual WebDevToolsAgent* devToolsAgent() = 0; - // Inspect a particular point in the WebView. (x = -1 || y = -1) is a // special case, meaning inspect the current page and not a specific // point. @@ -174,6 +159,11 @@ namespace WebKit { // InsertText -> should move to WebTextInput // AutofillSuggestionsForNode // HideAutofillPopup + + protected: + ~WebView() {} }; } // namespace WebKit + +#endif diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc index fcf902ef6..d635fb4 100644 --- a/webkit/glue/chrome_client_impl.cc +++ b/webkit/glue/chrome_client_impl.cc @@ -292,8 +292,7 @@ bool ChromeClientImpl::statusbarVisible() { void ChromeClientImpl::setScrollbarsVisible(bool value) { scrollbars_visible_ = value; - WebFrameImpl* web_frame = - static_cast<WebFrameImpl*>(webview_->GetMainFrame()); + WebFrameImpl* web_frame = static_cast<WebFrameImpl*>(webview_->mainFrame()); if (web_frame) web_frame->SetAllowsScrolling(value); } diff --git a/webkit/glue/cpp_bound_class_unittest.cc b/webkit/glue/cpp_bound_class_unittest.cc index bdddd11..a368e62 100644 --- a/webkit/glue/cpp_bound_class_unittest.cc +++ b/webkit/glue/cpp_bound_class_unittest.cc @@ -88,7 +88,7 @@ class CppBoundClassTest : public TestShellTest { if (rv) { test_shell_ = host; TestShell::windowList()->push_back(host->mainWnd()); - webframe_ = test_shell_->webView()->GetMainFrame(); + webframe_ = test_shell_->webView()->mainFrame(); ASSERT_TRUE(webframe_ != NULL); } else { delete host; diff --git a/webkit/glue/dom_operations.cc b/webkit/glue/dom_operations.cc index 64ed00f..be2c7a8 100644 --- a/webkit/glue/dom_operations.cc +++ b/webkit/glue/dom_operations.cc @@ -256,7 +256,7 @@ static bool FillFormToUploadFileImpl(WebCore::HTMLFormElement* fe, } bool FillFormToUploadFile(WebView* view, const FileUploadData& data) { - WebFrame* main_frame = view->GetMainFrame(); + WebFrame* main_frame = view->mainFrame(); if (!main_frame) return false; WebFrameImpl* main_frame_impl = static_cast<WebFrameImpl*>(main_frame); @@ -354,7 +354,7 @@ static void FindFormElements(WebView* view, FormElementsList* results) { DCHECK(view); DCHECK(results); - WebFrame* main_frame = view->GetMainFrame(); + WebFrame* main_frame = view->mainFrame(); if (!main_frame) return; @@ -587,7 +587,7 @@ bool ElementHasLegalLinkAttribute(const WebCore::Element* element, WebFrameImpl* GetWebFrameImplFromWebViewForSpecificURL(WebView* view, const GURL& page_url) { - WebFrame* main_frame = view->GetMainFrame(); + WebFrame* main_frame = view->mainFrame(); if (!main_frame) return NULL; WebFrameImpl* main_frame_impl = static_cast<WebFrameImpl*>(main_frame); @@ -629,7 +629,7 @@ WebFrameImpl* GetWebFrameImplFromWebViewForSpecificURL(WebView* view, // frame and sub-frame bool GetAllSavableResourceLinksForCurrentPage(WebView* view, const GURL& page_url, SavableResourcesResult* result) { - WebFrame* main_frame = view->GetMainFrame(); + WebFrame* main_frame = view->mainFrame(); if (!main_frame) return false; WebFrameImpl* main_frame_impl = static_cast<WebFrameImpl*>(main_frame); @@ -753,7 +753,7 @@ static void AddInstallIcon(WebCore::HTMLLinkElement* link, } void GetApplicationInfo(WebView* view, WebApplicationInfo* app_info) { - WebFrame* main_frame = view->GetMainFrame(); + WebFrame* main_frame = view->mainFrame(); if (!main_frame) return; WebFrameImpl* main_frame_impl = static_cast<WebFrameImpl*>(main_frame); @@ -799,7 +799,7 @@ bool PauseAnimationAtTimeOnElementWithId(WebView* view, const std::string& animation_name, double time, const std::string& element_id) { - WebFrame* web_frame = view->GetMainFrame(); + WebFrame* web_frame = view->mainFrame(); if (!web_frame) return false; @@ -822,7 +822,7 @@ bool PauseTransitionAtTimeOnElementWithId(WebView* view, const std::string& property_name, double time, const std::string& element_id) { - WebFrame* web_frame = view->GetMainFrame(); + WebFrame* web_frame = view->mainFrame(); if (!web_frame) return false; @@ -843,7 +843,7 @@ bool PauseTransitionAtTimeOnElementWithId(WebView* view, bool ElementDoesAutoCompleteForElementWithId(WebView* view, const std::string& element_id) { - WebFrame* web_frame = view->GetMainFrame(); + WebFrame* web_frame = view->mainFrame(); if (!web_frame) return false; @@ -859,7 +859,7 @@ bool ElementDoesAutoCompleteForElementWithId(WebView* view, } int NumberOfActiveAnimations(WebView* view) { - WebFrame* web_frame = view->GetMainFrame(); + WebFrame* web_frame = view->mainFrame(); if (!web_frame) return -1; diff --git a/webkit/glue/dom_serializer_unittest.cc b/webkit/glue/dom_serializer_unittest.cc index b6eb8f7..f62f01fb 100644 --- a/webkit/glue/dom_serializer_unittest.cc +++ b/webkit/glue/dom_serializer_unittest.cc @@ -108,14 +108,13 @@ class DomSerializerTests : public TestShellTest, test_shell_->ResetTestController(); // If input encoding is empty, use UTF-8 as default encoding. if (encoding_info.isEmpty()) { - test_shell_->webView()->GetMainFrame()->loadHTMLString(contents, - base_url); + test_shell_->webView()->mainFrame()->loadHTMLString(contents, base_url); } else { // Do not use WebFrame.LoadHTMLString because it assumes that input // html contents use UTF-8 encoding. // TODO(darin): This should use WebFrame::loadData. WebFrameImpl* web_frame = - static_cast<WebFrameImpl*>(test_shell_->webView()->GetMainFrame()); + static_cast<WebFrameImpl*>(test_shell_->webView()->mainFrame()); ASSERT_TRUE(web_frame != NULL); int len = static_cast<int>(contents.size()); RefPtr<WebCore::SharedBuffer> buf( @@ -265,7 +264,7 @@ TEST_F(DomSerializerTests, SerialzeHTMLDOMWithDocType) { web_frame->frame()->loader()->encoding()); // Make sure serialized contents still have document type. web_frame = - static_cast<WebFrameImpl*>(test_shell_->webView()->GetMainFrame()); + static_cast<WebFrameImpl*>(test_shell_->webView()->mainFrame()); doc = web_frame->frame()->document(); ASSERT_TRUE(doc->doctype() != NULL); } @@ -297,7 +296,7 @@ TEST_F(DomSerializerTests, SerialzeHTMLDOMWithoutDocType) { web_frame->frame()->loader()->encoding()); // Make sure serialized contents do not have document type. web_frame = - static_cast<WebFrameImpl*>(test_shell_->webView()->GetMainFrame()); + static_cast<WebFrameImpl*>(test_shell_->webView()->mainFrame()); doc = web_frame->frame()->document(); ASSERT_TRUE(doc->doctype() == NULL); } @@ -399,7 +398,7 @@ TEST_F(DomSerializerTests, SerialzeHTMLDOMWithNoMetaCharsetInOriginalDoc) { // Make sure the first child of HEAD element is META which has charset // declaration in serialized contents. web_frame = - static_cast<WebFrameImpl*>(test_shell_->webView()->GetMainFrame()); + static_cast<WebFrameImpl*>(test_shell_->webView()->mainFrame()); ASSERT_TRUE(web_frame != NULL); doc = web_frame->frame()->document(); ASSERT_TRUE(doc->isHTMLDocument()); @@ -467,7 +466,7 @@ TEST_F(DomSerializerTests, // Make sure only first child of HEAD element is META which has charset // declaration in serialized contents. web_frame = - static_cast<WebFrameImpl*>(test_shell_->webView()->GetMainFrame()); + static_cast<WebFrameImpl*>(test_shell_->webView()->mainFrame()); ASSERT_TRUE(web_frame != NULL); doc = web_frame->frame()->document(); ASSERT_TRUE(doc->isHTMLDocument()); @@ -718,8 +717,7 @@ TEST_F(DomSerializerTests, SerialzeHTMLDOMWithBaseTag) { // Make sure all links are absolute URLs and doc there are some number of // BASE tags in serialized HTML data. Each of those BASE tags have same base // URL which is as same as URL of current test file. - web_frame = - static_cast<WebFrameImpl*>(test_shell_->webView()->GetMainFrame()); + web_frame = static_cast<WebFrameImpl*>(test_shell_->webView()->mainFrame()); ASSERT_TRUE(web_frame != NULL); doc = web_frame->frame()->document(); ASSERT_TRUE(doc->isHTMLDocument()); @@ -772,7 +770,7 @@ TEST_F(DomSerializerTests, SerialzeHTMLDOMWithEmptyHead) { // Make sure the head tag is empty. WebFrameImpl* web_frame = - static_cast<WebFrameImpl*>(test_shell_->webView()->GetMainFrame()); + static_cast<WebFrameImpl*>(test_shell_->webView()->mainFrame()); ASSERT_TRUE(web_frame != NULL); WebCore::Document* doc = web_frame->frame()->document(); ASSERT_TRUE(doc->isHTMLDocument()); @@ -791,8 +789,7 @@ TEST_F(DomSerializerTests, SerialzeHTMLDOMWithEmptyHead) { // Reload serialized contents and make sure there is only one META tag. LoadContents(serialized_contents, file_url, web_frame->frame()->loader()->encoding()); - web_frame = - static_cast<WebFrameImpl*>(test_shell_->webView()->GetMainFrame()); + web_frame = static_cast<WebFrameImpl*>(test_shell_->webView()->mainFrame()); ASSERT_TRUE(web_frame != NULL); doc = web_frame->frame()->document(); ASSERT_TRUE(doc->isHTMLDocument()); diff --git a/webkit/glue/iframe_redirect_unittest.cc b/webkit/glue/iframe_redirect_unittest.cc index 3529b77..4475735 100644 --- a/webkit/glue/iframe_redirect_unittest.cc +++ b/webkit/glue/iframe_redirect_unittest.cc @@ -41,7 +41,7 @@ TEST_F(IFrameRedirectTest, Test) { test_shell_->WaitTestFinished(); WebFrame* iframe = - test_shell_->webView()->GetFrameWithName(WebString::fromUTF8("ifr")); + test_shell_->webView()->findFrameByName(WebString::fromUTF8("ifr")); ASSERT_TRUE(iframe != NULL); WebDataSource* iframe_ds = iframe->dataSource(); ASSERT_TRUE(iframe_ds != NULL); diff --git a/webkit/glue/mimetype_unittest.cc b/webkit/glue/mimetype_unittest.cc index 04d5880..f55051f 100644 --- a/webkit/glue/mimetype_unittest.cc +++ b/webkit/glue/mimetype_unittest.cc @@ -30,7 +30,7 @@ class MimeTypeTests : public TestShellTest { std::string path("contenttype?"); GURL url = server_->TestServerPage(path + mimetype); LoadURL(url); - WebFrame* frame = test_shell_->webView()->GetMainFrame(); + WebFrame* frame = test_shell_->webView()->mainFrame(); EXPECT_EQ(expected, webkit_glue::DumpDocumentText(frame)); } diff --git a/webkit/glue/resource_fetcher_unittest.cc b/webkit/glue/resource_fetcher_unittest.cc index b61765f..dc98fc6 100644 --- a/webkit/glue/resource_fetcher_unittest.cc +++ b/webkit/glue/resource_fetcher_unittest.cc @@ -156,7 +156,7 @@ TEST_F(ResourceFetcherTests, ResourceFetcherDownload) { UnittestTestServer::CreateServer(); ASSERT_TRUE(NULL != server.get()); - WebFrame* frame = test_shell_->webView()->GetMainFrame(); + WebFrame* frame = test_shell_->webView()->mainFrame(); GURL url = server->TestServerPage("files/test_shell/index.html"); scoped_ptr<FetcherDelegate> delegate(new FetcherDelegate); @@ -187,7 +187,7 @@ TEST_F(ResourceFetcherTests, ResourceFetcherDidFail) { UnittestTestServer::CreateServer(); ASSERT_TRUE(NULL != server.get()); - WebFrame* frame = test_shell_->webView()->GetMainFrame(); + WebFrame* frame = test_shell_->webView()->mainFrame(); // Try to fetch a page on a site that doesn't exist. GURL url("http://localhost:1339/doesnotexist"); @@ -210,7 +210,7 @@ TEST_F(ResourceFetcherTests, ResourceFetcherTimeout) { UnittestTestServer::CreateServer(); ASSERT_TRUE(NULL != server.get()); - WebFrame* frame = test_shell_->webView()->GetMainFrame(); + WebFrame* frame = test_shell_->webView()->mainFrame(); // Grab a page that takes at least 1 sec to respond, but set the fetcher to // timeout in 0 sec. diff --git a/webkit/glue/webaccessibilitymanager_impl.cc b/webkit/glue/webaccessibilitymanager_impl.cc index 382c6057a..5f2f2e3 100644 --- a/webkit/glue/webaccessibilitymanager_impl.cc +++ b/webkit/glue/webaccessibilitymanager_impl.cc @@ -198,7 +198,7 @@ bool WebAccessibilityManagerImpl::InitAccObjRoot(WebView* view) { // Enable accessibility and retrieve Document. WebCore::AXObjectCache::enableAccessibility(); WebFrameImpl* main_frame_impl = - static_cast<WebFrameImpl*>(view->GetMainFrame()); + static_cast<WebFrameImpl*>(view->mainFrame()); if (!main_frame_impl || !main_frame_impl->frame()) return false; diff --git a/webkit/glue/webdevtoolsagent_impl.cc b/webkit/glue/webdevtoolsagent_impl.cc index 1e35128..8902227 100644 --- a/webkit/glue/webdevtoolsagent_impl.cc +++ b/webkit/glue/webdevtoolsagent_impl.cc @@ -142,7 +142,7 @@ void WebDevToolsAgentImpl::DidCommitLoadForFrame( GURL url = ds->hasUnreachableURL() ? ds->unreachableURL() : request.url(); - if (webview->GetMainFrame() == frame) { + if (webview->mainFrame() == frame) { ResetInspectorFrontendProxy(); tools_agent_delegate_stub_->FrameNavigate( url.possibly_invalid_spec()); diff --git a/webkit/glue/webframe_unittest.cc b/webkit/glue/webframe_unittest.cc index 00fe2fa..b2a71b4 100644 --- a/webkit/glue/webframe_unittest.cc +++ b/webkit/glue/webframe_unittest.cc @@ -20,7 +20,7 @@ class WebFrameTest : public TestShellTest { TEST_F(WebFrameTest, GetContentAsPlainText) { WebView* view = test_shell_->webView(); - WebFrame* frame = view->GetMainFrame(); + WebFrame* frame = view->mainFrame(); // Generate a simple test case. const char simple_source[] = "<div>Foo bar</div><div></div>baz"; @@ -61,7 +61,7 @@ TEST_F(WebFrameTest, GetContentAsPlainText) { TEST_F(WebFrameTest, GetFullHtmlOfPage) { WebView* view = test_shell_->webView(); - WebFrame* frame = view->GetMainFrame(); + WebFrame* frame = view->mainFrame(); // Generate a simple test case. const char simple_source[] = "<p>Hello</p><p>World</p>"; diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc index 92e62a3..0e61b6f 100644 --- a/webkit/glue/webkit_glue.cc +++ b/webkit/glue/webkit_glue.cc @@ -227,7 +227,7 @@ std::wstring DumpHistoryState(const std::string& history_state, int indent, } void ResetBeforeTestRun(WebView* view) { - WebFrameImpl* webframe = static_cast<WebFrameImpl*>(view->GetMainFrame()); + WebFrameImpl* webframe = static_cast<WebFrameImpl*>(view->mainFrame()); WebCore::Frame* frame = webframe->frame(); // Reset the main frame name since tests always expect it to be empty. It diff --git a/webkit/glue/webplugin_impl.cc b/webkit/glue/webplugin_impl.cc index ec8965a..dfb24e6 100644 --- a/webkit/glue/webplugin_impl.cc +++ b/webkit/glue/webplugin_impl.cc @@ -497,7 +497,7 @@ WebPluginImpl::RoutingStatus WebPluginImpl::RouteToFrame( // Take special action for JavaScript URLs if (is_javascript_url) { - WebFrame* target_frame = webframe_->view()->GetFrameWithName(target_str); + WebFrame* target_frame = webframe_->view()->findFrameByName(target_str); // For security reasons, do not allow JavaScript on frames // other than this frame. if (target_frame != webframe_) { diff --git a/webkit/glue/webpreferences.cc b/webkit/glue/webpreferences.cc index 5c5aabc..d2d3e4b 100644 --- a/webkit/glue/webpreferences.cc +++ b/webkit/glue/webpreferences.cc @@ -16,7 +16,7 @@ using WebKit::WebSettings; using WebKit::WebURL; void WebPreferences::Apply(WebView* web_view) const { - WebSettings* settings = web_view->GetSettings(); + WebSettings* settings = web_view->settings(); settings->setStandardFontFamily(WideToUTF16Hack(standard_font_family)); settings->setFixedFontFamily(WideToUTF16Hack(fixed_font_family)); settings->setSerifFontFamily(WideToUTF16Hack(serif_font_family)); diff --git a/webkit/glue/webview.h b/webkit/glue/webview.h index 43af41e..94df467 100644 --- a/webkit/glue/webview.h +++ b/webkit/glue/webview.h @@ -10,7 +10,7 @@ #include "base/basictypes.h" #include "webkit/api/public/WebDragOperation.h" -#include "webkit/api/public/WebWidget.h" +#include "webkit/api/public/WebView.h" namespace WebKit { class WebDragData; @@ -45,7 +45,7 @@ struct MediaPlayerAction; // user interface elements in those windows, monitoring the progress of loads, // monitoring URL changes, and making determinations about how content of // certain types should be handled. -class WebView : public WebKit::WebWidget { +class WebView : public WebKit::WebView { public: WebView() {} virtual ~WebView() {} @@ -78,37 +78,6 @@ class WebView : public WebKit::WebWidget { // or inserts a '\t' char in text area virtual void SetTabKeyCyclesThroughElements(bool value) = 0; - // Returns whether the current view can be closed, after running any - // onbeforeunload event handlers. - virtual bool ShouldClose() = 0; - - // Tells the current page to close, running the onunload handler. - // TODO(creis): We'd rather use WebWidget::Close(), but that sets its - // delegate_ to NULL, preventing any JavaScript dialogs in the onunload - // handler from appearing. This lets us shortcut that for now, but we should - // refactor close messages so that this isn't necessary. - // TODO(darin): This comment is out-of-date, and we should be able to use - // WebWidget::Close now. - virtual void ClosePage() = 0; - - // - // @method mainFrame - // @abstract Return the top level frame. - // @discussion Note that even document that are not framesets will have a - // mainFrame. - // @result The main frame. - // - (WebFrame *)mainFrame; - virtual WebKit::WebFrame* GetMainFrame() = 0; - - // Returns the currently focused frame. - virtual WebKit::WebFrame* GetFocusedFrame() = 0; - - // Sets focus to the frame passed in. - virtual void SetFocusedFrame(WebKit::WebFrame* frame) = 0; - - // Returns the frame with the given name, or NULL if not found. - virtual WebKit::WebFrame* GetFrameWithName(const WebKit::WebString& name) = 0; - // Returns the frame previous to the specified frame, by traversing the frame // tree, wrapping around if necessary. virtual WebKit::WebFrame* GetPreviousFrameBefore(WebKit::WebFrame* frame, bool wrap) = 0; @@ -130,89 +99,13 @@ class WebView : public WebKit::WebWidget { // ---- TODO(darin): remove to here ---- - // Focus the first (last if reverse is true) focusable node. - virtual void SetInitialFocus(bool reverse) = 0; - - // Clears the focused node (and selection if a text field is focused) to - // ensure that a text field on the page is not eating keystrokes we send it. - virtual void ClearFocusedNode() = 0; - - // Gets a WebSettings object that can be used to modify the behavior of this - // WebView. The object is deleted by this class on destruction, so you must - // not use it beyond WebView's lifetime. - virtual WebKit::WebSettings* GetSettings() = 0; - // Settings used by inspector. virtual const std::wstring& GetInspectorSettings() const = 0; virtual void SetInspectorSettings(const std::wstring& settings) = 0; - // Set the encoding of the current main frame. The value comes from - // the encoding menu. WebKit uses the function named - // SetCustomTextEncodingName to do override encoding job. - virtual void SetPageEncoding(const std::string& encoding_name) = 0; - - // Return the canonical encoding name of current main webframe in webview. - virtual std::string GetMainFrameEncodingName() = 0; - - // Change the text zoom level. It will make the zoom level 20% larger or - // smaller. If text_only is set, the text size will be changed. When unset, - // the entire page's zoom factor will be changed. - // - // You can only have either text zoom or full page zoom at one time. Changing - // the mode will change things in weird ways. Generally the app should only - // support text zoom or full page zoom, and not both. - // - // ResetZoom will reset both full page and text zoom. - virtual void ZoomIn(bool text_only) = 0; - virtual void ZoomOut(bool text_only) = 0; - virtual void ResetZoom() = 0; - - // Copy to the clipboard the image located at a particular point in the - // WebView (if there is such an image) - virtual void CopyImageAt(int x, int y) = 0; - - // Inspect a particular point in the WebView. (x = -1 || y = -1) is a special - // case which means inspect the current page and not a specific point. - virtual void InspectElement(int x, int y) = 0; - // Show the JavaScript console. virtual void ShowJavaScriptConsole() = 0; - // Notifies the webview that a drag has ended (with a drop or a cancel). - virtual void DragSourceEndedAt( - const WebKit::WebPoint& client_point, - const WebKit::WebPoint& screen_point, - WebKit::WebDragOperation operation) = 0; - - // Notifies the webview that a drag and drop operation is in progress, with - // dropable items over the view. - virtual void DragSourceMovedTo( - const WebKit::WebPoint& client_point, - const WebKit::WebPoint& screen_point) = 0; - - // Notfies the webview that the system drag and drop operation has ended. - virtual void DragSourceSystemDragEnded() = 0; - - // Callback methods when a drag and drop operation is trying to drop data - // on this webview. - virtual WebKit::WebDragOperation DragTargetDragEnter( - const WebKit::WebDragData& drag_data, int identity, - const WebKit::WebPoint& client_point, - const WebKit::WebPoint& screen_point, - WebKit::WebDragOperationsMask operations_allowed) = 0; - virtual WebKit::WebDragOperation DragTargetDragOver( - const WebKit::WebPoint& client_point, - const WebKit::WebPoint& screen_point, - WebKit::WebDragOperationsMask operations_allowed) = 0; - virtual void DragTargetDragLeave() = 0; - virtual void DragTargetDrop( - const WebKit::WebPoint& client_point, - const WebKit::WebPoint& screen_point) = 0; - - // Helper method for drag and drop target operations: return the drag data - // identity. - virtual int32 GetDragIdentity() = 0; - // Helper method for drag and drop target operations: override the default // drop effect with either a "copy" (accept true) or "none" (accept false) // effect. Return true on success. diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index 63727cd..a6525fa 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -828,11 +828,11 @@ bool WebViewImpl::KeyEventDefault(const WebKeyboardEvent& event) { if (event.modifiers == WebInputEvent::ControlKey) { switch (event.windowsKeyCode) { case 'A': - GetFocusedFrame()->executeCommand(WebString::fromUTF8("SelectAll")); + focusedFrame()->executeCommand(WebString::fromUTF8("SelectAll")); return true; case VKEY_INSERT: case 'C': - GetFocusedFrame()->executeCommand(WebString::fromUTF8("Copy")); + focusedFrame()->executeCommand(WebString::fromUTF8("Copy")); return true; // Match FF behavior in the sense that Ctrl+home/end are the only Ctrl // key combinations which affect scrolling. Safari is buggy in the @@ -1248,7 +1248,34 @@ void WebViewImpl::setTextDirection(WebTextDirection direction) { // WebView -------------------------------------------------------------------- -bool WebViewImpl::ShouldClose() { +WebSettings* WebViewImpl::settings() { + if (!web_settings_.get()) + web_settings_.reset(new WebSettingsImpl(page_->settings())); + DCHECK(web_settings_.get()); + return web_settings_.get(); +} + +WebString WebViewImpl::pageEncoding() const { + if (!page_.get()) + return WebString(); + + String encoding_name = page_->mainFrame()->loader()->encoding(); + return webkit_glue::StringToWebString(encoding_name); +} + +void WebViewImpl::setPageEncoding(const WebString& encoding_name) { + if (!page_.get()) + return; + + // Only change override encoding, don't change default encoding. + // Note that the new encoding must be NULL if it isn't supposed to be set. + String new_encoding_name; + if (!encoding_name.isEmpty()) + new_encoding_name = webkit_glue::WebStringToString(encoding_name); + page_->mainFrame()->loader()->reloadWithOverrideEncoding(new_encoding_name); +} + +bool WebViewImpl::dispatchBeforeUnloadEvent() { // TODO(creis): This should really cause a recursive depth-first walk of all // frames in the tree, calling each frame's onbeforeunload. At the moment, // we're consistent with Safari 3.1, not IE/FF. @@ -1259,25 +1286,27 @@ bool WebViewImpl::ShouldClose() { return frame->shouldClose(); } -void WebViewImpl::ClosePage() { +void WebViewImpl::dispatchUnloadEvent() { // Run unload handlers. page_->mainFrame()->loader()->closeURL(); } -WebViewDelegate* WebViewImpl::GetDelegate() { - return delegate_; +WebFrame* WebViewImpl::mainFrame() { + return main_frame(); } -WebFrame* WebViewImpl::GetMainFrame() { - return main_frame(); +WebFrame* WebViewImpl::findFrameByName(const WebString& name) { + String name_str = webkit_glue::WebStringToString(name); + Frame* frame = page_->mainFrame()->tree()->find(name_str); + return frame ? WebFrameImpl::FromFrame(frame) : NULL; } -WebFrame* WebViewImpl::GetFocusedFrame() { +WebFrame* WebViewImpl::focusedFrame() { Frame* frame = GetFocusedWebCoreFrame(); return frame ? WebFrameImpl::FromFrame(frame) : NULL; } -void WebViewImpl::SetFocusedFrame(WebFrame* frame) { +void WebViewImpl::setFocusedFrame(WebFrame* frame) { if (!frame) { // Clears the focused frame if any. Frame* frame = GetFocusedWebCoreFrame(); @@ -1290,37 +1319,28 @@ void WebViewImpl::SetFocusedFrame(WebFrame* frame) { webcore_frame->page()->focusController()->setFocusedFrame(webcore_frame); } -WebFrame* WebViewImpl::GetFrameWithName(const WebString& name) { - String name_str = webkit_glue::WebStringToString(name); - Frame* frame = page_->mainFrame()->tree()->find(name_str); - return frame ? WebFrameImpl::FromFrame(frame) : NULL; -} - -WebFrame* WebViewImpl::GetPreviousFrameBefore(WebFrame* frame, bool wrap) { - WebFrameImpl* frame_impl = static_cast<WebFrameImpl*>(frame); - WebCore::Frame* previous = - frame_impl->frame()->tree()->traversePreviousWithWrap(wrap); - return previous ? WebFrameImpl::FromFrame(previous) : NULL; -} - -WebFrame* WebViewImpl::GetNextFrameAfter(WebFrame* frame, bool wrap) { - WebFrameImpl* frame_impl = static_cast<WebFrameImpl*>(frame); - WebCore::Frame* next = - frame_impl->frame()->tree()->traverseNextWithWrap(wrap); - return next ? WebFrameImpl::FromFrame(next) : NULL; -} - -// TODO(darin): these navigation methods should be killed +void WebViewImpl::setInitialFocus(bool reverse) { + if (!page_.get()) + return; -void WebViewImpl::StopLoading() { - main_frame()->stopLoading(); -} + // Since we don't have a keyboard event, we'll create one. + WebKeyboardEvent keyboard_event; + keyboard_event.type = WebInputEvent::RawKeyDown; + if (reverse) + keyboard_event.modifiers = WebInputEvent::ShiftKey; -void WebViewImpl::SetBackForwardListSize(int size) { - page_->backForwardList()->setCapacity(size); + // VK_TAB which is only defined on Windows. + keyboard_event.windowsKeyCode = 0x09; + PlatformKeyboardEventBuilder platform_event(keyboard_event); + RefPtr<KeyboardEvent> webkit_event = + KeyboardEvent::create(platform_event, NULL); + page()->focusController()->setInitialFocus( + reverse ? WebCore::FocusDirectionBackward : + WebCore::FocusDirectionForward, + webkit_event.get()); } -void WebViewImpl::ClearFocusedNode() { +void WebViewImpl::clearFocusedNode() { if (!page_.get()) return; @@ -1353,64 +1373,7 @@ void WebViewImpl::ClearFocusedNode() { } } -void WebViewImpl::SetInitialFocus(bool reverse) { - if (page_.get()) { - // Since we don't have a keyboard event, we'll create one. - WebKeyboardEvent keyboard_event; - keyboard_event.type = WebInputEvent::RawKeyDown; - if (reverse) - keyboard_event.modifiers = WebInputEvent::ShiftKey; - // VK_TAB which is only defined on Windows. - keyboard_event.windowsKeyCode = 0x09; - PlatformKeyboardEventBuilder platform_event(keyboard_event); - RefPtr<KeyboardEvent> webkit_event = - KeyboardEvent::create(platform_event, NULL); - page()->focusController()->setInitialFocus( - reverse ? WebCore::FocusDirectionBackward : - WebCore::FocusDirectionForward, - webkit_event.get()); - } -} - -WebSettings* WebViewImpl::GetSettings() { - if (!web_settings_.get()) - web_settings_.reset(new WebSettingsImpl(page_->settings())); - DCHECK(web_settings_.get()); - return web_settings_.get(); -} - -const std::wstring& WebViewImpl::GetInspectorSettings() const { - return inspector_settings_; -} - -void WebViewImpl::SetInspectorSettings(const std::wstring& settings) { - inspector_settings_ = settings; -} - -// Set the encoding of the current main frame to the one selected by -// a user in the encoding menu. -void WebViewImpl::SetPageEncoding(const std::string& encoding_name) { - if (!page_.get()) - return; - - // Only change override encoding, don't change default encoding. - // Note that the new encoding must be NULL if it isn't supposed to be set. - String new_encoding_name; - if (!encoding_name.empty()) - new_encoding_name = webkit_glue::StdStringToString(encoding_name); - page_->mainFrame()->loader()->reloadWithOverrideEncoding(new_encoding_name); -} - -// Return the canonical encoding name of current main webframe in webview. -std::string WebViewImpl::GetMainFrameEncodingName() { - if (!page_.get()) - return std::string(); - - String encoding_name = page_->mainFrame()->loader()->encoding(); - return webkit_glue::StringToStdString(encoding_name); -} - -void WebViewImpl::ZoomIn(bool text_only) { +void WebViewImpl::zoomIn(bool text_only) { Frame* frame = main_frame()->frame(); double multiplier = std::min(std::pow(kTextSizeMultiplierRatio, zoom_level_ + 1), @@ -1422,7 +1385,7 @@ void WebViewImpl::ZoomIn(bool text_only) { } } -void WebViewImpl::ZoomOut(bool text_only) { +void WebViewImpl::zoomOut(bool text_only) { Frame* frame = main_frame()->frame(); double multiplier = std::max(std::pow(kTextSizeMultiplierRatio, zoom_level_ - 1), @@ -1434,7 +1397,7 @@ void WebViewImpl::ZoomOut(bool text_only) { } } -void WebViewImpl::ResetZoom() { +void WebViewImpl::zoomDefault() { // We don't change the zoom mode (text only vs. full page) here. We just want // to reset whatever is already set. zoom_level_ = 0; @@ -1443,11 +1406,12 @@ void WebViewImpl::ResetZoom() { main_frame()->frame()->isZoomFactorTextOnly()); } -void WebViewImpl::CopyImageAt(int x, int y) { +void WebViewImpl::copyImageAt(const WebPoint& point) { if (!page_.get()) return; - HitTestResult result = HitTestResultForWindowPos(IntPoint(x, y)); + HitTestResult result = + HitTestResultForWindowPos(webkit_glue::WebPointToIntPoint(point)); if (result.absoluteImageURL().isEmpty()) { // There isn't actually an image at these coordinates. Might be because @@ -1463,27 +1427,7 @@ void WebViewImpl::CopyImageAt(int x, int y) { page_->mainFrame()->editor()->copyImage(result); } -void WebViewImpl::InspectElement(int x, int y) { - if (!page_.get()) - return; - - if (x == -1 || y == -1) { - page_->inspectorController()->inspect(NULL); - } else { - HitTestResult result = HitTestResultForWindowPos(IntPoint(x, y)); - - if (!result.innerNonSharedNode()) - return; - - page_->inspectorController()->inspect(result.innerNonSharedNode()); - } -} - -void WebViewImpl::ShowJavaScriptConsole() { - page_->inspectorController()->showPanel(InspectorController::ConsolePanel); -} - -void WebViewImpl::DragSourceEndedAt( +void WebViewImpl::dragSourceEndedAt( const WebPoint& client_point, const WebPoint& screen_point, WebDragOperation operation) { @@ -1495,7 +1439,7 @@ void WebViewImpl::DragSourceEndedAt( static_cast<WebCore::DragOperation>(operation)); } -void WebViewImpl::DragSourceMovedTo( +void WebViewImpl::dragSourceMovedTo( const WebPoint& client_point, const WebPoint& screen_point) { PlatformMouseEvent pme(webkit_glue::WebPointToIntPoint(client_point), @@ -1505,7 +1449,7 @@ void WebViewImpl::DragSourceMovedTo( page_->mainFrame()->eventHandler()->dragSourceMovedTo(pme); } -void WebViewImpl::DragSourceSystemDragEnded() { +void WebViewImpl::dragSourceSystemDragEnded() { // It's possible for us to get this callback while not doing a drag if // it's from a previous page that got unloaded. if (doing_drag_and_drop_) { @@ -1514,12 +1458,11 @@ void WebViewImpl::DragSourceSystemDragEnded() { } } -WebDragOperation WebViewImpl::DragTargetDragEnter( - const WebDragData& web_drag_data, - int identity, +WebDragOperation WebViewImpl::dragTargetDragEnter( + const WebDragData& web_drag_data, int identity, const WebPoint& client_point, const WebPoint& screen_point, - WebDragOperation operations_allowed) { + WebDragOperationsMask operations_allowed) { DCHECK(!current_drag_data_.get()); current_drag_data_ = @@ -1550,10 +1493,10 @@ WebDragOperation WebViewImpl::DragTargetDragEnter( return drag_operation_; } -WebDragOperation WebViewImpl::DragTargetDragOver( +WebDragOperation WebViewImpl::dragTargetDragOver( const WebPoint& client_point, const WebPoint& screen_point, - WebDragOperation operations_allowed) { + WebDragOperationsMask operations_allowed) { DCHECK(current_drag_data_.get()); operations_allowed_ = operations_allowed; @@ -1580,7 +1523,7 @@ WebDragOperation WebViewImpl::DragTargetDragOver( return drag_operation_; } -void WebViewImpl::DragTargetDragLeave() { +void WebViewImpl::dragTargetDragLeave() { DCHECK(current_drag_data_.get()); DragData drag_data( @@ -1599,9 +1542,8 @@ void WebViewImpl::DragTargetDragLeave() { drag_identity_ = 0; } -void WebViewImpl::DragTargetDrop( - const WebPoint& client_point, - const WebPoint& screen_point) { +void WebViewImpl::dragTargetDrop(const WebPoint& client_point, + const WebPoint& screen_point) { DCHECK(current_drag_data_.get()); // If this webview transitions from the "drop accepting" state to the "not @@ -1612,7 +1554,7 @@ void WebViewImpl::DragTargetDrop( // proceed if our webview drag_operation_ state is not DragOperationNone. if (drag_operation_ == WebDragOperationNone) { // IPC RACE CONDITION: do not allow this drop. - DragTargetDragLeave(); + dragTargetDragLeave(); return; } @@ -1632,12 +1574,71 @@ void WebViewImpl::DragTargetDrop( drag_identity_ = 0; } -int32 WebViewImpl::GetDragIdentity() { +int WebViewImpl::dragIdentity() { if (drag_target_dispatch_) return drag_identity_; return 0; } +void WebViewImpl::inspectElementAt(const WebPoint& point) { + if (!page_.get()) + return; + + if (point.x == -1 || point.y == -1) { + page_->inspectorController()->inspect(NULL); + } else { + HitTestResult result = + HitTestResultForWindowPos(webkit_glue::WebPointToIntPoint(point)); + + if (!result.innerNonSharedNode()) + return; + + page_->inspectorController()->inspect(result.innerNonSharedNode()); + } +} + +// WebView -------------------------------------------------------------------- + +WebViewDelegate* WebViewImpl::GetDelegate() { + return delegate_; +} + +WebFrame* WebViewImpl::GetPreviousFrameBefore(WebFrame* frame, bool wrap) { + WebFrameImpl* frame_impl = static_cast<WebFrameImpl*>(frame); + WebCore::Frame* previous = + frame_impl->frame()->tree()->traversePreviousWithWrap(wrap); + return previous ? WebFrameImpl::FromFrame(previous) : NULL; +} + +WebFrame* WebViewImpl::GetNextFrameAfter(WebFrame* frame, bool wrap) { + WebFrameImpl* frame_impl = static_cast<WebFrameImpl*>(frame); + WebCore::Frame* next = + frame_impl->frame()->tree()->traverseNextWithWrap(wrap); + return next ? WebFrameImpl::FromFrame(next) : NULL; +} + +// TODO(darin): these navigation methods should be killed + +void WebViewImpl::StopLoading() { + main_frame()->stopLoading(); +} + +void WebViewImpl::SetBackForwardListSize(int size) { + page_->backForwardList()->setCapacity(size); +} + +const std::wstring& WebViewImpl::GetInspectorSettings() const { + return inspector_settings_; +} + +void WebViewImpl::SetInspectorSettings(const std::wstring& settings) { + inspector_settings_ = settings; +} + +void WebViewImpl::ShowJavaScriptConsole() { + page_->inspectorController()->showPanel(InspectorController::ConsolePanel); +} + bool WebViewImpl::SetDropEffect(bool accept) { if (drag_target_dispatch_) { drop_effect_ = accept ? DROP_EFFECT_COPY : DROP_EFFECT_NONE; diff --git a/webkit/glue/webview_impl.h b/webkit/glue/webview_impl.h index 165b6bd..9444cff 100644 --- a/webkit/glue/webview_impl.h +++ b/webkit/glue/webview_impl.h @@ -81,56 +81,58 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { virtual void setTextDirection(WebKit::WebTextDirection direction); // WebView methods: - virtual void InitializeMainFrame(WebKit::WebFrameClient* frame_client); - virtual bool ShouldClose(); - virtual void ClosePage(); - virtual WebViewDelegate* GetDelegate(); - virtual void SetTabKeyCyclesThroughElements(bool value); - virtual WebKit::WebFrame* GetMainFrame(); - virtual WebKit::WebFrame* GetFocusedFrame(); - virtual void SetFocusedFrame(WebKit::WebFrame* frame); - virtual WebKit::WebFrame* GetFrameWithName(const WebKit::WebString& name); - virtual WebKit::WebFrame* GetPreviousFrameBefore(WebKit::WebFrame* frame, - bool wrap); - virtual WebKit::WebFrame* GetNextFrameAfter(WebKit::WebFrame* frame, - bool wrap); - virtual void ClearFocusedNode(); - virtual void StopLoading(); - virtual void SetBackForwardListSize(int size); - virtual void SetInitialFocus(bool reverse); - virtual WebKit::WebSettings* GetSettings(); - virtual const std::wstring& GetInspectorSettings() const; - virtual void SetInspectorSettings(const std::wstring& settings); - virtual void SetPageEncoding(const std::string& encoding_name); - virtual std::string GetMainFrameEncodingName(); - virtual void ZoomIn(bool text_only); - virtual void ZoomOut(bool text_only); - virtual void ResetZoom(); - virtual void CopyImageAt(int x, int y); - virtual void InspectElement(int x, int y); - virtual void ShowJavaScriptConsole(); - virtual void DragSourceEndedAt( + virtual WebKit::WebSettings* settings(); + virtual WebKit::WebString pageEncoding() const; + virtual void setPageEncoding(const WebKit::WebString& encoding); + virtual bool dispatchBeforeUnloadEvent(); + virtual void dispatchUnloadEvent(); + virtual WebKit::WebFrame* mainFrame(); + virtual WebKit::WebFrame* findFrameByName(const WebKit::WebString& name); + virtual WebKit::WebFrame* focusedFrame(); + virtual void setFocusedFrame(WebKit::WebFrame* frame); + virtual void setInitialFocus(bool reverse); + virtual void clearFocusedNode(); + virtual void zoomIn(bool text_only); + virtual void zoomOut(bool text_only); + virtual void zoomDefault(); + virtual void copyImageAt(const WebKit::WebPoint& point); + virtual void dragSourceEndedAt( const WebKit::WebPoint& client_point, const WebKit::WebPoint& screen_point, WebKit::WebDragOperation operation); - virtual void DragSourceMovedTo( + virtual void dragSourceMovedTo( const WebKit::WebPoint& client_point, const WebKit::WebPoint& screen_point); - virtual void DragSourceSystemDragEnded(); - virtual WebKit::WebDragOperation DragTargetDragEnter( + virtual void dragSourceSystemDragEnded(); + virtual WebKit::WebDragOperation dragTargetDragEnter( const WebKit::WebDragData& drag_data, int identity, const WebKit::WebPoint& client_point, const WebKit::WebPoint& screen_point, WebKit::WebDragOperationsMask operations_allowed); - virtual WebKit::WebDragOperation DragTargetDragOver( + virtual WebKit::WebDragOperation dragTargetDragOver( const WebKit::WebPoint& client_point, const WebKit::WebPoint& screen_point, WebKit::WebDragOperationsMask operations_allowed); - virtual void DragTargetDragLeave(); - virtual void DragTargetDrop( + virtual void dragTargetDragLeave(); + virtual void dragTargetDrop( const WebKit::WebPoint& client_point, const WebKit::WebPoint& screen_point); - virtual int32 GetDragIdentity(); + virtual int dragIdentity(); + virtual void inspectElementAt(const WebKit::WebPoint& point); + + // WebView methods: + virtual void InitializeMainFrame(WebKit::WebFrameClient* frame_client); + virtual WebViewDelegate* GetDelegate(); + virtual void SetTabKeyCyclesThroughElements(bool value); + virtual WebKit::WebFrame* GetPreviousFrameBefore(WebKit::WebFrame* frame, + bool wrap); + virtual WebKit::WebFrame* GetNextFrameAfter(WebKit::WebFrame* frame, + bool wrap); + virtual void StopLoading(); + virtual void SetBackForwardListSize(int size); + virtual const std::wstring& GetInspectorSettings() const; + virtual void SetInspectorSettings(const std::wstring& settings); + virtual void ShowJavaScriptConsole(); virtual bool SetDropEffect(bool accept); virtual void AutofillSuggestionsForNode( int64 node_id, diff --git a/webkit/glue/webworker_impl.cc b/webkit/glue/webworker_impl.cc index ada6864..520389a 100644 --- a/webkit/glue/webworker_impl.cc +++ b/webkit/glue/webworker_impl.cc @@ -143,8 +143,7 @@ void WebWorkerImpl::startWorkerContext(const WebURL& script_url, WebPreferences().Apply(web_view_); web_view_->InitializeMainFrame(WorkerWebFrameClient::GetSharedInstance()); - WebFrameImpl* web_frame = - static_cast<WebFrameImpl*>(web_view_->GetMainFrame()); + WebFrameImpl* web_frame = static_cast<WebFrameImpl*>(web_view_->mainFrame()); // Construct substitute data source for the 'shadow page'. We only need it // to have same origin as the worker so the loading checks work correctly. diff --git a/webkit/tools/test_shell/drag_delegate.cc b/webkit/tools/test_shell/drag_delegate.cc index d9c45cd..0fc97a3 100644 --- a/webkit/tools/test_shell/drag_delegate.cc +++ b/webkit/tools/test_shell/drag_delegate.cc @@ -35,7 +35,7 @@ void TestDragDelegate::OnDragSourceDrop() { gfx::Point client; gfx::Point screen; GetCursorPositions(source_hwnd_, &client, &screen); - webview_->DragSourceEndedAt(client, screen, WebKit::WebDragOperationCopy); + webview_->dragSourceEndedAt(client, screen, WebKit::WebDragOperationCopy); // TODO(snej): Pass the real drag operation instead } @@ -43,5 +43,5 @@ void TestDragDelegate::OnDragSourceMove() { gfx::Point client; gfx::Point screen; GetCursorPositions(source_hwnd_, &client, &screen); - webview_->DragSourceMovedTo(client, screen); + webview_->dragSourceMovedTo(client, screen); } diff --git a/webkit/tools/test_shell/drop_delegate.cc b/webkit/tools/test_shell/drop_delegate.cc index ce0e0dc6..d7d3934 100644 --- a/webkit/tools/test_shell/drop_delegate.cc +++ b/webkit/tools/test_shell/drop_delegate.cc @@ -24,7 +24,7 @@ DWORD TestDropDelegate::OnDragEnter(IDataObject* data_object, POINT client_pt = cursor_position; ScreenToClient(GetHWND(), &client_pt); - WebDragOperation op = webview_->DragTargetDragEnter( + WebDragOperation op = webview_->dragTargetDragEnter( drop_data.ToDragData(), drop_data.identity, WebPoint(client_pt.x, client_pt.y), WebPoint(cursor_position.x, cursor_position.y), @@ -40,7 +40,7 @@ DWORD TestDropDelegate::OnDragOver(IDataObject* data_object, DWORD effect) { POINT client_pt = cursor_position; ScreenToClient(GetHWND(), &client_pt); - WebDragOperation op = webview_->DragTargetDragOver( + WebDragOperation op = webview_->dragTargetDragOver( WebPoint(client_pt.x, client_pt.y), WebPoint(cursor_position.x, cursor_position.y), WebDragOperationCopy); @@ -50,7 +50,7 @@ DWORD TestDropDelegate::OnDragOver(IDataObject* data_object, } void TestDropDelegate::OnDragLeave(IDataObject* data_object) { - webview_->DragTargetDragLeave(); + webview_->dragTargetDragLeave(); } DWORD TestDropDelegate::OnDrop(IDataObject* data_object, @@ -59,7 +59,7 @@ DWORD TestDropDelegate::OnDrop(IDataObject* data_object, DWORD effect) { POINT client_pt = cursor_position; ScreenToClient(GetHWND(), &client_pt); - webview_->DragTargetDrop( + webview_->dragTargetDrop( WebPoint(client_pt.x, client_pt.y), WebPoint(cursor_position.x, cursor_position.y)); diff --git a/webkit/tools/test_shell/event_sending_controller.cc b/webkit/tools/test_shell/event_sending_controller.cc index 6d24a52..4333ac0 100644 --- a/webkit/tools/test_shell/event_sending_controller.cc +++ b/webkit/tools/test_shell/event_sending_controller.cc @@ -233,7 +233,7 @@ void EventSendingController::DoDragDrop(const WebKit::WebPoint &event_pos, WebPoint screen_point(event.globalX, event.globalY); current_drag_data = drag_data; current_drag_effects_allowed = mask; - current_drag_effect = webview()->DragTargetDragEnter( + current_drag_effect = webview()->dragTargetDragEnter( drag_data, 0, client_point, screen_point, current_drag_effects_allowed); // Finish processing events. @@ -334,17 +334,16 @@ void EventSendingController::mouseUp( WebPoint client_point(e.x, e.y); WebPoint screen_point(e.globalX, e.globalY); - webview()->DragSourceMovedTo(client_point, screen_point); - current_drag_effect = webview()->DragTargetDragOver(client_point, - screen_point, - current_drag_effects_allowed); + webview()->dragSourceMovedTo(client_point, screen_point); + current_drag_effect = webview()->dragTargetDragOver( + client_point, screen_point, current_drag_effects_allowed); if (current_drag_effect) { - webview()->DragTargetDrop(client_point, screen_point); + webview()->dragTargetDrop(client_point, screen_point); } else { - webview()->DragTargetDragLeave(); + webview()->dragTargetDragLeave(); } - webview()->DragSourceEndedAt(client_point, screen_point, - current_drag_effect); + webview()->dragSourceEndedAt( + client_point, screen_point, current_drag_effect); current_drag_data.reset(); } @@ -380,10 +379,9 @@ void EventSendingController::DoMouseMove(const WebMouseEvent& e) { WebPoint client_point(e.x, e.y); WebPoint screen_point(e.globalX, e.globalY); - webview()->DragSourceMovedTo(client_point, screen_point); - current_drag_effect = webview()->DragTargetDragOver( - client_point, screen_point, - current_drag_effects_allowed); + webview()->dragSourceMovedTo(client_point, screen_point); + current_drag_effect = webview()->dragTargetDragOver( + client_point, screen_point, current_drag_effects_allowed); } } @@ -541,25 +539,25 @@ void EventSendingController::leapForward( // WebKit/WebView/WebView.mm) void EventSendingController::textZoomIn( const CppArgumentList& args, CppVariant* result) { - webview()->ZoomIn(true); + webview()->zoomIn(true); result->SetNull(); } void EventSendingController::textZoomOut( const CppArgumentList& args, CppVariant* result) { - webview()->ZoomOut(true); + webview()->zoomOut(true); result->SetNull(); } void EventSendingController::zoomPageIn( const CppArgumentList& args, CppVariant* result) { - webview()->ZoomIn(false); + webview()->zoomIn(false); result->SetNull(); } void EventSendingController::zoomPageOut( const CppArgumentList& args, CppVariant* result) { - webview()->ZoomOut(false); + webview()->zoomOut(false); result->SetNull(); } @@ -638,9 +636,9 @@ void EventSendingController::beginDragWithFiles( // Provide a drag source. WebPoint client_point(last_mouse_pos_.x(), last_mouse_pos_.y()); WebPoint screen_point(last_mouse_pos_.x(), last_mouse_pos_.y()); - webview()->DragTargetDragEnter(current_drag_data, 0, - client_point, screen_point, - current_drag_effects_allowed); + webview()->dragTargetDragEnter( + current_drag_data, 0, client_point, screen_point, + current_drag_effects_allowed); // dragMode saves events and then replays them later. We don't need/want that. dragMode.Set(false); diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index 2d0746e..bc88eb5 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -339,7 +339,7 @@ class WorkItemLoadingScript : public LayoutTestController::WorkItem { public: WorkItemLoadingScript(const string& script) : script_(script) {} bool Run(TestShell* shell) { - shell->webView()->GetMainFrame()->executeScript( + shell->webView()->mainFrame()->executeScript( WebScriptSource(WebString::fromUTF8(script_))); return true; // TODO(darin): Did it really start a navigation? } @@ -351,7 +351,7 @@ class WorkItemNonLoadingScript : public LayoutTestController::WorkItem { public: WorkItemNonLoadingScript(const string& script) : script_(script) {} bool Run(TestShell* shell) { - shell->webView()->GetMainFrame()->executeScript( + shell->webView()->mainFrame()->executeScript( WebScriptSource(WebString::fromUTF8(script_))); return false; } @@ -389,7 +389,7 @@ class WorkItemLoad : public LayoutTestController::WorkItem { void LayoutTestController::queueLoad( const CppArgumentList& args, CppVariant* result) { if (args.size() > 0 && args[0].isString()) { - GURL current_url = shell_->webView()->GetMainFrame()->url(); + GURL current_url = shell_->webView()->mainFrame()->url(); GURL full_url = current_url.Resolve(args[0].ToString()); string target = ""; @@ -413,7 +413,7 @@ void LayoutTestController::objCIdentityIsEqual( void LayoutTestController::Reset() { if (shell_) { - shell_->webView()->ResetZoom(); + shell_->webView()->zoomDefault(); shell_->webView()->SetTabKeyCyclesThroughElements(true); } dump_as_text_ = false; @@ -552,7 +552,7 @@ void LayoutTestController::execCommand( value = args[2].ToString(); // Note: webkit's version does not return the boolean, so neither do we. - shell_->webView()->GetFocusedFrame()->executeCommand( + shell_->webView()->focusedFrame()->executeCommand( WebString::fromUTF8(command), WebString::fromUTF8(value)); } result->SetNull(); @@ -566,7 +566,7 @@ void LayoutTestController::isCommandEnabled( } std::string command = args[0].ToString(); - bool rv = shell_->webView()->GetFocusedFrame()->isCommandEnabled( + bool rv = shell_->webView()->focusedFrame()->isCommandEnabled( WebString::fromUTF8(command)); result->Set(rv); } @@ -824,7 +824,7 @@ void LayoutTestController::evaluateScriptInIsolatedWorld( const CppArgumentList& args, CppVariant* result) { if (args.size() > 0 && args[0].isString()) { WebScriptSource source(WebString::fromUTF8(args[0].ToString())); - shell_->webView()->GetMainFrame()->executeScriptInNewWorld(&source, 1, 1); + shell_->webView()->mainFrame()->executeScriptInNewWorld(&source, 1, 1); } result->SetNull(); } diff --git a/webkit/tools/test_shell/plugin_tests.cc b/webkit/tools/test_shell/plugin_tests.cc index 3c07a07..7f7214e 100644 --- a/webkit/tools/test_shell/plugin_tests.cc +++ b/webkit/tools/test_shell/plugin_tests.cc @@ -100,22 +100,22 @@ TEST_F(PluginTest, Refresh) { // test plugin from a previous test. DeleteTestPlugin(); ASSERT_FALSE(file_util::PathExists(plugin_file_path_)); - test_shell_->webView()->GetMainFrame()->executeScript(refresh); + test_shell_->webView()->mainFrame()->executeScript(refresh); - test_shell_->webView()->GetMainFrame()->loadHTMLString( + test_shell_->webView()->mainFrame()->loadHTMLString( html, GURL("about:blank")); test_shell_->WaitTestFinished(); std::string text; - test_shell_->webView()->GetMainFrame()->executeScript(call_check); - text = test_shell_->webView()->GetMainFrame()->contentAsText(10000).utf8(); + test_shell_->webView()->mainFrame()->executeScript(call_check); + text = test_shell_->webView()->mainFrame()->contentAsText(10000).utf8(); ASSERT_EQ(text, "FAIL"); CopyTestPlugin(); - test_shell_->webView()->GetMainFrame()->executeScript(refresh); - test_shell_->webView()->GetMainFrame()->executeScript(call_check); - text = test_shell_->webView()->GetMainFrame()->contentAsText(10000).utf8(); + test_shell_->webView()->mainFrame()->executeScript(refresh); + test_shell_->webView()->mainFrame()->executeScript(call_check); + text = test_shell_->webView()->mainFrame()->contentAsText(10000).utf8(); ASSERT_EQ(text, "DONE"); } @@ -139,12 +139,12 @@ TEST_F(PluginTest, DefaultPluginLoadTest) { </DIV>\ "; - test_shell_->webView()->GetMainFrame()->loadHTMLString( + test_shell_->webView()->mainFrame()->loadHTMLString( html, GURL("about:blank")); test_shell_->WaitTestFinished(); std::string text = - test_shell_->webView()->GetMainFrame()->contentAsText(10000).utf8(); + test_shell_->webView()->mainFrame()->contentAsText(10000).utf8(); ASSERT_EQ(true, StartsWithASCII(text, "DONE", true)); } #endif @@ -188,7 +188,7 @@ TEST_F(PluginTest, PluginVisibilty) { test_shell_->LoadFile(test_html); test_shell_->WaitTestFinished(); - WebFrame* main_frame = test_shell_->webView()->GetMainFrame(); + WebFrame* main_frame = test_shell_->webView()->mainFrame(); HWND frame_hwnd = test_shell_->webViewWnd(); HWND plugin_hwnd = NULL; EnumChildWindows(frame_hwnd, EnumChildProc, diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc index 46de77b..cce4997 100644 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -196,7 +196,7 @@ void TestShell::Dump(TestShell* shell) { printf("#URL:%s\n", params->test_url.c_str()); // Dump the requested representation. - WebFrame* frame = shell->webView()->GetMainFrame(); + WebFrame* frame = shell->webView()->mainFrame(); if (frame) { bool should_dump_as_text = shell->layout_test_controller_->ShouldDumpAsText(); @@ -486,7 +486,7 @@ void TestShell::DumpBackForwardList(std::wstring* result) { } void TestShell::CallJSGC() { - webView()->GetMainFrame()->collectGarbage(); + webView()->mainFrame()->collectGarbage(); } WebView* TestShell::CreateWebView() { @@ -530,9 +530,9 @@ void TestShell::LoadURL(const GURL& url) { bool TestShell::Navigate(const TestNavigationEntry& entry, bool reload) { // Get the right target frame for the entry. - WebFrame* frame = webView()->GetMainFrame(); + WebFrame* frame = webView()->mainFrame(); if (!entry.GetTargetFrame().empty()) { - frame = webView()->GetFrameWithName( + frame = webView()->findFrameByName( WideToUTF16Hack(entry.GetTargetFrame())); } // TODO(mpcomplete): should we clear the target frame, or should @@ -567,7 +567,7 @@ bool TestShell::Navigate(const TestNavigationEntry& entry, bool reload) { // iframe would keep focus when the SetFocus called immediately after // LoadRequest, thus making some tests fail (see http://b/issue?id=845337 // for more details). - webView()->SetFocusedFrame(frame); + webView()->setFocusedFrame(frame); SetFocus(webViewHost(), true); return true; @@ -583,7 +583,7 @@ void TestShell::DumpDocumentText() { return; const std::string data = - WideToUTF8(webkit_glue::DumpDocumentText(webView()->GetMainFrame())); + WideToUTF8(webkit_glue::DumpDocumentText(webView()->mainFrame())); file_util::WriteFile(file_path, data.c_str(), data.length()); } @@ -593,12 +593,12 @@ void TestShell::DumpRenderTree() { return; const std::string data = - WideToUTF8(webkit_glue::DumpRenderer(webView()->GetMainFrame())); + WideToUTF8(webkit_glue::DumpRenderer(webView()->mainFrame())); file_util::WriteFile(file_path, data.c_str(), data.length()); } std::wstring TestShell::GetDocumentText() { - return webkit_glue::DumpDocumentText(webView()->GetMainFrame()); + return webkit_glue::DumpDocumentText(webView()->mainFrame()); } void TestShell::Reload() { diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc index e4c0b19..c9319ab 100644 --- a/webkit/tools/test_shell/test_shell_gtk.cc +++ b/webkit/tools/test_shell/test_shell_gtk.cc @@ -23,6 +23,7 @@ #include "grit/webkit_resources.h" #include "net/base/mime_util.h" #include "net/base/net_util.h" +#include "webkit/api/public/WebPoint.h" #include "webkit/glue/plugins/plugin_list.h" #include "webkit/glue/resource_loader_bridge.h" #include "webkit/glue/webkit_glue.h" @@ -31,6 +32,7 @@ #include "webkit/tools/test_shell/test_navigation_controller.h" #include "webkit/tools/test_shell/test_webview_delegate.h" +using WebKit::WebPoint; using WebKit::WebWidget; namespace { @@ -114,7 +116,7 @@ gboolean DumpRenderTreeActivated(GtkWidget* widget, TestShell* shell) { // Callback for Debug > Show web inspector... menu item. gboolean ShowWebInspectorActivated(GtkWidget* widget, TestShell* shell) { - shell->webView()->InspectElement(0, 0); + shell->webView()->inspectElementAt(WebPoint()); return FALSE; // Don't stop this message. } diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index ab3aa12f..c7b1e27 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -517,7 +517,7 @@ void TestWebViewDelegate::startDragging( // ok_effect, &effect); //DCHECK(DRAGDROP_S_DROP == res || DRAGDROP_S_CANCEL == res); } - shell_->webView()->DragSourceSystemDragEnded(); + shell_->webView()->dragSourceSystemDragEnded(); } void TestWebViewDelegate::navigateBackForwardSoon(int offset) { @@ -965,16 +965,16 @@ void TestWebViewDelegate::WaitForPolicyDelegate() { // Private methods ----------------------------------------------------------- void TestWebViewDelegate::UpdateAddressBar(WebView* webView) { - WebFrame* mainFrame = webView->GetMainFrame(); + WebFrame* main_frame = webView->mainFrame(); - WebDataSource* dataSource = mainFrame->dataSource(); - if (!dataSource) - dataSource = mainFrame->provisionalDataSource(); - if (!dataSource) + WebDataSource* data_source = main_frame->dataSource(); + if (!data_source) + data_source = main_frame->provisionalDataSource(); + if (!data_source) return; // TODO(abarth): This is wrong! - SetAddressBarURL(dataSource->request().firstPartyForCookies()); + SetAddressBarURL(data_source->request().firstPartyForCookies()); } void TestWebViewDelegate::LocationChangeDone(WebFrame* frame) { @@ -1058,7 +1058,7 @@ void TestWebViewDelegate::UpdateSessionHistory(WebFrame* frame) { return; const WebHistoryItem& history_item = - shell_->webView()->GetMainFrame()->previousHistoryItem(); + shell_->webView()->mainFrame()->previousHistoryItem(); if (history_item.isNull()) return; @@ -1068,7 +1068,7 @@ void TestWebViewDelegate::UpdateSessionHistory(WebFrame* frame) { std::wstring TestWebViewDelegate::GetFrameDescription(WebFrame* webframe) { std::wstring name = UTF16ToWideHack(webframe->name()); - if (webframe == shell_->webView()->GetMainFrame()) { + if (webframe == shell_->webView()->mainFrame()) { if (name.length()) return L"main frame \"" + name + L"\""; else diff --git a/webkit/tools/test_shell/test_webview_delegate_gtk.cc b/webkit/tools/test_shell/test_webview_delegate_gtk.cc index c73d62a..8ba512b 100644 --- a/webkit/tools/test_shell/test_webview_delegate_gtk.cc +++ b/webkit/tools/test_shell/test_webview_delegate_gtk.cc @@ -59,9 +59,9 @@ void SelectionClipboardGetContents(GtkClipboard* clipboard, return; WebView* webview = static_cast<WebView*>(data); - WebFrame* frame = webview->GetFocusedFrame(); + WebFrame* frame = webview->focusedFrame(); if (!frame) - frame = webview->GetMainFrame(); + frame = webview->mainFrame(); DCHECK(frame); std::string selection; diff --git a/webkit/tools/test_shell/text_input_controller.cc b/webkit/tools/test_shell/text_input_controller.cc index 8ab7576..529fb61 100644 --- a/webkit/tools/test_shell/text_input_controller.cc +++ b/webkit/tools/test_shell/text_input_controller.cc @@ -41,7 +41,7 @@ TextInputController::TextInputController(TestShell* shell) { // static WebFrame* TextInputController::GetMainFrame() { - return shell_->webView()->GetMainFrame(); + return shell_->webView()->mainFrame(); } void TextInputController::insertText( diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp index 02eaadb..a2b8622 100644 --- a/webkit/webkit.gyp +++ b/webkit/webkit.gyp @@ -118,6 +118,7 @@ 'api/public/WebURLRequest.h', 'api/public/WebURLResponse.h', 'api/public/WebVector.h', + 'api/public/WebView.h', 'api/public/WebViewClient.h', 'api/public/WebWidget.h', 'api/public/WebWidgetClient.h', |