OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/plugin_host.h" | 5 #include "webkit/plugins/npapi/plugin_host.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 } | 80 } |
81 #endif | 81 #endif |
82 | 82 |
83 PluginHost::PluginHost() { | 83 PluginHost::PluginHost() { |
84 InitializeHostFuncs(); | 84 InitializeHostFuncs(); |
85 } | 85 } |
86 | 86 |
87 PluginHost::~PluginHost() { | 87 PluginHost::~PluginHost() { |
88 } | 88 } |
89 | 89 |
90 PluginHost *PluginHost::Singleton() { | 90 PluginHost* PluginHost::Singleton() { |
91 CR_DEFINE_STATIC_LOCAL(scoped_refptr<PluginHost>, singleton, ()); | 91 CR_DEFINE_STATIC_LOCAL(scoped_refptr<PluginHost>, singleton, ()); |
92 if (singleton.get() == NULL) { | 92 if (singleton) { |
93 singleton = new PluginHost(); | 93 singleton = new PluginHost(); |
94 } | 94 } |
95 | 95 |
96 DCHECK(singleton.get() != NULL); | 96 DCHECK(singleton); |
97 return singleton; | 97 return singleton.get(); |
98 } | 98 } |
99 | 99 |
100 void PluginHost::InitializeHostFuncs() { | 100 void PluginHost::InitializeHostFuncs() { |
101 memset(&host_funcs_, 0, sizeof(host_funcs_)); | 101 memset(&host_funcs_, 0, sizeof(host_funcs_)); |
102 host_funcs_.size = sizeof(host_funcs_); | 102 host_funcs_.size = sizeof(host_funcs_); |
103 host_funcs_.version = (NP_VERSION_MAJOR << 8) | (NP_VERSION_MINOR); | 103 host_funcs_.version = (NP_VERSION_MAJOR << 8) | (NP_VERSION_MINOR); |
104 | 104 |
105 // The "basic" functions | 105 // The "basic" functions |
106 host_funcs_.geturl = &NPN_GetURL; | 106 host_funcs_.geturl = &NPN_GetURL; |
107 host_funcs_.posturl = &NPN_PostURL; | 107 host_funcs_.posturl = &NPN_PostURL; |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 } | 1153 } |
1154 | 1154 |
1155 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { | 1155 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { |
1156 scoped_refptr<PluginInstance> plugin(FindInstance(instance)); | 1156 scoped_refptr<PluginInstance> plugin(FindInstance(instance)); |
1157 if (plugin.get()) { | 1157 if (plugin.get()) { |
1158 plugin->URLRedirectResponse(!!allow, notify_data); | 1158 plugin->URLRedirectResponse(!!allow, notify_data); |
1159 } | 1159 } |
1160 } | 1160 } |
1161 | 1161 |
1162 } // extern "C" | 1162 } // extern "C" |
OLD | NEW |