OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/renderer/browser_plugin/browser_plugin.h" | 5 #include "content/renderer/browser_plugin/browser_plugin.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/json/json_string_value_serializer.h" | 8 #include "base/json/json_string_value_serializer.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 typedef std::map<WebKit::WebPluginContainer*, | 84 typedef std::map<WebKit::WebPluginContainer*, |
85 BrowserPlugin*> PluginContainerMap; | 85 BrowserPlugin*> PluginContainerMap; |
86 static base::LazyInstance<PluginContainerMap> g_plugin_container_map = | 86 static base::LazyInstance<PluginContainerMap> g_plugin_container_map = |
87 LAZY_INSTANCE_INITIALIZER; | 87 LAZY_INSTANCE_INITIALIZER; |
88 | 88 |
89 } // namespace | 89 } // namespace |
90 | 90 |
91 BrowserPlugin::BrowserPlugin( | 91 BrowserPlugin::BrowserPlugin( |
92 RenderViewImpl* render_view, | 92 RenderViewImpl* render_view, |
93 WebKit::WebFrame* frame, | 93 WebKit::WebFrame* frame, |
94 const WebPluginParams& params, | 94 const WebPluginParams& params) |
95 int instance_id) | |
96 : guest_instance_id_(browser_plugin::kInstanceIDNone), | 95 : guest_instance_id_(browser_plugin::kInstanceIDNone), |
97 instance_id_(instance_id), | |
98 render_view_(render_view->AsWeakPtr()), | 96 render_view_(render_view->AsWeakPtr()), |
99 render_view_routing_id_(render_view->GetRoutingID()), | 97 render_view_routing_id_(render_view->GetRoutingID()), |
100 container_(NULL), | 98 container_(NULL), |
101 damage_buffer_sequence_id_(0), | 99 damage_buffer_sequence_id_(0), |
102 resize_ack_received_(true), | 100 resize_ack_received_(true), |
103 last_device_scale_factor_(1.0f), | 101 last_device_scale_factor_(1.0f), |
104 sad_guest_(NULL), | 102 sad_guest_(NULL), |
105 guest_crashed_(false), | 103 guest_crashed_(false), |
106 auto_size_ack_pending_(false), | 104 auto_size_ack_pending_(false), |
107 persist_storage_(false), | 105 persist_storage_(false), |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 browser_plugin_manager()->AddBrowserPlugin(guest_instance_id, this); | 388 browser_plugin_manager()->AddBrowserPlugin(guest_instance_id, this); |
391 | 389 |
392 std::map<std::string, base::Value*> props; | 390 std::map<std::string, base::Value*> props; |
393 props[browser_plugin::kWindowID] = | 391 props[browser_plugin::kWindowID] = |
394 new base::FundamentalValue(guest_instance_id); | 392 new base::FundamentalValue(guest_instance_id); |
395 TriggerEvent(browser_plugin::kEventInternalInstanceIDAllocated, &props); | 393 TriggerEvent(browser_plugin::kEventInternalInstanceIDAllocated, &props); |
396 } | 394 } |
397 | 395 |
398 void BrowserPlugin::Attach(scoped_ptr<base::DictionaryValue> extra_params) { | 396 void BrowserPlugin::Attach(scoped_ptr<base::DictionaryValue> extra_params) { |
399 BrowserPluginHostMsg_Attach_Params attach_params; | 397 BrowserPluginHostMsg_Attach_Params attach_params; |
400 attach_params.browser_plugin_instance_id = instance_id_; | |
401 attach_params.focused = ShouldGuestBeFocused(); | 398 attach_params.focused = ShouldGuestBeFocused(); |
402 attach_params.visible = visible_; | 399 attach_params.visible = visible_; |
403 attach_params.name = GetNameAttribute(); | 400 attach_params.name = GetNameAttribute(); |
404 attach_params.storage_partition_id = storage_partition_id_; | 401 attach_params.storage_partition_id = storage_partition_id_; |
405 attach_params.persist_storage = persist_storage_; | 402 attach_params.persist_storage = persist_storage_; |
406 attach_params.src = GetSrcAttribute(); | 403 attach_params.src = GetSrcAttribute(); |
407 GetDamageBufferWithSizeParams(&attach_params.auto_size_params, | 404 GetDamageBufferWithSizeParams(&attach_params.auto_size_params, |
408 &attach_params.resize_guest_params); | 405 &attach_params.resize_guest_params); |
409 | 406 |
410 browser_plugin_manager()->Send( | 407 browser_plugin_manager()->Send( |
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1448 const WebKit::WebMouseEvent& event) { | 1445 const WebKit::WebMouseEvent& event) { |
1449 browser_plugin_manager()->Send( | 1446 browser_plugin_manager()->Send( |
1450 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, | 1447 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, |
1451 guest_instance_id_, | 1448 guest_instance_id_, |
1452 plugin_rect_, | 1449 plugin_rect_, |
1453 &event)); | 1450 &event)); |
1454 return true; | 1451 return true; |
1455 } | 1452 } |
1456 | 1453 |
1457 } // namespace content | 1454 } // namespace content |
OLD | NEW |