OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1521 | 1521 |
1522 RenderWidgetHost* widget_host = widget_host_view->GetRenderWidgetHost(); | 1522 RenderWidgetHost* widget_host = widget_host_view->GetRenderWidgetHost(); |
1523 if (!widget_host->GetProcess()->HasConnection()) { | 1523 if (!widget_host->GetProcess()->HasConnection()) { |
1524 // The view has gone away or the renderer crashed. Nothing to do. | 1524 // The view has gone away or the renderer crashed. Nothing to do. |
1525 return NULL; | 1525 return NULL; |
1526 } | 1526 } |
1527 | 1527 |
1528 return widget_host_view; | 1528 return widget_host_view; |
1529 } | 1529 } |
1530 | 1530 |
1531 void WebContentsImpl::ShowContextMenu(const ContextMenuParams& params) { | |
1532 // Allow WebContentsDelegates to handle the context menu operation first. | |
1533 if (delegate_ && delegate_->HandleContextMenu(params)) | |
1534 return; | |
1535 | |
1536 render_view_host_delegate_view_->ShowContextMenu(params); | |
1537 } | |
1538 | |
1539 void WebContentsImpl::RequestMediaAccessPermission( | 1531 void WebContentsImpl::RequestMediaAccessPermission( |
1540 const MediaStreamRequest& request, | 1532 const MediaStreamRequest& request, |
1541 const MediaResponseCallback& callback) { | 1533 const MediaResponseCallback& callback) { |
1542 if (delegate_) | 1534 if (delegate_) |
1543 delegate_->RequestMediaAccessPermission(this, request, callback); | 1535 delegate_->RequestMediaAccessPermission(this, request, callback); |
1544 else | 1536 else |
1545 callback.Run(MediaStreamDevices(), scoped_ptr<MediaStreamUI>()); | 1537 callback.Run(MediaStreamDevices(), scoped_ptr<MediaStreamUI>()); |
1546 } | 1538 } |
1547 | 1539 |
1548 SessionStorageNamespace* WebContentsImpl::GetSessionStorageNamespace( | 1540 SessionStorageNamespace* WebContentsImpl::GetSessionStorageNamespace( |
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2677 observers_, | 2669 observers_, |
2678 RenderFrameCreated(render_frame_host)); | 2670 RenderFrameCreated(render_frame_host)); |
2679 } | 2671 } |
2680 | 2672 |
2681 void WebContentsImpl::RenderFrameDeleted(RenderFrameHost* render_frame_host) { | 2673 void WebContentsImpl::RenderFrameDeleted(RenderFrameHost* render_frame_host) { |
2682 FOR_EACH_OBSERVER(WebContentsObserver, | 2674 FOR_EACH_OBSERVER(WebContentsObserver, |
2683 observers_, | 2675 observers_, |
2684 RenderFrameDeleted(render_frame_host)); | 2676 RenderFrameDeleted(render_frame_host)); |
2685 } | 2677 } |
2686 | 2678 |
2687 void WebContentsImpl::WorkerCrashed() { | 2679 void WebContentsImpl::WorkerCrashed(RenderFrameHost* render_frame_host) { |
2688 if (delegate_) | 2680 if (delegate_) |
2689 delegate_->WorkerCrashed(this); | 2681 delegate_->WorkerCrashed(this); |
2690 } | 2682 } |
2691 | 2683 |
| 2684 void WebContentsImpl::ShowContextMenu(RenderFrameHost* render_frame_host, |
| 2685 const ContextMenuParams& params) { |
| 2686 // Allow WebContentsDelegates to handle the context menu operation first. |
| 2687 if (delegate_ && delegate_->HandleContextMenu(params)) |
| 2688 return; |
| 2689 |
| 2690 render_view_host_delegate_view_->ShowContextMenu(render_frame_host, params); |
| 2691 } |
| 2692 |
2692 WebContents* WebContentsImpl::GetAsWebContents() { | 2693 WebContents* WebContentsImpl::GetAsWebContents() { |
2693 return this; | 2694 return this; |
2694 } | 2695 } |
2695 | 2696 |
2696 RenderViewHostDelegateView* WebContentsImpl::GetDelegateView() { | 2697 RenderViewHostDelegateView* WebContentsImpl::GetDelegateView() { |
2697 return render_view_host_delegate_view_; | 2698 return render_view_host_delegate_view_; |
2698 } | 2699 } |
2699 | 2700 |
2700 RenderViewHostDelegate::RendererManagement* | 2701 RenderViewHostDelegate::RendererManagement* |
2701 WebContentsImpl::GetRendererManagementDelegate() { | 2702 WebContentsImpl::GetRendererManagementDelegate() { |
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3735 } | 3736 } |
3736 | 3737 |
3737 void WebContentsImpl::OnFrameRemoved( | 3738 void WebContentsImpl::OnFrameRemoved( |
3738 RenderViewHostImpl* render_view_host, | 3739 RenderViewHostImpl* render_view_host, |
3739 int64 frame_id) { | 3740 int64 frame_id) { |
3740 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3741 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
3741 FrameDetached(render_view_host, frame_id)); | 3742 FrameDetached(render_view_host, frame_id)); |
3742 } | 3743 } |
3743 | 3744 |
3744 } // namespace content | 3745 } // namespace content |
OLD | NEW |