Chromium Code Reviews| 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 "chrome/browser/extensions/requirements_checker.h" | 5 #include "chrome/browser/extensions/requirements_checker.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/gpu_feature_checker.h" | 9 #include "chrome/browser/gpu_feature_checker.h" |
| 10 #include "chrome/common/extensions/extension_manifest_constants.h" | 10 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 11 #include "chrome/common/extensions/extension.h" | 11 #include "chrome/common/extensions/extension.h" |
| 12 #include "chrome/common/extensions/manifest.h" | 12 #include "chrome/common/extensions/manifest.h" |
| 13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 14 #include "content/public/common/gpu_feature_type.h" | 14 #include "content/public/common/gpu_feature_type.h" |
| 15 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 17 | 17 |
| 18 #if defined(OS_WIN) | |
| 19 #include "base/win/metro.h" | |
| 20 #endif // defined(OS_WIN) | |
| 21 | |
| 18 namespace extensions { | 22 namespace extensions { |
| 19 | 23 |
| 20 RequirementsChecker::RequirementsChecker() | 24 RequirementsChecker::RequirementsChecker() |
| 21 : pending_requirement_checks_(0) { | 25 : pending_requirement_checks_(0) { |
| 22 } | 26 } |
| 23 | 27 |
| 24 RequirementsChecker::~RequirementsChecker() { | 28 RequirementsChecker::~RequirementsChecker() { |
| 25 } | 29 } |
| 26 | 30 |
| 27 void RequirementsChecker::Check(scoped_refptr<const Extension> extension, | 31 void RequirementsChecker::Check(scoped_refptr<const Extension> extension, |
| 28 base::Callback<void(std::vector<std::string> errors)> callback) { | 32 base::Callback<void(std::vector<std::string> errors)> callback) { |
| 29 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 33 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 30 | 34 |
| 31 callback_ = callback; | 35 callback_ = callback; |
| 32 const Extension::Requirements& requirements = extension->requirements(); | 36 const Extension::Requirements& requirements = extension->requirements(); |
| 33 | 37 |
| 34 if (requirements.npapi) { | 38 if (requirements.npapi) { |
| 35 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
| 36 errors_.push_back( | 40 errors_.push_back( |
| 37 l10n_util::GetStringUTF8(IDS_EXTENSION_NPAPI_NOT_SUPPORTED)); | 41 l10n_util::GetStringUTF8(IDS_EXTENSION_NPAPI_NOT_SUPPORTED)); |
| 38 #endif // defined(OS_CHROMEOS) | 42 #endif // defined(OS_CHROMEOS) |
| 43 #if defined(OS_WIN) | |
| 44 if (base::win::IsMetroProcess()) { | |
|
Wez
2012/09/19 06:34:14
If we assume that it doesn't make sense for an ext
Aaron Boodman
2012/09/19 21:34:52
I don't think that is a good assumption.
| |
| 45 errors_.push_back( | |
| 46 l10n_util::GetStringUTF8(IDS_EXTENSION_NPAPI_NOT_SUPPORTED)); | |
| 47 } | |
| 48 #endif // defined(OS_WIN) | |
| 39 } | 49 } |
| 40 | 50 |
| 41 if (requirements.webgl) { | 51 if (requirements.webgl) { |
| 42 ++pending_requirement_checks_; | 52 ++pending_requirement_checks_; |
| 43 webgl_checker_ = new GPUFeatureChecker( | 53 webgl_checker_ = new GPUFeatureChecker( |
| 44 content::GPU_FEATURE_TYPE_WEBGL, | 54 content::GPU_FEATURE_TYPE_WEBGL, |
| 45 base::Bind(&RequirementsChecker::SetWebGLAvailability, | 55 base::Bind(&RequirementsChecker::SetWebGLAvailability, |
| 46 AsWeakPtr())); | 56 AsWeakPtr())); |
| 47 } | 57 } |
| 48 | 58 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 if (--pending_requirement_checks_ == 0) { | 99 if (--pending_requirement_checks_ == 0) { |
| 90 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 100 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 91 base::Bind(callback_, errors_)); | 101 base::Bind(callback_, errors_)); |
| 92 // Reset the callback so any ref-counted bound parameters will get released. | 102 // Reset the callback so any ref-counted bound parameters will get released. |
| 93 callback_.Reset(); | 103 callback_.Reset(); |
| 94 errors_.clear(); | 104 errors_.clear(); |
| 95 } | 105 } |
| 96 } | 106 } |
| 97 | 107 |
| 98 } // namespace extensions | 108 } // namespace extensions |
| OLD | NEW |