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/renderer/pepper/pepper_plugin_instance_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 // Keep a reference on the stack. See NOTE above. | 1242 // Keep a reference on the stack. See NOTE above. |
1243 scoped_refptr<PepperPluginInstanceImpl> ref(this); | 1243 scoped_refptr<PepperPluginInstanceImpl> ref(this); |
1244 if (!LoadSelectionInterface()) | 1244 if (!LoadSelectionInterface()) |
1245 return base::string16(); | 1245 return base::string16(); |
1246 | 1246 |
1247 PP_Var rv = plugin_selection_interface_->GetSelectedText(pp_instance(), | 1247 PP_Var rv = plugin_selection_interface_->GetSelectedText(pp_instance(), |
1248 PP_FromBool(html)); | 1248 PP_FromBool(html)); |
1249 StringVar* string = StringVar::FromPPVar(rv); | 1249 StringVar* string = StringVar::FromPPVar(rv); |
1250 base::string16 selection; | 1250 base::string16 selection; |
1251 if (string) | 1251 if (string) |
1252 selection = UTF8ToUTF16(string->value()); | 1252 selection = base::UTF8ToUTF16(string->value()); |
1253 // Release the ref the plugin transfered to us. | 1253 // Release the ref the plugin transfered to us. |
1254 HostGlobals::Get()->GetVarTracker()->ReleaseVar(rv); | 1254 HostGlobals::Get()->GetVarTracker()->ReleaseVar(rv); |
1255 return selection; | 1255 return selection; |
1256 } | 1256 } |
1257 | 1257 |
1258 base::string16 PepperPluginInstanceImpl::GetLinkAtPosition( | 1258 base::string16 PepperPluginInstanceImpl::GetLinkAtPosition( |
1259 const gfx::Point& point) { | 1259 const gfx::Point& point) { |
1260 // Keep a reference on the stack. See NOTE above. | 1260 // Keep a reference on the stack. See NOTE above. |
1261 scoped_refptr<PepperPluginInstanceImpl> ref(this); | 1261 scoped_refptr<PepperPluginInstanceImpl> ref(this); |
1262 if (!LoadPdfInterface()) | 1262 if (!LoadPdfInterface()) |
1263 return base::string16(); | 1263 return base::string16(); |
1264 | 1264 |
1265 PP_Point p; | 1265 PP_Point p; |
1266 p.x = point.x(); | 1266 p.x = point.x(); |
1267 p.y = point.y(); | 1267 p.y = point.y(); |
1268 PP_Var rv = plugin_pdf_interface_->GetLinkAtPosition(pp_instance(), p); | 1268 PP_Var rv = plugin_pdf_interface_->GetLinkAtPosition(pp_instance(), p); |
1269 StringVar* string = StringVar::FromPPVar(rv); | 1269 StringVar* string = StringVar::FromPPVar(rv); |
1270 base::string16 link; | 1270 base::string16 link; |
1271 if (string) | 1271 if (string) |
1272 link = UTF8ToUTF16(string->value()); | 1272 link = base::UTF8ToUTF16(string->value()); |
1273 // Release the ref the plugin transfered to us. | 1273 // Release the ref the plugin transfered to us. |
1274 PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(rv); | 1274 PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(rv); |
1275 return link; | 1275 return link; |
1276 } | 1276 } |
1277 | 1277 |
1278 void PepperPluginInstanceImpl::RequestSurroundingText( | 1278 void PepperPluginInstanceImpl::RequestSurroundingText( |
1279 size_t desired_number_of_characters) { | 1279 size_t desired_number_of_characters) { |
1280 // Keep a reference on the stack. See NOTE above. | 1280 // Keep a reference on the stack. See NOTE above. |
1281 scoped_refptr<PepperPluginInstanceImpl> ref(this); | 1281 scoped_refptr<PepperPluginInstanceImpl> ref(this); |
1282 if (!LoadTextInputInterface()) | 1282 if (!LoadTextInputInterface()) |
(...skipping 14 matching lines...) Expand all Loading... |
1297 bool case_sensitive, | 1297 bool case_sensitive, |
1298 int identifier) { | 1298 int identifier) { |
1299 // Keep a reference on the stack. See NOTE above. | 1299 // Keep a reference on the stack. See NOTE above. |
1300 scoped_refptr<PepperPluginInstanceImpl> ref(this); | 1300 scoped_refptr<PepperPluginInstanceImpl> ref(this); |
1301 if (!LoadFindInterface()) | 1301 if (!LoadFindInterface()) |
1302 return false; | 1302 return false; |
1303 find_identifier_ = identifier; | 1303 find_identifier_ = identifier; |
1304 return PP_ToBool( | 1304 return PP_ToBool( |
1305 plugin_find_interface_->StartFind( | 1305 plugin_find_interface_->StartFind( |
1306 pp_instance(), | 1306 pp_instance(), |
1307 UTF16ToUTF8(search_text.c_str()).c_str(), | 1307 base::UTF16ToUTF8(search_text.c_str()).c_str(), |
1308 PP_FromBool(case_sensitive))); | 1308 PP_FromBool(case_sensitive))); |
1309 } | 1309 } |
1310 | 1310 |
1311 void PepperPluginInstanceImpl::SelectFindResult(bool forward) { | 1311 void PepperPluginInstanceImpl::SelectFindResult(bool forward) { |
1312 // Keep a reference on the stack. See NOTE above. | 1312 // Keep a reference on the stack. See NOTE above. |
1313 scoped_refptr<PepperPluginInstanceImpl> ref(this); | 1313 scoped_refptr<PepperPluginInstanceImpl> ref(this); |
1314 if (LoadFindInterface()) | 1314 if (LoadFindInterface()) |
1315 plugin_find_interface_->SelectFindResult(pp_instance(), | 1315 plugin_find_interface_->SelectFindResult(pp_instance(), |
1316 PP_FromBool(forward)); | 1316 PP_FromBool(forward)); |
1317 } | 1317 } |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2046 case PP_INPUTEVENT_TYPE_IME_COMPOSITION_START: | 2046 case PP_INPUTEVENT_TYPE_IME_COMPOSITION_START: |
2047 case PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE: | 2047 case PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE: |
2048 SimulateImeSetCompositionEvent(input_event); | 2048 SimulateImeSetCompositionEvent(input_event); |
2049 break; | 2049 break; |
2050 case PP_INPUTEVENT_TYPE_IME_COMPOSITION_END: | 2050 case PP_INPUTEVENT_TYPE_IME_COMPOSITION_END: |
2051 DCHECK(input_event.character_text.empty()); | 2051 DCHECK(input_event.character_text.empty()); |
2052 SimulateImeSetCompositionEvent(input_event); | 2052 SimulateImeSetCompositionEvent(input_event); |
2053 break; | 2053 break; |
2054 case PP_INPUTEVENT_TYPE_IME_TEXT: | 2054 case PP_INPUTEVENT_TYPE_IME_TEXT: |
2055 render_frame_->SimulateImeConfirmComposition( | 2055 render_frame_->SimulateImeConfirmComposition( |
2056 UTF8ToUTF16(input_event.character_text), gfx::Range()); | 2056 base::UTF8ToUTF16(input_event.character_text), gfx::Range()); |
2057 break; | 2057 break; |
2058 default: | 2058 default: |
2059 return false; | 2059 return false; |
2060 } | 2060 } |
2061 return true; | 2061 return true; |
2062 } | 2062 } |
2063 | 2063 |
2064 void PepperPluginInstanceImpl::SimulateImeSetCompositionEvent( | 2064 void PepperPluginInstanceImpl::SimulateImeSetCompositionEvent( |
2065 const InputEventData& input_event) { | 2065 const InputEventData& input_event) { |
2066 std::vector<size_t> offsets; | 2066 std::vector<size_t> offsets; |
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3075 // Running out-of-process. Initiate an IPC call to notify the plugin | 3075 // Running out-of-process. Initiate an IPC call to notify the plugin |
3076 // process. | 3076 // process. |
3077 ppapi::proxy::HostDispatcher* dispatcher = | 3077 ppapi::proxy::HostDispatcher* dispatcher = |
3078 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); | 3078 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
3079 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( | 3079 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( |
3080 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); | 3080 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); |
3081 } | 3081 } |
3082 } | 3082 } |
3083 | 3083 |
3084 } // namespace content | 3084 } // namespace content |
OLD | NEW |