Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 6 | 6 |
| 7 #include "base/containers/hash_tables.h" | 7 #include "base/containers/hash_tables.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/metrics/user_metrics_action.h" | 9 #include "base/metrics/user_metrics_action.h" |
| 10 #include "content/browser/child_process_security_policy_impl.h" | 10 #include "content/browser/child_process_security_policy_impl.h" |
| 11 #include "content/browser/frame_host/cross_process_frame_connector.h" | 11 #include "content/browser/frame_host/cross_process_frame_connector.h" |
| 12 #include "content/browser/frame_host/cross_site_transferring_request.h" | 12 #include "content/browser/frame_host/cross_site_transferring_request.h" |
| 13 #include "content/browser/frame_host/frame_tree.h" | 13 #include "content/browser/frame_host/frame_tree.h" |
| 14 #include "content/browser/frame_host/frame_tree_node.h" | 14 #include "content/browser/frame_host/frame_tree_node.h" |
| 15 #include "content/browser/frame_host/navigator.h" | 15 #include "content/browser/frame_host/navigator.h" |
| 16 #include "content/browser/frame_host/render_frame_host_delegate.h" | 16 #include "content/browser/frame_host/render_frame_host_delegate.h" |
| 17 #include "content/browser/renderer_host/render_view_host_impl.h" | 17 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 18 #include "content/common/frame_messages.h" | 18 #include "content/common/frame_messages.h" |
| 19 #include "content/common/input_messages.h" | |
| 19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 20 #include "content/public/browser/content_browser_client.h" | 21 #include "content/public/browser/content_browser_client.h" |
| 21 #include "content/public/browser/render_process_host.h" | 22 #include "content/public/browser/render_process_host.h" |
| 22 #include "content/public/browser/render_widget_host_view.h" | 23 #include "content/public/browser/render_widget_host_view.h" |
| 23 #include "content/public/browser/user_metrics.h" | 24 #include "content/public/browser/user_metrics.h" |
| 24 #include "content/public/common/url_constants.h" | 25 #include "content/public/common/url_constants.h" |
| 25 #include "url/gurl.h" | 26 #include "url/gurl.h" |
| 26 | 27 |
| 27 namespace content { | 28 namespace content { |
| 28 | 29 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 void RenderFrameHostImpl::NotifyContextMenuClosed( | 125 void RenderFrameHostImpl::NotifyContextMenuClosed( |
| 125 const CustomContextMenuContext& context) { | 126 const CustomContextMenuContext& context) { |
| 126 Send(new FrameMsg_ContextMenuClosed(routing_id_, context)); | 127 Send(new FrameMsg_ContextMenuClosed(routing_id_, context)); |
| 127 } | 128 } |
| 128 | 129 |
| 129 void RenderFrameHostImpl::ExecuteCustomContextMenuCommand( | 130 void RenderFrameHostImpl::ExecuteCustomContextMenuCommand( |
| 130 int action, const CustomContextMenuContext& context) { | 131 int action, const CustomContextMenuContext& context) { |
| 131 Send(new FrameMsg_CustomContextMenuAction(routing_id_, context, action)); | 132 Send(new FrameMsg_CustomContextMenuAction(routing_id_, context, action)); |
| 132 } | 133 } |
| 133 | 134 |
| 135 void RenderFrameHostImpl::Cut() { | |
| 136 Send(new InputMsg_Cut(GetRoutingID())); | |
|
nasko
2014/03/05 21:50:47
nit: routing_id_ here and in ::Paste, to be consis
jam
2014/03/06 00:59:37
Done.
| |
| 137 RecordAction(base::UserMetricsAction("Cut")); | |
| 138 } | |
| 139 | |
| 140 void RenderFrameHostImpl::Copy() { | |
| 141 Send(new InputMsg_Copy(routing_id_)); | |
| 142 RecordAction(base::UserMetricsAction("Copy")); | |
| 143 } | |
| 144 | |
| 145 void RenderFrameHostImpl::Paste() { | |
| 146 Send(new InputMsg_Paste(GetRoutingID())); | |
| 147 RecordAction(base::UserMetricsAction("Paste")); | |
| 148 } | |
| 149 | |
| 134 RenderViewHost* RenderFrameHostImpl::GetRenderViewHost() { | 150 RenderViewHost* RenderFrameHostImpl::GetRenderViewHost() { |
| 135 return render_view_host_; | 151 return render_view_host_; |
| 136 } | 152 } |
| 137 | 153 |
| 138 bool RenderFrameHostImpl::Send(IPC::Message* message) { | 154 bool RenderFrameHostImpl::Send(IPC::Message* message) { |
| 139 return GetProcess()->Send(message); | 155 return GetProcess()->Send(message); |
| 140 } | 156 } |
| 141 | 157 |
| 142 bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) { | 158 bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) { |
| 143 if (delegate_->OnMessageReceived(this, msg)) | 159 if (delegate_->OnMessageReceived(this, msg)) |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 417 // second navigation occurs, RenderFrameHostManager will cancel this pending | 433 // second navigation occurs, RenderFrameHostManager will cancel this pending |
| 418 // RFH and create a new pending RFH. | 434 // RFH and create a new pending RFH. |
| 419 DCHECK(!render_view_host_->suspended_nav_params_.get()); | 435 DCHECK(!render_view_host_->suspended_nav_params_.get()); |
| 420 render_view_host_->suspended_nav_params_.reset( | 436 render_view_host_->suspended_nav_params_.reset( |
| 421 new FrameMsg_Navigate_Params(params)); | 437 new FrameMsg_Navigate_Params(params)); |
| 422 } else { | 438 } else { |
| 423 // Get back to a clean state, in case we start a new navigation without | 439 // Get back to a clean state, in case we start a new navigation without |
| 424 // completing a RVH swap or unload handler. | 440 // completing a RVH swap or unload handler. |
| 425 render_view_host_->SetState(RenderViewHostImpl::STATE_DEFAULT); | 441 render_view_host_->SetState(RenderViewHostImpl::STATE_DEFAULT); |
| 426 | 442 |
| 427 Send(new FrameMsg_Navigate(GetRoutingID(), params)); | 443 Send(new FrameMsg_Navigate(routing_id_, params)); |
| 428 } | 444 } |
| 429 | 445 |
| 430 // Force the throbber to start. We do this because Blink's "started | 446 // Force the throbber to start. We do this because Blink's "started |
| 431 // loading" message will be received asynchronously from the UI of the | 447 // loading" message will be received asynchronously from the UI of the |
| 432 // browser. But we want to keep the throbber in sync with what's happening | 448 // browser. But we want to keep the throbber in sync with what's happening |
| 433 // in the UI. For example, we want to start throbbing immediately when the | 449 // in the UI. For example, we want to start throbbing immediately when the |
| 434 // user naivgates even if the renderer is delayed. There is also an issue | 450 // user naivgates even if the renderer is delayed. There is also an issue |
| 435 // with the throbber starting because the WebUI (which controls whether the | 451 // with the throbber starting because the WebUI (which controls whether the |
| 436 // favicon is displayed) happens synchronously. If the start loading | 452 // favicon is displayed) happens synchronously. If the start loading |
| 437 // messages was asynchronous, then the default favicon would flash in. | 453 // messages was asynchronous, then the default favicon would flash in. |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 448 params.pending_history_list_offset = -1; | 464 params.pending_history_list_offset = -1; |
| 449 params.current_history_list_offset = -1; | 465 params.current_history_list_offset = -1; |
| 450 params.current_history_list_length = 0; | 466 params.current_history_list_length = 0; |
| 451 params.url = url; | 467 params.url = url; |
| 452 params.transition = PAGE_TRANSITION_LINK; | 468 params.transition = PAGE_TRANSITION_LINK; |
| 453 params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 469 params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
| 454 Navigate(params); | 470 Navigate(params); |
| 455 } | 471 } |
| 456 | 472 |
| 457 } // namespace content | 473 } // namespace content |
| OLD | NEW |