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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 decrement_shared_popup_at_destruction_ = true; | 381 decrement_shared_popup_at_destruction_ = true; |
382 } else { | 382 } else { |
383 shared_popup_counter_ = new SharedRenderViewCounter(0); | 383 shared_popup_counter_ = new SharedRenderViewCounter(0); |
384 decrement_shared_popup_at_destruction_ = false; | 384 decrement_shared_popup_at_destruction_ = false; |
385 } | 385 } |
386 | 386 |
387 notification_provider_ = new NotificationProvider(this); | 387 notification_provider_ = new NotificationProvider(this); |
388 | 388 |
389 render_thread_->AddRoute(routing_id_, this); | 389 render_thread_->AddRoute(routing_id_, this); |
390 // Take a reference on behalf of the RenderThread. This will be balanced | 390 // Take a reference on behalf of the RenderThread. This will be balanced |
391 // when we receive ViewMsg_Close. | 391 // when we receive ViewMsg_ClosePage. |
392 AddRef(); | 392 AddRef(); |
393 | 393 |
394 // If this is a popup, we must wait for the CreatingNew_ACK message before | 394 // If this is a popup, we must wait for the CreatingNew_ACK message before |
395 // completing initialization. Otherwise, we can finish it now. | 395 // completing initialization. Otherwise, we can finish it now. |
396 if (opener_id == MSG_ROUTING_NONE) { | 396 if (opener_id == MSG_ROUTING_NONE) { |
397 did_show_ = true; | 397 did_show_ = true; |
398 CompleteInit(parent_hwnd); | 398 CompleteInit(parent_hwnd); |
399 } | 399 } |
400 | 400 |
401 g_view_map.Get().insert(std::make_pair(webview(), this)); | 401 g_view_map.Get().insert(std::make_pair(webview(), this)); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 IPC_MESSAGE_HANDLER(ViewMsg_SelectRange, OnSelectRange) | 624 IPC_MESSAGE_HANDLER(ViewMsg_SelectRange, OnSelectRange) |
625 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) | 625 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) |
626 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) | 626 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) |
627 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) | 627 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) |
628 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) | 628 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) |
629 IPC_MESSAGE_HANDLER(ViewMsg_FindReplyACK, OnFindReplyAck) | 629 IPC_MESSAGE_HANDLER(ViewMsg_FindReplyACK, OnFindReplyAck) |
630 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 630 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
631 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) | 631 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) |
632 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | 632 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, |
633 OnSetZoomLevelForLoadingURL) | 633 OnSetZoomLevelForLoadingURL) |
| 634 IPC_MESSAGE_HANDLER(ViewMsg_ExitFullscreen, OnExitFullscreen) |
634 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 635 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
635 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 636 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
636 OnResetPageEncodingToDefault) | 637 OnResetPageEncodingToDefault) |
637 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) | 638 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) |
638 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) | 639 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) |
639 IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange) | 640 IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange) |
640 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) | 641 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) |
641 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) | 642 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) |
642 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) | 643 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) |
643 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) | 644 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) |
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1731 } | 1732 } |
1732 | 1733 |
1733 void RenderView::enterFullscreenForNode(const WebKit::WebNode& node) { | 1734 void RenderView::enterFullscreenForNode(const WebKit::WebNode& node) { |
1734 NOTIMPLEMENTED(); | 1735 NOTIMPLEMENTED(); |
1735 } | 1736 } |
1736 | 1737 |
1737 void RenderView::exitFullscreenForNode(const WebKit::WebNode& node) { | 1738 void RenderView::exitFullscreenForNode(const WebKit::WebNode& node) { |
1738 NOTIMPLEMENTED(); | 1739 NOTIMPLEMENTED(); |
1739 } | 1740 } |
1740 | 1741 |
| 1742 void RenderView::enterFullscreen() { |
| 1743 Send(new ViewHostMsg_ToggleFullscreen(routing_id_, true)); |
| 1744 } |
| 1745 |
| 1746 void RenderView::exitFullscreen() { |
| 1747 Send(new ViewHostMsg_ToggleFullscreen(routing_id_, false)); |
| 1748 } |
| 1749 |
1741 void RenderView::setStatusText(const WebString& text) { | 1750 void RenderView::setStatusText(const WebString& text) { |
1742 } | 1751 } |
1743 | 1752 |
1744 void RenderView::UpdateTargetURL(const GURL& url, const GURL& fallback_url) { | 1753 void RenderView::UpdateTargetURL(const GURL& url, const GURL& fallback_url) { |
1745 GURL latest_url = url.is_empty() ? fallback_url : url; | 1754 GURL latest_url = url.is_empty() ? fallback_url : url; |
1746 if (latest_url == target_url_) | 1755 if (latest_url == target_url_) |
1747 return; | 1756 return; |
1748 | 1757 |
1749 // Tell the browser to display a destination link. | 1758 // Tell the browser to display a destination link. |
1750 if (target_url_status_ == TARGET_INFLIGHT || | 1759 if (target_url_status_ == TARGET_INFLIGHT || |
(...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3417 webview()->hidePopups(); | 3426 webview()->hidePopups(); |
3418 webview()->setZoomLevel(false, zoom_level); | 3427 webview()->setZoomLevel(false, zoom_level); |
3419 zoomLevelChanged(); | 3428 zoomLevelChanged(); |
3420 } | 3429 } |
3421 | 3430 |
3422 void RenderView::OnSetZoomLevelForLoadingURL(const GURL& url, | 3431 void RenderView::OnSetZoomLevelForLoadingURL(const GURL& url, |
3423 double zoom_level) { | 3432 double zoom_level) { |
3424 host_zoom_levels_[url] = zoom_level; | 3433 host_zoom_levels_[url] = zoom_level; |
3425 } | 3434 } |
3426 | 3435 |
| 3436 void RenderView::OnExitFullscreen() { |
| 3437 webview()->exitFullscreen(); |
| 3438 } |
| 3439 |
3427 void RenderView::OnSetPageEncoding(const std::string& encoding_name) { | 3440 void RenderView::OnSetPageEncoding(const std::string& encoding_name) { |
3428 webview()->setPageEncoding(WebString::fromUTF8(encoding_name)); | 3441 webview()->setPageEncoding(WebString::fromUTF8(encoding_name)); |
3429 } | 3442 } |
3430 | 3443 |
3431 void RenderView::OnResetPageEncodingToDefault() { | 3444 void RenderView::OnResetPageEncodingToDefault() { |
3432 WebString no_encoding; | 3445 WebString no_encoding; |
3433 webview()->setPageEncoding(no_encoding); | 3446 webview()->setPageEncoding(no_encoding); |
3434 } | 3447 } |
3435 | 3448 |
3436 WebFrame* RenderView::GetChildFrame(const string16& xpath) const { | 3449 WebFrame* RenderView::GetChildFrame(const string16& xpath) const { |
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4551 } | 4564 } |
4552 #endif | 4565 #endif |
4553 | 4566 |
4554 void RenderView::OnContextMenuClosed( | 4567 void RenderView::OnContextMenuClosed( |
4555 const webkit_glue::CustomContextMenuContext& custom_context) { | 4568 const webkit_glue::CustomContextMenuContext& custom_context) { |
4556 if (custom_context.is_pepper_menu) | 4569 if (custom_context.is_pepper_menu) |
4557 pepper_delegate_.OnContextMenuClosed(custom_context); | 4570 pepper_delegate_.OnContextMenuClosed(custom_context); |
4558 else | 4571 else |
4559 context_menu_node_.reset(); | 4572 context_menu_node_.reset(); |
4560 } | 4573 } |
OLD | NEW |