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/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/linked_ptr.h" | |
12 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
13 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
14 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
15 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
16 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
17 #include "base/strings/utf_offset_string_conversions.h" | 16 #include "base/strings/utf_offset_string_conversions.h" |
18 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
19 #include "base/thread_task_runner_handle.h" | 18 #include "base/thread_task_runner_handle.h" |
20 #include "base/time/time.h" | 19 #include "base/time/time.h" |
21 #include "base/trace_event/trace_event.h" | 20 #include "base/trace_event/trace_event.h" |
(...skipping 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2112 WebView* web_view = container()->element().document().frame()->view(); | 2111 WebView* web_view = container()->element().document().frame()->view(); |
2113 if (!web_view) { | 2112 if (!web_view) { |
2114 NOTREACHED(); | 2113 NOTREACHED(); |
2115 return; | 2114 return; |
2116 } | 2115 } |
2117 | 2116 |
2118 bool handled = SimulateIMEEvent(input_event); | 2117 bool handled = SimulateIMEEvent(input_event); |
2119 if (handled) | 2118 if (handled) |
2120 return; | 2119 return; |
2121 | 2120 |
2122 std::vector<linked_ptr<WebInputEvent> > events = | 2121 std::vector<scoped_ptr<WebInputEvent>> events = CreateSimulatedWebInputEvents( |
2123 CreateSimulatedWebInputEvents( | 2122 input_event, view_data_.rect.point.x + view_data_.rect.size.width / 2, |
2124 input_event, | 2123 view_data_.rect.point.y + view_data_.rect.size.height / 2); |
2125 view_data_.rect.point.x + view_data_.rect.size.width / 2, | 2124 for (std::vector<scoped_ptr<WebInputEvent>>::iterator it = events.begin(); |
2126 view_data_.rect.point.y + view_data_.rect.size.height / 2); | 2125 it != events.end(); ++it) { |
2127 for (std::vector<linked_ptr<WebInputEvent> >::iterator it = events.begin(); | |
2128 it != events.end(); | |
2129 ++it) { | |
2130 web_view->handleInputEvent(*it->get()); | 2126 web_view->handleInputEvent(*it->get()); |
2131 } | 2127 } |
2132 } | 2128 } |
2133 | 2129 |
2134 bool PepperPluginInstanceImpl::SimulateIMEEvent( | 2130 bool PepperPluginInstanceImpl::SimulateIMEEvent( |
2135 const InputEventData& input_event) { | 2131 const InputEventData& input_event) { |
2136 switch (input_event.event_type) { | 2132 switch (input_event.event_type) { |
2137 case PP_INPUTEVENT_TYPE_IME_COMPOSITION_START: | 2133 case PP_INPUTEVENT_TYPE_IME_COMPOSITION_START: |
2138 case PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE: | 2134 case PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE: |
2139 SimulateImeSetCompositionEvent(input_event); | 2135 SimulateImeSetCompositionEvent(input_event); |
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3278 | 3274 |
3279 void PepperPluginInstanceImpl::RecordFlashJavaScriptUse() { | 3275 void PepperPluginInstanceImpl::RecordFlashJavaScriptUse() { |
3280 if (initialized_ && !javascript_used_ && is_flash_plugin_) { | 3276 if (initialized_ && !javascript_used_ && is_flash_plugin_) { |
3281 javascript_used_ = true; | 3277 javascript_used_ = true; |
3282 RenderThread::Get()->RecordAction( | 3278 RenderThread::Get()->RecordAction( |
3283 base::UserMetricsAction("Flash.JavaScriptUsed")); | 3279 base::UserMetricsAction("Flash.JavaScriptUsed")); |
3284 } | 3280 } |
3285 } | 3281 } |
3286 | 3282 |
3287 } // namespace content | 3283 } // namespace content |
OLD | NEW |