| 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 "webkit/plugins/npapi/webplugin_delegate_impl.h" | 5 #include "content/child/npapi/webplugin_delegate_impl.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 #import <QuartzCore/QuartzCore.h> | 8 #import <QuartzCore/QuartzCore.h> |
| 9 #include <unistd.h> | 9 #include <unistd.h> |
| 10 | 10 |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/mac/mac_util.h" | 14 #include "base/mac/mac_util.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/metrics/stats_counters.h" | 16 #include "base/metrics/stats_counters.h" |
| 17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "base/strings/sys_string_conversions.h" | 18 #include "base/strings/sys_string_conversions.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 20 #include "content/child/npapi/plugin_instance.h" |
| 21 #include "content/child/npapi/plugin_lib.h" |
| 22 #include "content/child/npapi/plugin_web_event_converter_mac.h" |
| 23 #include "content/child/npapi/webplugin.h" |
| 24 #include "content/child/npapi/webplugin_accelerated_surface_mac.h" |
| 20 #include "skia/ext/skia_utils_mac.h" | 25 #include "skia/ext/skia_utils_mac.h" |
| 21 #include "third_party/WebKit/public/web/WebInputEvent.h" | 26 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 22 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 27 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
| 23 #include "webkit/common/cursors/webcursor.h" | 28 #include "webkit/common/cursors/webcursor.h" |
| 24 #include "webkit/plugins/npapi/plugin_instance.h" | |
| 25 #include "webkit/plugins/npapi/plugin_lib.h" | |
| 26 #include "webkit/plugins/npapi/plugin_web_event_converter_mac.h" | |
| 27 #include "webkit/plugins/npapi/webplugin.h" | |
| 28 #include "webkit/plugins/npapi/webplugin_accelerated_surface_mac.h" | |
| 29 | 29 |
| 30 using WebKit::WebKeyboardEvent; | 30 using WebKit::WebKeyboardEvent; |
| 31 using WebKit::WebInputEvent; | 31 using WebKit::WebInputEvent; |
| 32 using WebKit::WebMouseEvent; | 32 using WebKit::WebMouseEvent; |
| 33 using WebKit::WebMouseWheelEvent; | 33 using WebKit::WebMouseWheelEvent; |
| 34 using webkit::WebPluginInfo; |
| 34 | 35 |
| 35 // Important implementation notes: The Mac definition of NPAPI, particularly | 36 // Important implementation notes: The Mac definition of NPAPI, particularly |
| 36 // the distinction between windowed and windowless modes, differs from the | 37 // the distinction between windowed and windowless modes, differs from the |
| 37 // Windows and Linux definitions. Most of those differences are | 38 // Windows and Linux definitions. Most of those differences are |
| 38 // accomodated by the WebPluginDelegate class. | 39 // accomodated by the WebPluginDelegate class. |
| 39 | 40 |
| 40 namespace webkit { | 41 namespace content { |
| 41 namespace npapi { | |
| 42 | 42 |
| 43 namespace { | 43 namespace { |
| 44 | 44 |
| 45 const int kCoreAnimationRedrawPeriodMs = 10; // 100 Hz | 45 const int kCoreAnimationRedrawPeriodMs = 10; // 100 Hz |
| 46 | 46 |
| 47 WebPluginDelegateImpl* g_active_delegate; | 47 WebPluginDelegateImpl* g_active_delegate; |
| 48 | 48 |
| 49 // Helper to simplify correct usage of g_active_delegate. Instantiating will | 49 // Helper to simplify correct usage of g_active_delegate. Instantiating will |
| 50 // set the active delegate to |delegate| for the lifetime of the object, then | 50 // set the active delegate to |delegate| for the lifetime of the object, then |
| 51 // NULL when it goes out of scope. | 51 // NULL when it goes out of scope. |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 [layer_ setFrame:CGRectMake(0, 0, | 719 [layer_ setFrame:CGRectMake(0, 0, |
| 720 window_rect_.width(), window_rect_.height())]; | 720 window_rect_.width(), window_rect_.height())]; |
| 721 [CATransaction commit]; | 721 [CATransaction commit]; |
| 722 | 722 |
| 723 [renderer_ setBounds:[layer_ bounds]]; | 723 [renderer_ setBounds:[layer_ bounds]]; |
| 724 surface_->SetSize(window_rect_.size()); | 724 surface_->SetSize(window_rect_.size()); |
| 725 // Kick off the drawing timer, if necessary. | 725 // Kick off the drawing timer, if necessary. |
| 726 PluginVisibilityChanged(); | 726 PluginVisibilityChanged(); |
| 727 } | 727 } |
| 728 | 728 |
| 729 } // namespace npapi | 729 } // namespace content |
| 730 } // namespace webkit | |
| OLD | NEW |