OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/renderer/pepper_widget.h" | 5 #include "chrome/renderer/pepper_widget.h" |
6 | 6 |
7 #include "base/hash_tables.h" | 7 #include "base/hash_tables.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "chrome/renderer/pepper_scrollbar_widget.h" | 9 #include "chrome/renderer/pepper_scrollbar_widget.h" |
10 #include "chrome/renderer/webplugin_delegate_pepper.h" | 10 #include "chrome/renderer/webplugin_delegate_pepper.h" |
| 11 #include "skia/ext/platform_canvas.h" |
11 #include "webkit/glue/plugins/plugin_instance.h" | 12 #include "webkit/glue/plugins/plugin_instance.h" |
12 #include "webkit/glue/plugins/webplugin.h" | 13 #include "webkit/glue/plugins/webplugin.h" |
13 #include "webkit/glue/plugins/webplugin_delegate.h" | 14 #include "webkit/glue/plugins/webplugin_delegate.h" |
14 | 15 |
15 #if defined(OS_WIN) | 16 #if defined(OS_WIN) |
16 #include "base/win_util.h" | 17 #include "base/win_util.h" |
17 #endif | 18 #endif |
18 | 19 |
19 static int g_next_id; | 20 static int g_next_id; |
20 typedef base::hash_map<int, PepperWidget*> WidgetMap; | 21 typedef base::hash_map<int, PepperWidget*> WidgetMap; |
21 static base::LazyInstance<WidgetMap> g_widgets(base::LINKER_INITIALIZED); | 22 static base::LazyInstance<WidgetMap> g_widgets(base::LINKER_INITIALIZED); |
22 | 23 |
23 NPError NPCreateWidget(NPP instance, | 24 NPError NPCreateWidget(NPP instance, |
24 NPWidgetType type, | 25 NPWidgetType type, |
25 void* params, | 26 void* params, |
26 NPWidgetID* id) { | 27 NPWidgetID* id) { |
27 PepperWidget* widget; | 28 PepperWidget* widget; |
28 switch(type) { | 29 switch (type) { |
29 case NPWidgetTypeScrollbar: | 30 case NPWidgetTypeScrollbar: |
30 widget = new PepperScrollbarWidget( | 31 widget = new PepperScrollbarWidget( |
31 *static_cast<NPScrollbarCreateParams*>(params)); | 32 *static_cast<NPScrollbarCreateParams*>(params)); |
32 break; | 33 break; |
33 default: | 34 default: |
34 return NPERR_INVALID_PARAM; | 35 return NPERR_INVALID_PARAM; |
35 } | 36 } |
36 | 37 |
37 *id = ++g_next_id; | 38 *id = ++g_next_id; |
38 widget->Init(instance, *id); | 39 widget->Init(instance, *id); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 void PepperWidget::WidgetPropertyChanged(NPWidgetProperty property) { | 137 void PepperWidget::WidgetPropertyChanged(NPWidgetProperty property) { |
137 NPAPI::PluginInstance* instance = | 138 NPAPI::PluginInstance* instance = |
138 static_cast<NPAPI::PluginInstance*>(instance_->ndata); | 139 static_cast<NPAPI::PluginInstance*>(instance_->ndata); |
139 NPPExtensions* extensions = NULL; | 140 NPPExtensions* extensions = NULL; |
140 instance->NPP_GetValue(NPPVPepperExtensions, &extensions); | 141 instance->NPP_GetValue(NPPVPepperExtensions, &extensions); |
141 if (!extensions) | 142 if (!extensions) |
142 return; | 143 return; |
143 | 144 |
144 extensions->widgetPropertyChanged(instance_, id_, property); | 145 extensions->widgetPropertyChanged(instance_, id_, property); |
145 } | 146 } |
OLD | NEW |