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 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1732 } | 1733 } |
1733 | 1734 |
1734 void RenderView::enterFullscreenForNode(const WebKit::WebNode& node) { | 1735 void RenderView::enterFullscreenForNode(const WebKit::WebNode& node) { |
1735 NOTIMPLEMENTED(); | 1736 NOTIMPLEMENTED(); |
1736 } | 1737 } |
1737 | 1738 |
1738 void RenderView::exitFullscreenForNode(const WebKit::WebNode& node) { | 1739 void RenderView::exitFullscreenForNode(const WebKit::WebNode& node) { |
1739 NOTIMPLEMENTED(); | 1740 NOTIMPLEMENTED(); |
1740 } | 1741 } |
1741 | 1742 |
| 1743 void RenderView::enterFullscreen() { |
| 1744 Send(new ViewHostMsg_ToggleFullscreen(routing_id_, true)); |
| 1745 } |
| 1746 |
| 1747 void RenderView::exitFullscreen() { |
| 1748 Send(new ViewHostMsg_ToggleFullscreen(routing_id_, false)); |
| 1749 } |
| 1750 |
1742 void RenderView::setStatusText(const WebString& text) { | 1751 void RenderView::setStatusText(const WebString& text) { |
1743 } | 1752 } |
1744 | 1753 |
1745 void RenderView::UpdateTargetURL(const GURL& url, const GURL& fallback_url) { | 1754 void RenderView::UpdateTargetURL(const GURL& url, const GURL& fallback_url) { |
1746 GURL latest_url = url.is_empty() ? fallback_url : url; | 1755 GURL latest_url = url.is_empty() ? fallback_url : url; |
1747 if (latest_url == target_url_) | 1756 if (latest_url == target_url_) |
1748 return; | 1757 return; |
1749 | 1758 |
1750 // Tell the browser to display a destination link. | 1759 // Tell the browser to display a destination link. |
1751 if (target_url_status_ == TARGET_INFLIGHT || | 1760 if (target_url_status_ == TARGET_INFLIGHT || |
(...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3418 webview()->hidePopups(); | 3427 webview()->hidePopups(); |
3419 webview()->setZoomLevel(false, zoom_level); | 3428 webview()->setZoomLevel(false, zoom_level); |
3420 zoomLevelChanged(); | 3429 zoomLevelChanged(); |
3421 } | 3430 } |
3422 | 3431 |
3423 void RenderView::OnSetZoomLevelForLoadingURL(const GURL& url, | 3432 void RenderView::OnSetZoomLevelForLoadingURL(const GURL& url, |
3424 double zoom_level) { | 3433 double zoom_level) { |
3425 host_zoom_levels_[url] = zoom_level; | 3434 host_zoom_levels_[url] = zoom_level; |
3426 } | 3435 } |
3427 | 3436 |
| 3437 void RenderView::OnExitFullscreen() { |
| 3438 webview()->exitFullscreen(); |
| 3439 } |
| 3440 |
3428 void RenderView::OnSetPageEncoding(const std::string& encoding_name) { | 3441 void RenderView::OnSetPageEncoding(const std::string& encoding_name) { |
3429 webview()->setPageEncoding(WebString::fromUTF8(encoding_name)); | 3442 webview()->setPageEncoding(WebString::fromUTF8(encoding_name)); |
3430 } | 3443 } |
3431 | 3444 |
3432 void RenderView::OnResetPageEncodingToDefault() { | 3445 void RenderView::OnResetPageEncodingToDefault() { |
3433 WebString no_encoding; | 3446 WebString no_encoding; |
3434 webview()->setPageEncoding(no_encoding); | 3447 webview()->setPageEncoding(no_encoding); |
3435 } | 3448 } |
3436 | 3449 |
3437 WebFrame* RenderView::GetChildFrame(const string16& xpath) const { | 3450 WebFrame* RenderView::GetChildFrame(const string16& xpath) const { |
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4570 | 4583 |
4571 void RenderView::OnEnableViewSourceMode() { | 4584 void RenderView::OnEnableViewSourceMode() { |
4572 if (!webview()) | 4585 if (!webview()) |
4573 return; | 4586 return; |
4574 WebFrame* main_frame = webview()->mainFrame(); | 4587 WebFrame* main_frame = webview()->mainFrame(); |
4575 if (!main_frame) | 4588 if (!main_frame) |
4576 return; | 4589 return; |
4577 main_frame->enableViewSourceMode(true); | 4590 main_frame->enableViewSourceMode(true); |
4578 } | 4591 } |
4579 | 4592 |
OLD | NEW |