Chromium Code Reviews| 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 != 0) { | |
|
jam
2011/01/10 18:09:36
nit: the "!= 0" and the brace brackets aren't nece
Bernhard Bauer
2011/01/11 12:43:34
Done.
| |
| 145 return plugin_funcs_.clearsitedata(site, flags, max_age); | |
| 146 } | |
| 147 return NPERR_INVALID_FUNCTABLE_ERROR; | |
| 148 } | |
| 149 | |
| 150 char** PluginLib::NP_GetSitesWithData() { | |
| 151 DCHECK(initialized_); | |
| 152 if (plugin_funcs_.getsiteswithdata != 0) { | |
| 153 return plugin_funcs_.getsiteswithdata(); | |
| 154 } | |
| 155 return NULL; | |
| 156 } | |
| 157 | |
| 140 void PluginLib::PreventLibraryUnload() { | 158 void PluginLib::PreventLibraryUnload() { |
| 141 skip_unload_ = true; | 159 skip_unload_ = true; |
| 142 } | 160 } |
| 143 | 161 |
| 144 PluginInstance* PluginLib::CreateInstance(const std::string& mime_type) { | 162 PluginInstance* PluginLib::CreateInstance(const std::string& mime_type) { |
| 145 PluginInstance* new_instance = new PluginInstance(this, mime_type); | 163 PluginInstance* new_instance = new PluginInstance(this, mime_type); |
| 146 instance_count_++; | 164 instance_count_++; |
| 147 base::StatsCounter(kPluginInstancesActiveCounter).Increment(); | 165 base::StatsCounter(kPluginInstancesActiveCounter).Increment(); |
| 148 DCHECK_NE(static_cast<PluginInstance*>(NULL), new_instance); | 166 DCHECK_NE(static_cast<PluginInstance*>(NULL), new_instance); |
| 149 return new_instance; | 167 return new_instance; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 342 | 360 |
| 343 void PluginLib::Shutdown() { | 361 void PluginLib::Shutdown() { |
| 344 if (initialized_ && !internal_) { | 362 if (initialized_ && !internal_) { |
| 345 NP_Shutdown(); | 363 NP_Shutdown(); |
| 346 initialized_ = false; | 364 initialized_ = false; |
| 347 } | 365 } |
| 348 } | 366 } |
| 349 | 367 |
| 350 } // namespace npapi | 368 } // namespace npapi |
| 351 } // namespace webkit | 369 } // namespace webkit |
| OLD | NEW |