Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(571)

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 274883002: Move didReceiveTitle and related stuff to RenderFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/bind.h" 7 #include "base/bind.h"
8 #include "base/containers/hash_tables.h" 8 #include "base/containers/hash_tables.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/metrics/user_metrics_action.h" 10 #include "base/metrics/user_metrics_action.h"
(...skipping 11 matching lines...) Expand all
22 #include "content/common/frame_messages.h" 22 #include "content/common/frame_messages.h"
23 #include "content/common/input_messages.h" 23 #include "content/common/input_messages.h"
24 #include "content/common/inter_process_time_ticks_converter.h" 24 #include "content/common/inter_process_time_ticks_converter.h"
25 #include "content/common/swapped_out_messages.h" 25 #include "content/common/swapped_out_messages.h"
26 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
27 #include "content/public/browser/content_browser_client.h" 27 #include "content/public/browser/content_browser_client.h"
28 #include "content/public/browser/desktop_notification_delegate.h" 28 #include "content/public/browser/desktop_notification_delegate.h"
29 #include "content/public/browser/render_process_host.h" 29 #include "content/public/browser/render_process_host.h"
30 #include "content/public/browser/render_widget_host_view.h" 30 #include "content/public/browser/render_widget_host_view.h"
31 #include "content/public/browser/user_metrics.h" 31 #include "content/public/browser/user_metrics.h"
32 #include "content/public/common/content_constants.h"
32 #include "content/public/common/url_constants.h" 33 #include "content/public/common/url_constants.h"
33 #include "content/public/common/url_utils.h" 34 #include "content/public/common/url_utils.h"
34 #include "url/gurl.h" 35 #include "url/gurl.h"
35 36
36 using base::TimeDelta; 37 using base::TimeDelta;
37 38
38 namespace content { 39 namespace content {
39 40
40 namespace { 41 namespace {
41 42
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 rfh->Send(new DesktopNotificationMsg_PostClick( 100 rfh->Send(new DesktopNotificationMsg_PostClick(
100 rfh->GetRoutingID(), notification_id_)); 101 rfh->GetRoutingID(), notification_id_));
101 } 102 }
102 103
103 private: 104 private:
104 int render_process_id_; 105 int render_process_id_;
105 int render_frame_id_; 106 int render_frame_id_;
106 int notification_id_; 107 int notification_id_;
107 }; 108 };
108 109
110 // Translate a WebKit text direction into a base::i18n one.
111 base::i18n::TextDirection WebTextDirectionToChromeTextDirection(
112 blink::WebTextDirection dir) {
113 switch (dir) {
114 case blink::WebTextDirectionLeftToRight:
115 return base::i18n::LEFT_TO_RIGHT;
116 case blink::WebTextDirectionRightToLeft:
117 return base::i18n::RIGHT_TO_LEFT;
118 default:
119 NOTREACHED();
120 return base::i18n::UNKNOWN_DIRECTION;
121 }
122 }
123
109 } // namespace 124 } // namespace
110 125
111 RenderFrameHost* RenderFrameHost::FromID(int render_process_id, 126 RenderFrameHost* RenderFrameHost::FromID(int render_process_id,
112 int render_frame_id) { 127 int render_frame_id) {
113 return RenderFrameHostImpl::FromID(render_process_id, render_frame_id); 128 return RenderFrameHostImpl::FromID(render_process_id, render_frame_id);
114 } 129 }
115 130
116 // static 131 // static
117 RenderFrameHostImpl* RenderFrameHostImpl::FromID( 132 RenderFrameHostImpl* RenderFrameHostImpl::FromID(
118 int process_id, int routing_id) { 133 int process_id, int routing_id) {
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu) 301 IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu)
287 IPC_MESSAGE_HANDLER(FrameHostMsg_JavaScriptExecuteResponse, 302 IPC_MESSAGE_HANDLER(FrameHostMsg_JavaScriptExecuteResponse,
288 OnJavaScriptExecuteResponse) 303 OnJavaScriptExecuteResponse)
289 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunJavaScriptMessage, 304 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunJavaScriptMessage,
290 OnRunJavaScriptMessage) 305 OnRunJavaScriptMessage)
291 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm, 306 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm,
292 OnRunBeforeUnloadConfirm) 307 OnRunBeforeUnloadConfirm)
293 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAccessInitialDocument, 308 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAccessInitialDocument,
294 OnDidAccessInitialDocument) 309 OnDidAccessInitialDocument)
295 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisownOpener, OnDidDisownOpener) 310 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisownOpener, OnDidDisownOpener)
311 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle)
312 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding)
296 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_RequestPermission, 313 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_RequestPermission,
297 OnRequestDesktopNotificationPermission) 314 OnRequestDesktopNotificationPermission)
298 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Show, 315 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Show,
299 OnShowDesktopNotification) 316 OnShowDesktopNotification)
300 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, 317 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel,
301 OnCancelDesktopNotification) 318 OnCancelDesktopNotification)
302 IPC_END_MESSAGE_MAP_EX() 319 IPC_END_MESSAGE_MAP_EX()
303 320
304 if (!msg_is_ok) { 321 if (!msg_is_ok) {
305 // The message had a handler, but its de-serialization failed. 322 // The message had a handler, but its de-serialization failed.
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 void RenderFrameHostImpl::OnDidAccessInitialDocument() { 705 void RenderFrameHostImpl::OnDidAccessInitialDocument() {
689 delegate_->DidAccessInitialDocument(); 706 delegate_->DidAccessInitialDocument();
690 } 707 }
691 708
692 void RenderFrameHostImpl::OnDidDisownOpener() { 709 void RenderFrameHostImpl::OnDidDisownOpener() {
693 // This message is only sent for top-level frames. TODO(avi): when frame tree 710 // This message is only sent for top-level frames. TODO(avi): when frame tree
694 // mirroring works correctly, add a check here to enforce it. 711 // mirroring works correctly, add a check here to enforce it.
695 delegate_->DidDisownOpener(this); 712 delegate_->DidDisownOpener(this);
696 } 713 }
697 714
715 void RenderFrameHostImpl::OnUpdateTitle(
716 int32 page_id,
717 const base::string16& title,
718 blink::WebTextDirection title_direction) {
719 // This message is only sent for top-level frames. TODO(avi): when frame tree
720 // mirroring works correctly, add a check here to enforce it.
721 if (title.length() > kMaxTitleChars) {
722 NOTREACHED() << "Renderer sent too many characters in title.";
723 return;
724 }
725
726 delegate_->UpdateTitle(this, page_id, title,
727 WebTextDirectionToChromeTextDirection(
728 title_direction));
729 }
730
731 void RenderFrameHostImpl::OnUpdateEncoding(const std::string& encoding_name) {
732 // This message is only sent for top-level frames. TODO(avi): when frame tree
733 // mirroring works correctly, add a check here to enforce it.
734 delegate_->UpdateEncoding(this, encoding_name);
735 }
736
698 void RenderFrameHostImpl::SetPendingShutdown(const base::Closure& on_swap_out) { 737 void RenderFrameHostImpl::SetPendingShutdown(const base::Closure& on_swap_out) {
699 render_view_host_->SetPendingShutdown(on_swap_out); 738 render_view_host_->SetPendingShutdown(on_swap_out);
700 } 739 }
701 740
702 bool RenderFrameHostImpl::CanCommitURL(const GURL& url) { 741 bool RenderFrameHostImpl::CanCommitURL(const GURL& url) {
703 // TODO(creis): We should also check for WebUI pages here. Also, when the 742 // TODO(creis): We should also check for WebUI pages here. Also, when the
704 // out-of-process iframes implementation is ready, we should check for 743 // out-of-process iframes implementation is ready, we should check for
705 // cross-site URLs that are not allowed to commit in this process. 744 // cross-site URLs that are not allowed to commit in this process.
706 745
707 // Give the client a chance to disallow URLs from committing. 746 // Give the client a chance to disallow URLs from committing.
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 cancel_notification_callbacks_.erase(notification_id); 894 cancel_notification_callbacks_.erase(notification_id);
856 } 895 }
857 896
858 void RenderFrameHostImpl::DesktopNotificationPermissionRequestDone( 897 void RenderFrameHostImpl::DesktopNotificationPermissionRequestDone(
859 int callback_context) { 898 int callback_context) {
860 Send(new DesktopNotificationMsg_PermissionRequestDone( 899 Send(new DesktopNotificationMsg_PermissionRequestDone(
861 routing_id_, callback_context)); 900 routing_id_, callback_context));
862 } 901 }
863 902
864 } // namespace content 903 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/renderer_host/render_view_host_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698