diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-16 05:11:05 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-16 05:11:05 +0000 |
commit | 05158051ea881677c03a22ddf38a3e6779cebb9e (patch) | |
tree | 95c6756227e0bbea55da3c4b19abdf99d7eb3ebe /chrome/renderer/render_view.cc | |
parent | 6c14b76fede6abc592d9d65965fbdf4626e83efe (diff) | |
download | chromium_src-05158051ea881677c03a22ddf38a3e6779cebb9e.zip chromium_src-05158051ea881677c03a22ddf38a3e6779cebb9e.tar.gz chromium_src-05158051ea881677c03a22ddf38a3e6779cebb9e.tar.bz2 |
Use WebWidget from the WebKit API. This change also makes
use of WebKitClient (replacing WebWidgetDelegate from glue).
The ripple effects of this change are rather large, but most
of the impact is mechanical.
The more interesting changes include:
1- Removing the WebWidget parameter from WebWidgetClient methods. This didn't
matter at all to RenderWidget or RenderView, but it did cause some changes to
be made to TestWebViewDelegate. Now, it is not possible to share a delegate
implementation for both the WebView and a popup menu, so I have a second
instance of the delegate owned by TestShell for use with popup menus.
2- Plumbing WebNavigationPolicy in place of WindowOpenDisposition was getting
to be a pretty large change, so I stopped short of deleting WindowOpenDisposition.
That way the Chrome side can remain mostly unmodified. I then added a mapping
function to convert from WebNavigationPolicy to WindowOpenDisposition.
3- The IME methods on WebWidget were renamed (reviewed separately by hbono), and
there is now an enum to specify the composition command (WebCompositionCommand).
4- I added IPC serialization for WebCompositionCommand and WebTextDirection,
which cleaned up some code that was just using ints in IPC messages.
R=jam
BUG=16234
TEST=none
Review URL: http://codereview.chromium.org/149620
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20854 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_view.cc')
-rw-r--r-- | chrome/renderer/render_view.cc | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 15d7771..96cf524a 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -106,6 +106,7 @@ using WebKit::WebDataSource; using WebKit::WebDragData; using WebKit::WebForm; using WebKit::WebHistoryItem; +using WebKit::WebNavigationPolicy; using WebKit::WebNavigationType; using WebKit::WebPopupMenuInfo; using WebKit::WebRect; @@ -116,9 +117,10 @@ using WebKit::WebURL; using WebKit::WebURLError; using WebKit::WebURLRequest; using WebKit::WebURLResponse; +using WebKit::WebVector; +using WebKit::WebWidget; using WebKit::WebWorker; using WebKit::WebWorkerClient; -using WebKit::WebVector; //----------------------------------------------------------------------------- @@ -560,13 +562,13 @@ bool RenderView::CaptureThumbnail(WebView* view, double begin = time_util::GetHighResolutionTimeNow(); #endif - view->Layout(); - const WebSize& size = view->GetSize(); + view->layout(); + const WebSize& size = view->size(); skia::PlatformCanvas canvas; if (!canvas.initialize(size.width, size.height, true)) return false; - view->Paint(&canvas, WebRect(0, 0, size.width, size.height)); + view->paint(&canvas, WebRect(0, 0, size.width, size.height)); skia::BitmapPlatformDevice& device = static_cast<skia::BitmapPlatformDevice&>(canvas.getTopPlatformDevice()); @@ -1474,12 +1476,12 @@ void RenderView::DidCreateIsolatedScriptContext(WebFrame* webframe) { EventBindings::HandleContextCreated(webframe); } -WindowOpenDisposition RenderView::DispositionForNavigationAction( +WebNavigationPolicy RenderView::PolicyForNavigationAction( WebView* webview, WebFrame* frame, const WebURLRequest& request, WebNavigationType type, - WindowOpenDisposition disposition, + WebNavigationPolicy default_policy, bool is_redirect) { // A content initiated navigation may have originated from a link-click, // script, drag-n-drop operation, etc. @@ -1496,8 +1498,9 @@ WindowOpenDisposition RenderView::DispositionForNavigationAction( // to, for example, opening a new window). // But we sometimes navigate to about:blank to clear a tab, and we want to // still allow that. - if (disposition == CURRENT_TAB && is_content_initiated && - frame->GetParent() == NULL && !url.SchemeIs(chrome::kAboutScheme)) { + if (default_policy == WebKit::WebNavigationPolicyCurrentTab && + is_content_initiated && frame->GetParent() == NULL && + !url.SchemeIs(chrome::kAboutScheme)) { // When we received such unsolicited navigations, we sometimes want to // punt them up to the browser to handle. if (BindingsPolicy::is_dom_ui_enabled(enabled_bindings_) || @@ -1505,8 +1508,8 @@ WindowOpenDisposition RenderView::DispositionForNavigationAction( frame->GetInViewSourceMode() || url.SchemeIs(chrome::kViewSourceScheme) || url.SchemeIs(chrome::kPrintScheme)) { - OpenURL(webview, url, GURL(), disposition); - return IGNORE_ACTION; // Suppress the load here. + OpenURL(webview, url, GURL(), default_policy); + return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. } } @@ -1535,16 +1538,16 @@ WindowOpenDisposition RenderView::DispositionForNavigationAction( // Must not have issued the request from this page. is_content_initiated && // Must be targeted at the current tab. - disposition == CURRENT_TAB && + default_policy == WebKit::WebNavigationPolicyCurrentTab && // Must be a JavaScript navigation, which appears as "other". type == WebKit::WebNavigationTypeOther; if (is_fork) { // Open the URL via the browser, not via WebKit. - OpenURL(webview, url, GURL(), disposition); - return IGNORE_ACTION; + OpenURL(webview, url, GURL(), default_policy); + return WebKit::WebNavigationPolicyIgnore; } - return disposition; + return default_policy; } void RenderView::RunJavaScriptAlert(WebFrame* webframe, @@ -1884,8 +1887,9 @@ WebWorker* RenderView::CreateWebWorker(WebWorkerClient* client) { void RenderView::OpenURL(WebView* webview, const GURL& url, const GURL& referrer, - WindowOpenDisposition disposition) { - Send(new ViewHostMsg_OpenURL(routing_id_, url, referrer, disposition)); + WebNavigationPolicy policy) { + Send(new ViewHostMsg_OpenURL( + routing_id_, url, referrer, NavigationPolicyToDisposition(policy))); } void RenderView::DidContentsSizeChange(WebWidget* webwidget, @@ -1918,7 +1922,7 @@ void RenderView::DidContentsSizeChange(WebWidget* webwidget, // This method provides us with the information about how to display the newly // created RenderView (i.e., as a constrained popup or as a new tab). // -void RenderView::Show(WebWidget* webwidget, WindowOpenDisposition disposition) { +void RenderView::show(WebNavigationPolicy policy) { DCHECK(!did_show_) << "received extraneous Show call"; DCHECK(opener_id_ != MSG_ROUTING_NONE); @@ -1929,17 +1933,18 @@ void RenderView::Show(WebWidget* webwidget, WindowOpenDisposition disposition) { // NOTE: initial_pos_ may still have its default values at this point, but // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the // browser process will impose a default position otherwise. - Send(new ViewHostMsg_ShowView(opener_id_, routing_id_, disposition, - initial_pos_, opened_by_user_gesture_, creator_url_)); + Send(new ViewHostMsg_ShowView(opener_id_, routing_id_, + NavigationPolicyToDisposition(policy), initial_pos_, + opened_by_user_gesture_, creator_url_)); SetPendingWindowRect(initial_pos_); } -void RenderView::CloseWidgetSoon(WebWidget* webwidget) { +void RenderView::closeWidgetSoon() { if (!popup_notification_visible_) - RenderWidget::CloseWidgetSoon(webwidget); + RenderWidget::closeWidgetSoon(); } -void RenderView::RunModal(WebWidget* webwidget) { +void RenderView::runModal() { DCHECK(did_show_) << "should already have shown the view"; IPC::SyncMessage* msg = new ViewHostMsg_RunModal(routing_id_); @@ -2732,7 +2737,7 @@ void RenderView::OnThemeChanged() { #if defined(OS_WIN) gfx::NativeTheme::instance()->CloseHandles(); gfx::Rect view_rect(0, 0, size_.width(), size_.height()); - DidInvalidateRect(webwidget_, view_rect); + didInvalidateRect(view_rect); #else // defined(OS_WIN) // TODO(port): we don't support theming on non-Windows platforms yet NOTIMPLEMENTED(); @@ -3018,6 +3023,10 @@ void RenderView::FocusAccessibilityObject( #endif } +void RenderView::DidMovePlugin(const WebPluginGeometry& move) { + SchedulePluginMove(move); +} + void RenderView::SendPasswordForms(WebFrame* frame) { std::vector<WebForm> forms; frame->GetForms(&forms); |