| 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 <stdio.h> | 5 #include <stdio.h> |
| 6 #include <string.h> | 6 #include <string.h> |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 } else { | 154 } else { |
| 155 base::AutoLock auto_lock(timers_lock_); | 155 base::AutoLock auto_lock(timers_lock_); |
| 156 uint32_t timer_id = g_npnetscape_funcs->scheduletimer( | 156 uint32_t timer_id = g_npnetscape_funcs->scheduletimer( |
| 157 instance_, delay.InMilliseconds(), false, &NPDelayedTaskSpringboard); | 157 instance_, delay.InMilliseconds(), false, &NPDelayedTaskSpringboard); |
| 158 DelayedTask task = {function, data}; | 158 DelayedTask task = {function, data}; |
| 159 timers_[timer_id] = task; | 159 timers_[timer_id] = task; |
| 160 } | 160 } |
| 161 return true; | 161 return true; |
| 162 } | 162 } |
| 163 | 163 |
| 164 void SetWindow(NPWindow* np_window) { |
| 165 if (scriptable_object_) { |
| 166 ScriptableFromObject(scriptable_object_)->SetWindow(np_window); |
| 167 } |
| 168 } |
| 169 |
| 164 static void NPDelayedTaskSpringboard(NPP npp, uint32_t timer_id) { | 170 static void NPDelayedTaskSpringboard(NPP npp, uint32_t timer_id) { |
| 165 HostNPPlugin* self = reinterpret_cast<HostNPPlugin*>(npp->pdata); | 171 HostNPPlugin* self = reinterpret_cast<HostNPPlugin*>(npp->pdata); |
| 166 DelayedTask task; | 172 DelayedTask task; |
| 167 { | 173 { |
| 168 base::AutoLock auto_lock(self->timers_lock_); | 174 base::AutoLock auto_lock(self->timers_lock_); |
| 169 std::map<uint32_t, DelayedTask>::iterator it = | 175 std::map<uint32_t, DelayedTask>::iterator it = |
| 170 self->timers_.find(timer_id); | 176 self->timers_.find(timer_id); |
| 171 CHECK(it != self->timers_.end()); | 177 CHECK(it != self->timers_.end()); |
| 172 task = it->second; | 178 task = it->second; |
| 173 self->timers_.erase(it); | 179 self->timers_.erase(it); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 return NPERR_NO_ERROR; | 418 return NPERR_NO_ERROR; |
| 413 } | 419 } |
| 414 | 420 |
| 415 NPError HandleEvent(NPP instance, void* ev) { | 421 NPError HandleEvent(NPP instance, void* ev) { |
| 416 VLOG(2) << "HandleEvent"; | 422 VLOG(2) << "HandleEvent"; |
| 417 return NPERR_NO_ERROR; | 423 return NPERR_NO_ERROR; |
| 418 } | 424 } |
| 419 | 425 |
| 420 NPError SetWindow(NPP instance, NPWindow* pNPWindow) { | 426 NPError SetWindow(NPP instance, NPWindow* pNPWindow) { |
| 421 VLOG(2) << "SetWindow"; | 427 VLOG(2) << "SetWindow"; |
| 428 HostNPPlugin* plugin = PluginFromInstance(instance); |
| 429 if (plugin) { |
| 430 plugin->SetWindow(pNPWindow); |
| 431 } |
| 422 return NPERR_NO_ERROR; | 432 return NPERR_NO_ERROR; |
| 423 } | 433 } |
| 424 | 434 |
| 425 } // namespace | 435 } // namespace |
| 426 | 436 |
| 427 #if defined(OS_WIN) | 437 #if defined(OS_WIN) |
| 428 HMODULE g_hModule = NULL; | 438 HMODULE g_hModule = NULL; |
| 429 | 439 |
| 430 BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved) { | 440 BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved) { |
| 431 switch (dwReason) { | 441 switch (dwReason) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 } | 507 } |
| 498 | 508 |
| 499 EXPORT NPError API_CALL NP_GetValue(void* npp, | 509 EXPORT NPError API_CALL NP_GetValue(void* npp, |
| 500 NPPVariable variable, | 510 NPPVariable variable, |
| 501 void* value) { | 511 void* value) { |
| 502 return GetValue((NPP)npp, variable, value); | 512 return GetValue((NPP)npp, variable, value); |
| 503 } | 513 } |
| 504 #endif | 514 #endif |
| 505 | 515 |
| 506 } // extern "C" | 516 } // extern "C" |
| OLD | NEW |