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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 return true; | 337 return true; |
338 default: | 338 default: |
339 return false; | 339 return false; |
340 } | 340 } |
341 #endif // defined(OS_CHROMEOS) | 341 #endif // defined(OS_CHROMEOS) |
342 return false; | 342 return false; |
343 } | 343 } |
344 | 344 |
345 class PluginInstanceLockTarget : public MouseLockDispatcher::LockTarget { | 345 class PluginInstanceLockTarget : public MouseLockDispatcher::LockTarget { |
346 public: | 346 public: |
347 PluginInstanceLockTarget(PepperPluginInstanceImpl* plugin) | 347 explicit PluginInstanceLockTarget(PepperPluginInstanceImpl* plugin) |
348 : plugin_(plugin) {} | 348 : plugin_(plugin) {} |
349 | 349 |
350 void OnLockMouseACK(bool succeeded) override { | 350 void OnLockMouseACK(bool succeeded) override { |
351 plugin_->OnLockMouseACK(succeeded); | 351 plugin_->OnLockMouseACK(succeeded); |
352 } | 352 } |
353 | 353 |
354 void OnMouseLockLost() override { plugin_->OnMouseLockLost(); } | 354 void OnMouseLockLost() override { plugin_->OnMouseLockLost(); } |
355 | 355 |
356 bool HandleMouseLockedInputEvent(const blink::WebMouseEvent& event) override { | 356 bool HandleMouseLockedInputEvent(const blink::WebMouseEvent& event) override { |
357 plugin_->HandleMouseLockedInputEvent(event); | 357 plugin_->HandleMouseLockedInputEvent(event); |
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1815 if (!LoadPdfInterface()) | 1815 if (!LoadPdfInterface()) |
1816 return false; | 1816 return false; |
1817 | 1817 |
1818 PP_PdfPrintPresetOptions_Dev options; | 1818 PP_PdfPrintPresetOptions_Dev options; |
1819 if (!plugin_pdf_interface_->GetPrintPresetOptionsFromDocument(pp_instance(), | 1819 if (!plugin_pdf_interface_->GetPrintPresetOptionsFromDocument(pp_instance(), |
1820 &options)) { | 1820 &options)) { |
1821 return false; | 1821 return false; |
1822 } | 1822 } |
1823 | 1823 |
1824 preset_options->isScalingDisabled = PP_ToBool(options.is_scaling_disabled); | 1824 preset_options->isScalingDisabled = PP_ToBool(options.is_scaling_disabled); |
| 1825 switch (options.duplex) { |
| 1826 case PP_PRIVATEDUPLEXMODE_SIMPLEX: |
| 1827 preset_options->duplexMode = blink::WebSimplex; |
| 1828 break; |
| 1829 case PP_PRIVATEDUPLEXMODE_SHORT_EDGE: |
| 1830 preset_options->duplexMode = blink::WebShortEdge; |
| 1831 break; |
| 1832 case PP_PRIVATEDUPLEXMODE_LONG_EDGE: |
| 1833 preset_options->duplexMode = blink::WebLongEdge; |
| 1834 break; |
| 1835 default: |
| 1836 preset_options->duplexMode = blink::WebUnknownDuplexMode; |
| 1837 break; |
| 1838 } |
1825 preset_options->copies = options.copies; | 1839 preset_options->copies = options.copies; |
1826 | 1840 |
1827 return true; | 1841 return true; |
1828 } | 1842 } |
1829 | 1843 |
1830 bool PepperPluginInstanceImpl::CanRotateView() { | 1844 bool PepperPluginInstanceImpl::CanRotateView() { |
1831 if (!LoadPdfInterface() || module()->is_crashed()) | 1845 if (!LoadPdfInterface() || module()->is_crashed()) |
1832 return false; | 1846 return false; |
1833 | 1847 |
1834 return true; | 1848 return true; |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2560 if (!render_frame_ || !render_frame_->GetWebFrame()) | 2574 if (!render_frame_ || !render_frame_->GetWebFrame()) |
2561 return; | 2575 return; |
2562 | 2576 |
2563 blink::WebVector<blink::WebRect> tickmarks_converted( | 2577 blink::WebVector<blink::WebRect> tickmarks_converted( |
2564 static_cast<size_t>(count)); | 2578 static_cast<size_t>(count)); |
2565 for (uint32 i = 0; i < count; ++i) { | 2579 for (uint32 i = 0; i < count; ++i) { |
2566 tickmarks_converted[i] = blink::WebRect(tickmarks[i].point.x, | 2580 tickmarks_converted[i] = blink::WebRect(tickmarks[i].point.x, |
2567 tickmarks[i].point.y, | 2581 tickmarks[i].point.y, |
2568 tickmarks[i].size.width, | 2582 tickmarks[i].size.width, |
2569 tickmarks[i].size.height); | 2583 tickmarks[i].size.height); |
2570 ; | |
2571 } | 2584 } |
2572 blink::WebFrame* frame = render_frame_->GetWebFrame(); | 2585 blink::WebFrame* frame = render_frame_->GetWebFrame(); |
2573 frame->setTickmarks(tickmarks_converted); | 2586 frame->setTickmarks(tickmarks_converted); |
2574 } | 2587 } |
2575 | 2588 |
2576 PP_Bool PepperPluginInstanceImpl::IsFullscreen(PP_Instance instance) { | 2589 PP_Bool PepperPluginInstanceImpl::IsFullscreen(PP_Instance instance) { |
2577 return PP_FromBool(view_data_.is_fullscreen); | 2590 return PP_FromBool(view_data_.is_fullscreen); |
2578 } | 2591 } |
2579 | 2592 |
2580 PP_Bool PepperPluginInstanceImpl::SetFullscreen(PP_Instance instance, | 2593 PP_Bool PepperPluginInstanceImpl::SetFullscreen(PP_Instance instance, |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3303 | 3316 |
3304 void PepperPluginInstanceImpl::RecordFlashJavaScriptUse() { | 3317 void PepperPluginInstanceImpl::RecordFlashJavaScriptUse() { |
3305 if (initialized_ && !javascript_used_ && is_flash_plugin_) { | 3318 if (initialized_ && !javascript_used_ && is_flash_plugin_) { |
3306 javascript_used_ = true; | 3319 javascript_used_ = true; |
3307 RenderThread::Get()->RecordAction( | 3320 RenderThread::Get()->RecordAction( |
3308 base::UserMetricsAction("Flash.JavaScriptUsed")); | 3321 base::UserMetricsAction("Flash.JavaScriptUsed")); |
3309 } | 3322 } |
3310 } | 3323 } |
3311 | 3324 |
3312 } // namespace content | 3325 } // namespace content |
OLD | NEW |