| 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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 #include "third_party/WebKit/public/web/WebInputEvent.h" | 99 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 100 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 100 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
| 101 #include "third_party/WebKit/public/web/WebPrintParams.h" | 101 #include "third_party/WebKit/public/web/WebPrintParams.h" |
| 102 #include "third_party/WebKit/public/web/WebPrintScalingOption.h" | 102 #include "third_party/WebKit/public/web/WebPrintScalingOption.h" |
| 103 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" | 103 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" |
| 104 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 104 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
| 105 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" | 105 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" |
| 106 #include "third_party/WebKit/public/web/WebView.h" | 106 #include "third_party/WebKit/public/web/WebView.h" |
| 107 #include "third_party/skia/include/core/SkCanvas.h" | 107 #include "third_party/skia/include/core/SkCanvas.h" |
| 108 #include "third_party/skia/include/core/SkRect.h" | 108 #include "third_party/skia/include/core/SkRect.h" |
| 109 #include "ui/base/range/range.h" | |
| 110 #include "ui/gfx/image/image_skia.h" | 109 #include "ui/gfx/image/image_skia.h" |
| 111 #include "ui/gfx/image/image_skia_rep.h" | 110 #include "ui/gfx/image/image_skia_rep.h" |
| 111 #include "ui/gfx/range/range.h" |
| 112 #include "ui/gfx/rect_conversions.h" | 112 #include "ui/gfx/rect_conversions.h" |
| 113 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 113 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
| 114 #include "v8/include/v8.h" | 114 #include "v8/include/v8.h" |
| 115 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" | 115 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" |
| 116 | 116 |
| 117 #if defined(OS_MACOSX) | 117 #if defined(OS_MACOSX) |
| 118 #include "printing/metafile_impl.h" | 118 #include "printing/metafile_impl.h" |
| 119 #endif // defined(OS_MACOSX) | 119 #endif // defined(OS_MACOSX) |
| 120 | 120 |
| 121 #if defined(OS_WIN) | 121 #if defined(OS_WIN) |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 return SendCompositionEventToPlugin(PP_INPUTEVENT_TYPE_IME_COMPOSITION_END, | 895 return SendCompositionEventToPlugin(PP_INPUTEVENT_TYPE_IME_COMPOSITION_END, |
| 896 text); | 896 text); |
| 897 } | 897 } |
| 898 | 898 |
| 899 bool PepperPluginInstanceImpl::HandleTextInput(const base::string16& text) { | 899 bool PepperPluginInstanceImpl::HandleTextInput(const base::string16& text) { |
| 900 return SendCompositionEventToPlugin(PP_INPUTEVENT_TYPE_IME_TEXT, | 900 return SendCompositionEventToPlugin(PP_INPUTEVENT_TYPE_IME_TEXT, |
| 901 text); | 901 text); |
| 902 } | 902 } |
| 903 | 903 |
| 904 void PepperPluginInstanceImpl::GetSurroundingText(base::string16* text, | 904 void PepperPluginInstanceImpl::GetSurroundingText(base::string16* text, |
| 905 ui::Range* range) const { | 905 gfx::Range* range) const { |
| 906 std::vector<size_t> offsets; | 906 std::vector<size_t> offsets; |
| 907 offsets.push_back(selection_anchor_); | 907 offsets.push_back(selection_anchor_); |
| 908 offsets.push_back(selection_caret_); | 908 offsets.push_back(selection_caret_); |
| 909 *text = base::UTF8ToUTF16AndAdjustOffsets(surrounding_text_, &offsets); | 909 *text = base::UTF8ToUTF16AndAdjustOffsets(surrounding_text_, &offsets); |
| 910 range->set_start(offsets[0] == base::string16::npos ? text->size() | 910 range->set_start(offsets[0] == base::string16::npos ? text->size() |
| 911 : offsets[0]); | 911 : offsets[0]); |
| 912 range->set_end(offsets[1] == base::string16::npos ? text->size() | 912 range->set_end(offsets[1] == base::string16::npos ? text->size() |
| 913 : offsets[1]); | 913 : offsets[1]); |
| 914 } | 914 } |
| 915 | 915 |
| (...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 case PP_INPUTEVENT_TYPE_IME_COMPOSITION_START: | 1913 case PP_INPUTEVENT_TYPE_IME_COMPOSITION_START: |
| 1914 case PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE: | 1914 case PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE: |
| 1915 SimulateImeSetCompositionEvent(input_event); | 1915 SimulateImeSetCompositionEvent(input_event); |
| 1916 break; | 1916 break; |
| 1917 case PP_INPUTEVENT_TYPE_IME_COMPOSITION_END: | 1917 case PP_INPUTEVENT_TYPE_IME_COMPOSITION_END: |
| 1918 DCHECK(input_event.character_text.empty()); | 1918 DCHECK(input_event.character_text.empty()); |
| 1919 SimulateImeSetCompositionEvent(input_event); | 1919 SimulateImeSetCompositionEvent(input_event); |
| 1920 break; | 1920 break; |
| 1921 case PP_INPUTEVENT_TYPE_IME_TEXT: | 1921 case PP_INPUTEVENT_TYPE_IME_TEXT: |
| 1922 render_view_->SimulateImeConfirmComposition( | 1922 render_view_->SimulateImeConfirmComposition( |
| 1923 UTF8ToUTF16(input_event.character_text), ui::Range()); | 1923 UTF8ToUTF16(input_event.character_text), gfx::Range()); |
| 1924 break; | 1924 break; |
| 1925 default: | 1925 default: |
| 1926 return false; | 1926 return false; |
| 1927 } | 1927 } |
| 1928 return true; | 1928 return true; |
| 1929 } | 1929 } |
| 1930 | 1930 |
| 1931 void PepperPluginInstanceImpl::SimulateImeSetCompositionEvent( | 1931 void PepperPluginInstanceImpl::SimulateImeSetCompositionEvent( |
| 1932 const InputEventData& input_event) { | 1932 const InputEventData& input_event) { |
| 1933 std::vector<size_t> offsets; | 1933 std::vector<size_t> offsets; |
| (...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2906 // Running out-of-process. Initiate an IPC call to notify the plugin | 2906 // Running out-of-process. Initiate an IPC call to notify the plugin |
| 2907 // process. | 2907 // process. |
| 2908 ppapi::proxy::HostDispatcher* dispatcher = | 2908 ppapi::proxy::HostDispatcher* dispatcher = |
| 2909 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); | 2909 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
| 2910 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( | 2910 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( |
| 2911 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); | 2911 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); |
| 2912 } | 2912 } |
| 2913 } | 2913 } |
| 2914 | 2914 |
| 2915 } // namespace content | 2915 } // namespace content |
| OLD | NEW |