Chromium Code Reviews| Index: chrome/browser/extensions/extension_webstore_private_api.cc |
| =================================================================== |
| --- chrome/browser/extensions/extension_webstore_private_api.cc (revision 112998) |
| +++ chrome/browser/extensions/extension_webstore_private_api.cc (working copy) |
| @@ -491,3 +491,58 @@ |
| prefs->SetWebStoreLogin(login); |
| return true; |
| } |
| + |
| +GetWebGLStatusFunction::GetWebGLStatusFunction() {} |
| +GetWebGLStatusFunction::~GetWebGLStatusFunction() {} |
| + |
| +// static |
| +bool GetWebGLStatusFunction::IsWebGLAllowed(GpuDataManager* manager) { |
| + bool webgl_allowed = true; |
| + if (!manager->GpuAccessAllowed()) { |
| + webgl_allowed = false; |
| + } else { |
| + uint32 blacklist_flags = manager->GetGpuFeatureFlags().flags(); |
| + if (blacklist_flags & GpuFeatureFlags::kGpuFeatureWebgl) |
| + webgl_allowed = false; |
| + } |
| + return webgl_allowed; |
| +} |
| + |
| +void GetWebGLStatusFunction::OnGpuInfoUpdate() { |
| + GpuDataManager* manager = GpuDataManager::GetInstance(); |
| + manager->RemoveObserver(this); |
| + bool webgl_allowed = IsWebGLAllowed(manager); |
| + result_.reset(Value::CreateStringValue( |
|
Mihai Parparita -not on Chrome
2011/12/06 02:58:11
Rather than repeating the result creation code twi
Zhenyao Mo
2011/12/06 20:00:15
Done.
|
| + webgl_allowed ? "webgl_allowed" : "webgl_blocked")); |
| + SendResponse(true); |
| + |
| + Release(); |
|
Mihai Parparita -not on Chrome
2011/12/06 02:58:11
The convention in extensions code is to add commen
Zhenyao Mo
2011/12/06 20:00:15
Done.
|
| +} |
| + |
| +bool GetWebGLStatusFunction::RunImpl() { |
| + bool finalized = true; |
| +#if defined(OS_LINUX) |
| + finalized = false; |
| +#endif |
| + |
| + GpuDataManager* manager = GpuDataManager::GetInstance(); |
| + if (manager->complete_gpu_info_available()) |
| + finalized = true; |
| + |
| + bool webgl_allowed = IsWebGLAllowed(manager); |
| + if (!webgl_allowed) |
| + finalized = true; |
|
Mihai Parparita -not on Chrome
2011/12/06 02:58:11
This confused me initially, perhaps add comments t
Zhenyao Mo
2011/12/06 20:00:15
Done. Added comment in .h file
|
| + |
| + if (finalized) { |
| + result_.reset(Value::CreateStringValue( |
| + webgl_allowed ? "webgl_allowed" : "webgl_blocked")); |
| + SendResponse(true); |
| + } else { |
| + AddRef(); |
| + |
| + manager->AddObserver(this); |
| + manager->RequestCompleteGpuInfoIfNeeded(); |
| + } |
| + return true; |
| +} |
| + |