Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_REQUIREMENTS_PROVIDER_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_REQUIREMENTS_PROVIDER_H_ | |
| 7 | |
| 8 #include <deque> | |
| 9 #include <list> | |
| 10 | |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #include "base/memory/weak_ptr.h" | |
| 13 #include "base/string16.h" | |
| 14 #include "chrome/browser/extensions/extension_service.h" | |
| 15 | |
| 16 class ExtensionService; | |
| 17 class GPUFeatureChecker; | |
| 18 | |
| 19 namespace extensions { | |
| 20 class Extension; | |
| 21 | |
| 22 class RequirementsProvider { | |
|
Aaron Boodman
2012/07/22 17:46:25
Since this class isn't 'providing' things right no
| |
| 23 public: | |
| 24 RequirementsProvider(); | |
| 25 ~RequirementsProvider(); | |
| 26 | |
| 27 // A false return is always valid, however a true one is only pending. | |
| 28 // ExtensionService::UnsupportedRequirements will be called on |service| | |
| 29 // if the requirements are not fullfilled. |async| will inform the caller | |
| 30 // if check is incomplete. | |
| 31 bool Supports(const Extension* extsnion, std::list<string16>* errors, | |
|
Aaron Boodman
2012/07/22 17:46:25
This is a kind of odd interface. How about making
| |
| 32 bool* async, ExtensionService* service); | |
| 33 | |
| 34 // Answer all the pending requirement checks. | |
| 35 void IsWebGLAvailable(bool available); | |
| 36 void IsCSS3dAvailable(bool available); | |
| 37 | |
| 38 private: | |
| 39 struct GPUFeatureRequest { | |
| 40 GPUFeatureRequest(const std::string& id, | |
| 41 base::WeakPtr<ExtensionService> service); | |
| 42 GPUFeatureRequest(); | |
| 43 ~GPUFeatureRequest(); | |
| 44 | |
| 45 std::string extension_id; | |
| 46 base::WeakPtr<ExtensionService> weak_service; | |
| 47 }; | |
| 48 | |
| 49 scoped_refptr<GPUFeatureChecker> webgl_checker_; | |
| 50 bool checked_for_webgl_; | |
| 51 bool webgl_supported_; | |
| 52 std::deque<GPUFeatureRequest> async_webgl_checks_; | |
| 53 | |
| 54 scoped_refptr<GPUFeatureChecker> css3d_checker_; | |
| 55 bool checked_for_css3d_; | |
| 56 bool css3d_supported_; | |
| 57 std::deque<GPUFeatureRequest> async_css3d_checks_; | |
| 58 | |
| 59 base::WeakPtrFactory<RequirementsProvider> weak_factory_; | |
| 60 }; | |
| 61 | |
| 62 } // namespace extensions | |
| 63 | |
| 64 #endif // CHROME_BROWSER_EXTENSIONS_REQUIREMENTS_PROVIDER_H_ | |
| OLD | NEW |