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 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1241 | 1241 |
1242 void PepperPluginInstanceImpl::SetSelectedText( | 1242 void PepperPluginInstanceImpl::SetSelectedText( |
1243 const base::string16& selected_text) { | 1243 const base::string16& selected_text) { |
1244 selected_text_ = selected_text; | 1244 selected_text_ = selected_text; |
1245 } | 1245 } |
1246 | 1246 |
1247 void PepperPluginInstanceImpl::SetLinkUnderCursor(const std::string& url) { | 1247 void PepperPluginInstanceImpl::SetLinkUnderCursor(const std::string& url) { |
1248 link_under_cursor_ = base::UTF8ToUTF16(url); | 1248 link_under_cursor_ = base::UTF8ToUTF16(url); |
1249 } | 1249 } |
1250 | 1250 |
| 1251 void PepperPluginInstanceImpl::SetTextInputType(ui::TextInputType type) { |
| 1252 text_input_type_ = type; |
| 1253 render_frame_->PepperTextInputTypeChanged(this); |
| 1254 } |
| 1255 |
1251 base::string16 PepperPluginInstanceImpl::GetSelectedText(bool html) { | 1256 base::string16 PepperPluginInstanceImpl::GetSelectedText(bool html) { |
1252 // Keep a reference on the stack. See NOTE above. | 1257 // Keep a reference on the stack. See NOTE above. |
1253 scoped_refptr<PepperPluginInstanceImpl> ref(this); | 1258 scoped_refptr<PepperPluginInstanceImpl> ref(this); |
1254 if (!LoadSelectionInterface()) | 1259 if (!LoadSelectionInterface()) |
1255 return selected_text_; | 1260 return selected_text_; |
1256 | 1261 |
1257 PP_Var rv = plugin_selection_interface_->GetSelectedText(pp_instance(), | 1262 PP_Var rv = plugin_selection_interface_->GetSelectedText(pp_instance(), |
1258 PP_FromBool(html)); | 1263 PP_FromBool(html)); |
1259 StringVar* string = StringVar::FromPPVar(rv); | 1264 StringVar* string = StringVar::FromPPVar(rv); |
1260 base::string16 selection; | 1265 base::string16 selection; |
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2593 GetMouseLockDispatcher()->UnlockMouse(GetOrCreateLockTargetAdapter()); | 2598 GetMouseLockDispatcher()->UnlockMouse(GetOrCreateLockTargetAdapter()); |
2594 } | 2599 } |
2595 | 2600 |
2596 void PepperPluginInstanceImpl::SetTextInputType(PP_Instance instance, | 2601 void PepperPluginInstanceImpl::SetTextInputType(PP_Instance instance, |
2597 PP_TextInput_Type type) { | 2602 PP_TextInput_Type type) { |
2598 if (!render_frame_) | 2603 if (!render_frame_) |
2599 return; | 2604 return; |
2600 int itype = type; | 2605 int itype = type; |
2601 if (itype < 0 || itype > ui::TEXT_INPUT_TYPE_URL) | 2606 if (itype < 0 || itype > ui::TEXT_INPUT_TYPE_URL) |
2602 itype = ui::TEXT_INPUT_TYPE_NONE; | 2607 itype = ui::TEXT_INPUT_TYPE_NONE; |
2603 text_input_type_ = static_cast<ui::TextInputType>(itype); | 2608 SetTextInputType(static_cast<ui::TextInputType>(itype)); |
2604 render_frame_->PepperTextInputTypeChanged(this); | |
2605 } | 2609 } |
2606 | 2610 |
2607 void PepperPluginInstanceImpl::UpdateCaretPosition( | 2611 void PepperPluginInstanceImpl::UpdateCaretPosition( |
2608 PP_Instance instance, | 2612 PP_Instance instance, |
2609 const PP_Rect& caret, | 2613 const PP_Rect& caret, |
2610 const PP_Rect& bounding_box) { | 2614 const PP_Rect& bounding_box) { |
2611 if (!render_frame_) | 2615 if (!render_frame_) |
2612 return; | 2616 return; |
2613 text_input_caret_ = PP_ToGfxRect(caret); | 2617 text_input_caret_ = PP_ToGfxRect(caret); |
2614 text_input_caret_bounds_ = PP_ToGfxRect(bounding_box); | 2618 text_input_caret_bounds_ = PP_ToGfxRect(bounding_box); |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3137 // Running out-of-process. Initiate an IPC call to notify the plugin | 3141 // Running out-of-process. Initiate an IPC call to notify the plugin |
3138 // process. | 3142 // process. |
3139 ppapi::proxy::HostDispatcher* dispatcher = | 3143 ppapi::proxy::HostDispatcher* dispatcher = |
3140 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); | 3144 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
3141 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( | 3145 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( |
3142 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); | 3146 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); |
3143 } | 3147 } |
3144 } | 3148 } |
3145 | 3149 |
3146 } // namespace content | 3150 } // namespace content |
OLD | NEW |