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/browser_plugin/browser_plugin_guest.h" | 5 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "content/browser/browser_plugin/browser_plugin_embedder.h" | 12 #include "content/browser/browser_plugin/browser_plugin_embedder.h" |
13 #include "content/browser/browser_plugin/browser_plugin_guest_helper.h" | 13 #include "content/browser/browser_plugin/browser_plugin_guest_helper.h" |
14 #include "content/browser/browser_plugin/browser_plugin_guest_manager.h" | 14 #include "content/browser/browser_plugin/browser_plugin_guest_manager.h" |
15 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" | 15 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" |
16 #include "content/browser/browser_thread_impl.h" | 16 #include "content/browser/browser_thread_impl.h" |
17 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 17 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
18 #include "content/browser/renderer_host/render_view_host_impl.h" | 18 #include "content/browser/renderer_host/render_view_host_impl.h" |
19 #include "content/browser/renderer_host/render_widget_host_impl.h" | 19 #include "content/browser/renderer_host/render_widget_host_impl.h" |
20 #include "content/browser/web_contents/web_contents_impl.h" | 20 #include "content/browser/web_contents/web_contents_impl.h" |
21 #include "content/browser/web_contents/web_contents_view_guest.h" | 21 #include "content/browser/web_contents/web_contents_view_guest.h" |
22 #include "content/common/browser_plugin/browser_plugin_constants.h" | 22 #include "content/common/browser_plugin/browser_plugin_constants.h" |
23 #include "content/common/browser_plugin/browser_plugin_messages.h" | 23 #include "content/common/browser_plugin/browser_plugin_messages.h" |
24 #include "content/common/content_constants_internal.h" | 24 #include "content/common/content_constants_internal.h" |
25 #include "content/common/drag_messages.h" | 25 #include "content/common/drag_messages.h" |
26 #include "content/common/gpu/gpu_messages.h" | 26 #include "content/common/gpu/gpu_messages.h" |
| 27 #include "content/common/input_messages.h" |
27 #include "content/common/view_messages.h" | 28 #include "content/common/view_messages.h" |
28 #include "content/port/browser/render_view_host_delegate_view.h" | 29 #include "content/port/browser/render_view_host_delegate_view.h" |
29 #include "content/public/browser/browser_context.h" | 30 #include "content/public/browser/browser_context.h" |
30 #include "content/public/browser/content_browser_client.h" | 31 #include "content/public/browser/content_browser_client.h" |
31 #include "content/public/browser/geolocation_permission_context.h" | 32 #include "content/public/browser/geolocation_permission_context.h" |
32 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
33 #include "content/public/browser/notification_types.h" | 34 #include "content/public/browser/notification_types.h" |
34 #include "content/public/browser/render_process_host.h" | 35 #include "content/public/browser/render_process_host.h" |
35 #include "content/public/browser/render_widget_host_view.h" | 36 #include "content/public/browser/render_widget_host_view.h" |
36 #include "content/public/browser/resource_request_details.h" | 37 #include "content/public/browser/resource_request_details.h" |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 " window.event.preventDefault(); " | 613 " window.event.preventDefault(); " |
613 "});"; | 614 "});"; |
614 render_view_host->ExecuteJavascriptInWebFrame(string16(), | 615 render_view_host->ExecuteJavascriptInWebFrame(string16(), |
615 ASCIIToUTF16(script)); | 616 ASCIIToUTF16(script)); |
616 SendMessageToEmbedder(new BrowserPluginMsg_LoadStop(instance_id())); | 617 SendMessageToEmbedder(new BrowserPluginMsg_LoadStop(instance_id())); |
617 } | 618 } |
618 | 619 |
619 void BrowserPluginGuest::RenderViewReady() { | 620 void BrowserPluginGuest::RenderViewReady() { |
620 // TODO(fsamuel): Investigate whether it's possible to update state earlier | 621 // TODO(fsamuel): Investigate whether it's possible to update state earlier |
621 // here (see http://crbug.com/158151). | 622 // here (see http://crbug.com/158151). |
622 Send(new ViewMsg_SetFocus(routing_id(), focused_)); | 623 Send(new InputMsg_SetFocus(routing_id(), focused_)); |
623 UpdateVisibility(); | 624 UpdateVisibility(); |
624 RenderViewHost* rvh = GetWebContents()->GetRenderViewHost(); | 625 RenderViewHost* rvh = GetWebContents()->GetRenderViewHost(); |
625 if (auto_size_enabled_) | 626 if (auto_size_enabled_) |
626 rvh->EnableAutoResize(min_auto_size_, max_auto_size_); | 627 rvh->EnableAutoResize(min_auto_size_, max_auto_size_); |
627 else | 628 else |
628 rvh->DisableAutoResize(damage_view_size_); | 629 rvh->DisableAutoResize(damage_view_size_); |
629 | 630 |
630 Send(new ViewMsg_SetName(routing_id(), name_)); | 631 Send(new ViewMsg_SetName(routing_id(), name_)); |
631 | 632 |
632 RenderWidgetHostImpl::From(rvh)-> | 633 RenderWidgetHostImpl::From(rvh)-> |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
944 SetDamageBuffer(params); | 945 SetDamageBuffer(params); |
945 GetWebContents()->GetView()->SizeContents(params.view_size); | 946 GetWebContents()->GetView()->SizeContents(params.view_size); |
946 if (params.repaint) | 947 if (params.repaint) |
947 Send(new ViewMsg_Repaint(routing_id(), params.view_size)); | 948 Send(new ViewMsg_Repaint(routing_id(), params.view_size)); |
948 } | 949 } |
949 | 950 |
950 void BrowserPluginGuest::OnSetFocus(int instance_id, bool focused) { | 951 void BrowserPluginGuest::OnSetFocus(int instance_id, bool focused) { |
951 if (focused_ == focused) | 952 if (focused_ == focused) |
952 return; | 953 return; |
953 focused_ = focused; | 954 focused_ = focused; |
954 Send(new ViewMsg_SetFocus(routing_id(), focused)); | 955 Send(new InputMsg_SetFocus(routing_id(), focused)); |
955 } | 956 } |
956 | 957 |
957 void BrowserPluginGuest::OnSetName(int instance_id, const std::string& name) { | 958 void BrowserPluginGuest::OnSetName(int instance_id, const std::string& name) { |
958 if (name == name_) | 959 if (name == name_) |
959 return; | 960 return; |
960 name_ = name; | 961 name_ = name; |
961 Send(new ViewMsg_SetName(routing_id(), name)); | 962 Send(new ViewMsg_SetName(routing_id(), name)); |
962 } | 963 } |
963 | 964 |
964 void BrowserPluginGuest::OnSetSize( | 965 void BrowserPluginGuest::OnSetSize( |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 base::Value::CreateStringValue(request_method)); | 1321 base::Value::CreateStringValue(request_method)); |
1321 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); | 1322 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); |
1322 | 1323 |
1323 SendMessageToEmbedder( | 1324 SendMessageToEmbedder( |
1324 new BrowserPluginMsg_RequestPermission(instance_id(), | 1325 new BrowserPluginMsg_RequestPermission(instance_id(), |
1325 BrowserPluginPermissionTypeDownload, permission_request_id, | 1326 BrowserPluginPermissionTypeDownload, permission_request_id, |
1326 request_info)); | 1327 request_info)); |
1327 } | 1328 } |
1328 | 1329 |
1329 } // namespace content | 1330 } // namespace content |
OLD | NEW |