| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/render_view.h" | 5 #include "content/renderer/render_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 decrement_shared_popup_at_destruction_ = true; | 367 decrement_shared_popup_at_destruction_ = true; |
| 368 } else { | 368 } else { |
| 369 shared_popup_counter_ = new SharedRenderViewCounter(0); | 369 shared_popup_counter_ = new SharedRenderViewCounter(0); |
| 370 decrement_shared_popup_at_destruction_ = false; | 370 decrement_shared_popup_at_destruction_ = false; |
| 371 } | 371 } |
| 372 | 372 |
| 373 notification_provider_ = new NotificationProvider(this); | 373 notification_provider_ = new NotificationProvider(this); |
| 374 | 374 |
| 375 render_thread_->AddRoute(routing_id_, this); | 375 render_thread_->AddRoute(routing_id_, this); |
| 376 // Take a reference on behalf of the RenderThread. This will be balanced | 376 // Take a reference on behalf of the RenderThread. This will be balanced |
| 377 // when we receive ViewMsg_Close. | 377 // when we receive ViewMsg_ClosePage. |
| 378 AddRef(); | 378 AddRef(); |
| 379 | 379 |
| 380 // If this is a popup, we must wait for the CreatingNew_ACK message before | 380 // If this is a popup, we must wait for the CreatingNew_ACK message before |
| 381 // completing initialization. Otherwise, we can finish it now. | 381 // completing initialization. Otherwise, we can finish it now. |
| 382 if (opener_id == MSG_ROUTING_NONE) { | 382 if (opener_id == MSG_ROUTING_NONE) { |
| 383 did_show_ = true; | 383 did_show_ = true; |
| 384 CompleteInit(parent_hwnd); | 384 CompleteInit(parent_hwnd); |
| 385 } | 385 } |
| 386 | 386 |
| 387 g_view_map.Get().insert(std::make_pair(webview(), this)); | 387 g_view_map.Get().insert(std::make_pair(webview(), this)); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) | 602 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) |
| 603 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) | 603 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) |
| 604 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) | 604 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) |
| 605 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) | 605 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) |
| 606 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) | 606 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) |
| 607 IPC_MESSAGE_HANDLER(ViewMsg_FindReplyACK, OnFindReplyAck) | 607 IPC_MESSAGE_HANDLER(ViewMsg_FindReplyACK, OnFindReplyAck) |
| 608 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 608 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
| 609 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) | 609 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) |
| 610 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | 610 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, |
| 611 OnSetZoomLevelForLoadingURL) | 611 OnSetZoomLevelForLoadingURL) |
| 612 IPC_MESSAGE_HANDLER(ViewMsg_ExitFullscreen, OnExitFullscreen) |
| 612 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 613 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
| 613 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 614 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
| 614 OnResetPageEncodingToDefault) | 615 OnResetPageEncodingToDefault) |
| 615 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) | 616 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) |
| 616 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) | 617 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) |
| 617 IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange) | 618 IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange) |
| 618 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) | 619 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) |
| 619 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) | 620 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) |
| 620 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) | 621 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) |
| 621 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) | 622 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) |
| (...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1669 } | 1670 } |
| 1670 | 1671 |
| 1671 void RenderView::enterFullscreenForNode(const WebKit::WebNode& node) { | 1672 void RenderView::enterFullscreenForNode(const WebKit::WebNode& node) { |
| 1672 NOTIMPLEMENTED(); | 1673 NOTIMPLEMENTED(); |
| 1673 } | 1674 } |
| 1674 | 1675 |
| 1675 void RenderView::exitFullscreenForNode(const WebKit::WebNode& node) { | 1676 void RenderView::exitFullscreenForNode(const WebKit::WebNode& node) { |
| 1676 NOTIMPLEMENTED(); | 1677 NOTIMPLEMENTED(); |
| 1677 } | 1678 } |
| 1678 | 1679 |
| 1680 void RenderView::enterFullscreenForElement() { |
| 1681 Send(new ViewHostMsg_ToggleFullscreen(routing_id_, true)); |
| 1682 } |
| 1683 |
| 1684 void RenderView::exitFullscreenForElement() { |
| 1685 Send(new ViewHostMsg_ToggleFullscreen(routing_id_, false)); |
| 1686 } |
| 1687 |
| 1679 void RenderView::setStatusText(const WebString& text) { | 1688 void RenderView::setStatusText(const WebString& text) { |
| 1680 } | 1689 } |
| 1681 | 1690 |
| 1682 void RenderView::UpdateTargetURL(const GURL& url, const GURL& fallback_url) { | 1691 void RenderView::UpdateTargetURL(const GURL& url, const GURL& fallback_url) { |
| 1683 GURL latest_url = url.is_empty() ? fallback_url : url; | 1692 GURL latest_url = url.is_empty() ? fallback_url : url; |
| 1684 if (latest_url == target_url_) | 1693 if (latest_url == target_url_) |
| 1685 return; | 1694 return; |
| 1686 | 1695 |
| 1687 // Tell the browser to display a destination link. | 1696 // Tell the browser to display a destination link. |
| 1688 if (target_url_status_ == TARGET_INFLIGHT || | 1697 if (target_url_status_ == TARGET_INFLIGHT || |
| (...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3243 webview()->hidePopups(); | 3252 webview()->hidePopups(); |
| 3244 webview()->setZoomLevel(false, zoom_level); | 3253 webview()->setZoomLevel(false, zoom_level); |
| 3245 zoomLevelChanged(); | 3254 zoomLevelChanged(); |
| 3246 } | 3255 } |
| 3247 | 3256 |
| 3248 void RenderView::OnSetZoomLevelForLoadingURL(const GURL& url, | 3257 void RenderView::OnSetZoomLevelForLoadingURL(const GURL& url, |
| 3249 double zoom_level) { | 3258 double zoom_level) { |
| 3250 host_zoom_levels_[url] = zoom_level; | 3259 host_zoom_levels_[url] = zoom_level; |
| 3251 } | 3260 } |
| 3252 | 3261 |
| 3262 void RenderView::OnExitFullscreen() { |
| 3263 webview()->exitFullscreen(); |
| 3264 } |
| 3265 |
| 3253 void RenderView::OnSetPageEncoding(const std::string& encoding_name) { | 3266 void RenderView::OnSetPageEncoding(const std::string& encoding_name) { |
| 3254 webview()->setPageEncoding(WebString::fromUTF8(encoding_name)); | 3267 webview()->setPageEncoding(WebString::fromUTF8(encoding_name)); |
| 3255 } | 3268 } |
| 3256 | 3269 |
| 3257 void RenderView::OnResetPageEncodingToDefault() { | 3270 void RenderView::OnResetPageEncodingToDefault() { |
| 3258 WebString no_encoding; | 3271 WebString no_encoding; |
| 3259 webview()->setPageEncoding(no_encoding); | 3272 webview()->setPageEncoding(no_encoding); |
| 3260 } | 3273 } |
| 3261 | 3274 |
| 3262 WebFrame* RenderView::GetChildFrame(const std::wstring& xpath) const { | 3275 WebFrame* RenderView::GetChildFrame(const std::wstring& xpath) const { |
| (...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4302 } | 4315 } |
| 4303 #endif | 4316 #endif |
| 4304 | 4317 |
| 4305 void RenderView::OnContextMenuClosed( | 4318 void RenderView::OnContextMenuClosed( |
| 4306 const webkit_glue::CustomContextMenuContext& custom_context) { | 4319 const webkit_glue::CustomContextMenuContext& custom_context) { |
| 4307 if (custom_context.is_pepper_menu) | 4320 if (custom_context.is_pepper_menu) |
| 4308 pepper_delegate_.OnContextMenuClosed(custom_context); | 4321 pepper_delegate_.OnContextMenuClosed(custom_context); |
| 4309 else | 4322 else |
| 4310 context_menu_node_.reset(); | 4323 context_menu_node_.reset(); |
| 4311 } | 4324 } |
| OLD | NEW |