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 "content/renderer/pepper/pepper_plugin_delegate_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <cstddef> | 8 #include <cstddef> |
9 #include <map> | 9 #include <map> |
10 #include <queue> | 10 #include <queue> |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 base::PlatformFile file, | 279 base::PlatformFile file, |
280 int file_open_id, | 280 int file_open_id, |
281 quota::QuotaLimitType quota_policy) { | 281 quota::QuotaLimitType quota_policy) { |
282 callback.Run(base::PLATFORM_FILE_OK, | 282 callback.Run(base::PLATFORM_FILE_OK, |
283 base::PassPlatformFile(&file), | 283 base::PassPlatformFile(&file), |
284 quota_policy, | 284 quota_policy, |
285 base::Bind(&DoNotifyCloseFile, file_open_id)); | 285 base::Bind(&DoNotifyCloseFile, file_open_id)); |
286 // Make sure we won't leak file handle if the requester has died. | 286 // Make sure we won't leak file handle if the requester has died. |
287 if (file != base::kInvalidPlatformFileValue) { | 287 if (file != base::kInvalidPlatformFileValue) { |
288 base::FileUtilProxy::Close( | 288 base::FileUtilProxy::Close( |
289 RenderThreadImpl::current()->GetFileThreadMessageLoopProxy(), file, | 289 RenderThreadImpl::current()->GetFileThreadMessageLoopProxy().get(), |
| 290 file, |
290 base::Bind(&DoNotifyCloseFile, file_open_id)); | 291 base::Bind(&DoNotifyCloseFile, file_open_id)); |
291 } | 292 } |
292 } | 293 } |
293 | 294 |
294 void DidFailOpenFileSystemURL( | 295 void DidFailOpenFileSystemURL( |
295 const webkit::ppapi::PluginDelegate::AsyncOpenFileSystemURLCallback& | 296 const webkit::ppapi::PluginDelegate::AsyncOpenFileSystemURLCallback& |
296 callback, | 297 callback, |
297 base::PlatformFileError error_code) { | 298 base::PlatformFileError error_code) { |
298 base::PlatformFile invalid_file = base::kInvalidPlatformFileValue; | 299 base::PlatformFile invalid_file = base::kInvalidPlatformFileValue; |
299 callback.Run(error_code, | 300 callback.Run(error_code, |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 base::PlatformFileError error_code, | 959 base::PlatformFileError error_code, |
959 base::PlatformFile file, | 960 base::PlatformFile file, |
960 int message_id) { | 961 int message_id) { |
961 AsyncOpenFileCallback* callback = | 962 AsyncOpenFileCallback* callback = |
962 pending_async_open_files_.Lookup(message_id); | 963 pending_async_open_files_.Lookup(message_id); |
963 DCHECK(callback); | 964 DCHECK(callback); |
964 pending_async_open_files_.Remove(message_id); | 965 pending_async_open_files_.Remove(message_id); |
965 callback->Run(error_code, base::PassPlatformFile(&file)); | 966 callback->Run(error_code, base::PassPlatformFile(&file)); |
966 // Make sure we won't leak file handle if the requester has died. | 967 // Make sure we won't leak file handle if the requester has died. |
967 if (file != base::kInvalidPlatformFileValue) | 968 if (file != base::kInvalidPlatformFileValue) |
968 base::FileUtilProxy::Close(GetFileThreadMessageLoopProxy(), file, | 969 base::FileUtilProxy::Close(GetFileThreadMessageLoopProxy().get(), |
| 970 file, |
969 base::FileUtilProxy::StatusCallback()); | 971 base::FileUtilProxy::StatusCallback()); |
970 delete callback; | 972 delete callback; |
971 } | 973 } |
972 | 974 |
973 void PepperPluginDelegateImpl::OnSetFocus(bool has_focus) { | 975 void PepperPluginDelegateImpl::OnSetFocus(bool has_focus) { |
974 for (std::set<webkit::ppapi::PluginInstance*>::iterator i = | 976 for (std::set<webkit::ppapi::PluginInstance*>::iterator i = |
975 active_instances_.begin(); | 977 active_instances_.begin(); |
976 i != active_instances_.end(); ++i) | 978 i != active_instances_.end(); ++i) |
977 (*i)->SetContentAreaFocus(has_focus); | 979 (*i)->SetContentAreaFocus(has_focus); |
978 } | 980 } |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1695 should_close_source); | 1697 should_close_source); |
1696 } | 1698 } |
1697 | 1699 |
1698 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const { | 1700 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const { |
1699 RendererPpapiHostImpl* host = | 1701 RendererPpapiHostImpl* host = |
1700 RendererPpapiHostImpl::GetForPPInstance(instance); | 1702 RendererPpapiHostImpl::GetForPPInstance(instance); |
1701 return host && host->IsRunningInProcess(); | 1703 return host && host->IsRunningInProcess(); |
1702 } | 1704 } |
1703 | 1705 |
1704 } // namespace content | 1706 } // namespace content |
OLD | NEW |