| 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 "webkit/plugins/npapi/plugin_lib.h" | 5 #include "webkit/plugins/npapi/plugin_lib.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/metrics/stats_counters.h" | 9 #include "base/metrics/stats_counters.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 << "): result=" << rv; | 130 << "): result=" << rv; |
| 131 initialized_ = (rv == NPERR_NO_ERROR); | 131 initialized_ = (rv == NPERR_NO_ERROR); |
| 132 return rv; | 132 return rv; |
| 133 } | 133 } |
| 134 | 134 |
| 135 void PluginLib::NP_Shutdown(void) { | 135 void PluginLib::NP_Shutdown(void) { |
| 136 DCHECK(initialized_); | 136 DCHECK(initialized_); |
| 137 entry_points_.np_shutdown(); | 137 entry_points_.np_shutdown(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 NPError PluginLib::NP_ClearSiteData(const char* site, |
| 141 uint64 flags, |
| 142 uint64 max_age) { |
| 143 DCHECK(initialized_); |
| 144 if (plugin_funcs_.clearsitedata) |
| 145 return plugin_funcs_.clearsitedata(site, flags, max_age); |
| 146 return NPERR_INVALID_FUNCTABLE_ERROR; |
| 147 } |
| 148 |
| 149 char** PluginLib::NP_GetSitesWithData() { |
| 150 DCHECK(initialized_); |
| 151 if (plugin_funcs_.getsiteswithdata) |
| 152 return plugin_funcs_.getsiteswithdata(); |
| 153 return NULL; |
| 154 } |
| 155 |
| 140 void PluginLib::PreventLibraryUnload() { | 156 void PluginLib::PreventLibraryUnload() { |
| 141 skip_unload_ = true; | 157 skip_unload_ = true; |
| 142 } | 158 } |
| 143 | 159 |
| 144 PluginInstance* PluginLib::CreateInstance(const std::string& mime_type) { | 160 PluginInstance* PluginLib::CreateInstance(const std::string& mime_type) { |
| 145 PluginInstance* new_instance = new PluginInstance(this, mime_type); | 161 PluginInstance* new_instance = new PluginInstance(this, mime_type); |
| 146 instance_count_++; | 162 instance_count_++; |
| 147 base::StatsCounter(kPluginInstancesActiveCounter).Increment(); | 163 base::StatsCounter(kPluginInstancesActiveCounter).Increment(); |
| 148 DCHECK_NE(static_cast<PluginInstance*>(NULL), new_instance); | 164 DCHECK_NE(static_cast<PluginInstance*>(NULL), new_instance); |
| 149 return new_instance; | 165 return new_instance; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 358 |
| 343 void PluginLib::Shutdown() { | 359 void PluginLib::Shutdown() { |
| 344 if (initialized_ && !internal_) { | 360 if (initialized_ && !internal_) { |
| 345 NP_Shutdown(); | 361 NP_Shutdown(); |
| 346 initialized_ = false; | 362 initialized_ = false; |
| 347 } | 363 } |
| 348 } | 364 } |
| 349 | 365 |
| 350 } // namespace npapi | 366 } // namespace npapi |
| 351 } // namespace webkit | 367 } // namespace webkit |
| OLD | NEW |