summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-30 16:55:27 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-30 16:55:27 +0000
commit26aa04898e37692f354a9f97df01ff1fc7bbb14e (patch)
treed83f599bdc5083646ea70aec4c6906707e671b71 /webkit/glue
parentfbc805556ed3f7e15718313907481821ef6908b4 (diff)
downloadchromium_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
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/chrome_client_impl.cc3
-rw-r--r--webkit/glue/cpp_bound_class_unittest.cc2
-rw-r--r--webkit/glue/dom_operations.cc18
-rw-r--r--webkit/glue/dom_serializer_unittest.cc21
-rw-r--r--webkit/glue/iframe_redirect_unittest.cc2
-rw-r--r--webkit/glue/mimetype_unittest.cc2
-rw-r--r--webkit/glue/resource_fetcher_unittest.cc6
-rw-r--r--webkit/glue/webaccessibilitymanager_impl.cc2
-rw-r--r--webkit/glue/webdevtoolsagent_impl.cc2
-rw-r--r--webkit/glue/webframe_unittest.cc4
-rw-r--r--webkit/glue/webkit_glue.cc2
-rw-r--r--webkit/glue/webplugin_impl.cc2
-rw-r--r--webkit/glue/webpreferences.cc2
-rw-r--r--webkit/glue/webview.h111
-rw-r--r--webkit/glue/webview_impl.cc269
-rw-r--r--webkit/glue/webview_impl.h74
-rw-r--r--webkit/glue/webworker_impl.cc3
17 files changed, 208 insertions, 317 deletions
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.