Chromium Code Reviews| 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/browser/renderer_host/render_view_host.h" | 5 #include "content/browser/renderer_host/render_view_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 #include "webkit/glue/webaccessibility.h" | 49 #include "webkit/glue/webaccessibility.h" |
| 50 #include "webkit/glue/webdropdata.h" | 50 #include "webkit/glue/webdropdata.h" |
| 51 | 51 |
| 52 using base::TimeDelta; | 52 using base::TimeDelta; |
| 53 using WebKit::WebConsoleMessage; | 53 using WebKit::WebConsoleMessage; |
| 54 using WebKit::WebDragOperation; | 54 using WebKit::WebDragOperation; |
| 55 using WebKit::WebDragOperationNone; | 55 using WebKit::WebDragOperationNone; |
| 56 using WebKit::WebDragOperationsMask; | 56 using WebKit::WebDragOperationsMask; |
| 57 using WebKit::WebInputEvent; | 57 using WebKit::WebInputEvent; |
| 58 using WebKit::WebMediaPlayerAction; | 58 using WebKit::WebMediaPlayerAction; |
| 59 using WebKit::WebTextDirection; | |
| 60 | 59 |
| 61 namespace { | 60 namespace { |
| 62 | 61 |
| 63 // Delay to wait on closing the tab for a beforeunload/unload handler to fire. | 62 // Delay to wait on closing the tab for a beforeunload/unload handler to fire. |
| 64 const int kUnloadTimeoutMS = 1000; | 63 const int kUnloadTimeoutMS = 1000; |
| 65 | 64 |
| 65 // Translate a WebKit text direction into a base::i18n one. | |
| 66 base::i18n::TextDirection WebTextDirectionToChromeTextDirection( | |
| 67 WebKit::WebTextDirection dir) { | |
| 68 switch (dir) { | |
| 69 case WebKit::WebTextDirectionLeftToRight: | |
| 70 return base::i18n::LEFT_TO_RIGHT; | |
| 71 case WebKit::WebTextDirectionRightToLeft: | |
| 72 return base::i18n::LEFT_TO_RIGHT; | |
|
jeremy
2011/08/02 09:34:37
I think you mean RIGHT_TO_LEFT
| |
| 73 default: | |
| 74 NOTREACHED(); | |
| 75 return base::i18n::UNKNOWN_DIRECTION; | |
| 76 } | |
| 77 } | |
| 78 | |
| 66 } // namespace | 79 } // namespace |
| 67 | 80 |
| 68 /////////////////////////////////////////////////////////////////////////////// | 81 /////////////////////////////////////////////////////////////////////////////// |
| 69 // RenderViewHost, public: | 82 // RenderViewHost, public: |
| 70 | 83 |
| 71 // static | 84 // static |
| 72 RenderViewHost* RenderViewHost::FromID(int render_process_id, | 85 RenderViewHost* RenderViewHost::FromID(int render_process_id, |
| 73 int render_view_id) { | 86 int render_view_id) { |
| 74 RenderProcessHost* process = RenderProcessHost::FromID(render_process_id); | 87 RenderProcessHost* process = RenderProcessHost::FromID(render_process_id); |
| 75 if (!process) | 88 if (!process) |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 875 FilterURL(policy, renderer_id, &validated_params.password_form.action); | 888 FilterURL(policy, renderer_id, &validated_params.password_form.action); |
| 876 | 889 |
| 877 delegate_->DidNavigate(this, validated_params); | 890 delegate_->DidNavigate(this, validated_params); |
| 878 } | 891 } |
| 879 | 892 |
| 880 void RenderViewHost::OnMsgUpdateState(int32 page_id, | 893 void RenderViewHost::OnMsgUpdateState(int32 page_id, |
| 881 const std::string& state) { | 894 const std::string& state) { |
| 882 delegate_->UpdateState(this, page_id, state); | 895 delegate_->UpdateState(this, page_id, state); |
| 883 } | 896 } |
| 884 | 897 |
| 885 void RenderViewHost::OnMsgUpdateTitle(int32 page_id, | 898 void RenderViewHost::OnMsgUpdateTitle( |
| 886 const string16& title) { | 899 int32 page_id, |
| 900 const string16& title, | |
| 901 WebKit::WebTextDirection title_direction) { | |
| 887 if (title.length() > content::kMaxTitleChars) { | 902 if (title.length() > content::kMaxTitleChars) { |
| 888 NOTREACHED() << "Renderer sent too many characters in title."; | 903 NOTREACHED() << "Renderer sent too many characters in title."; |
| 889 return; | 904 return; |
| 890 } | 905 } |
| 891 delegate_->UpdateTitle(this, page_id, title); | 906 |
| 907 delegate_->UpdateTitle(this, page_id, title, | |
| 908 WebTextDirectionToChromeTextDirection( | |
| 909 title_direction)); | |
| 892 } | 910 } |
| 893 | 911 |
| 894 void RenderViewHost::OnMsgUpdateEncoding(const std::string& encoding_name) { | 912 void RenderViewHost::OnMsgUpdateEncoding(const std::string& encoding_name) { |
| 895 delegate_->UpdateEncoding(this, encoding_name); | 913 delegate_->UpdateEncoding(this, encoding_name); |
| 896 } | 914 } |
| 897 | 915 |
| 898 void RenderViewHost::OnMsgUpdateTargetURL(int32 page_id, | 916 void RenderViewHost::OnMsgUpdateTargetURL(int32 page_id, |
| 899 const GURL& url) { | 917 const GURL& url) { |
| 900 if (!is_swapped_out_) | 918 if (!is_swapped_out_) |
| 901 delegate_->UpdateTargetURL(page_id, url); | 919 delegate_->UpdateTargetURL(page_id, url); |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1314 if (view) { | 1332 if (view) { |
| 1315 view->ShowPopupMenu(params.bounds, | 1333 view->ShowPopupMenu(params.bounds, |
| 1316 params.item_height, | 1334 params.item_height, |
| 1317 params.item_font_size, | 1335 params.item_font_size, |
| 1318 params.selected_item, | 1336 params.selected_item, |
| 1319 params.popup_items, | 1337 params.popup_items, |
| 1320 params.right_aligned); | 1338 params.right_aligned); |
| 1321 } | 1339 } |
| 1322 } | 1340 } |
| 1323 #endif | 1341 #endif |
| OLD | NEW |